Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

RA8835 LIBRARY

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1257
Location: SYDNEY

australia.gif
PostPosted: Sun Nov 12, 2023 8:48 am    Post subject: RA8835 LIBRARY Reply with quote

Has anyone the library for the RA8835/SED1335 as the links from trexis_5
are no longer working and I have 4 320x240 displays that I would like
to get working primarily as text displays with bascom there is one for arduino
but I prefer bascom

Regards Paul

(BASCOM-AVR version : 2.0.8.6 )
Back to top
View user's profile
enniom

Bascom Member



Joined: 20 Oct 2009
Posts: 537

PostPosted: Fri Nov 24, 2023 7:28 pm    Post subject: Reply with quote

Paul

look here: https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=8006&highlight=raio

E
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1257
Location: SYDNEY

australia.gif
PostPosted: Sat Nov 25, 2023 5:36 am    Post subject: Reply with quote

Have been there but still not working have not the time to work on it for now
will get back to it in the future.
Back to top
View user's profile
enniom

Bascom Member



Joined: 20 Oct 2009
Posts: 537

PostPosted: Sat Nov 25, 2023 4:29 pm    Post subject: Reply with quote

Hopefully,

this may be enough to get you started .....

[Check the pinout carefully as it can be confusing. Having the datasheet handy may also help.]

Code:
'=============================================
'SAMPLE RAiO8835 LCD
'=============================================
$regfile = "m644pdef.dat"

$crystal = 8000000                                          'internal
$hwstack = 64
$swstack = 64
$framesize = 128

Config Submode = New

'====================================================
'Config LCD with RAiO8335 Controller
'====================================================
'Const Crt_size = "240x128"
Const Crt_size = "320x240"

Wport Alias Portc
Dirport Alias Ddrc
Rport Alias Pinc

Rst Alias Porta.4                                        'pin 17
Lcdcs Alias Porta.5                                      '15
E Alias Porta.6                                          '6    (same as RD)
Rw Alias Porta.7                                         '5
A0 Alias Portd.7                                         '4

Const Csrw = &H46                                           'write to cursor address
Const Mwrite = &H42                                         'write to disp memory
Const Mread = &H43                                          'read from disp memory

#if Crt_size = "240x128"
   Const Graphicsize = &H0F00                               '3840 = 240 * 16
   Const Graphicstart = &H01E0                              '480 = 30 * 16
   Const Textsize = &H01DF
   Const Char_row = 30
#endif

#if Crt_size = "320x240"
   Const Graphicsize = 9600                                 '12800 = 320 * 30
   Const Graphicstart = 1200                                '1200 = 40 * 30
   Const Textsize = 1199
   Const Char_row = 40
#endif

Declare Sub Raio8335init
Sub Raio8335init()
   Reset Rst : Waitms 10                                    'RESET the LCD before starting the initialization
   Set Rst : Waitms 10

   Restore Initdatalcd

   Do
        Read I2 : Read I1
        Select Case I2
         Case 0
           Call Writecommand(i1)
         Case 1
           Call Writedata(i1)
        End Select
   Loop Until I2 = 9
End Sub

Declare Sub Writedata(byval A As Byte)
Sub Writedata(byval A As Byte)
    Reset A0
    Wport = A
    Reset Lcdcs
    Reset Rw
    Set E
'    Waitus 10
    Reset E
    Set Rw
    Set Lcdcs
End Sub

Declare Sub Writecommand(byval A As Byte)                   'as shown on datasheet pg 32/85
Sub Writecommand(byval A As Byte)                           'as shown on datasheet pg 32/85
    Set A0
    Wport = A
    Reset Lcdcs
    Reset Rw
    Set E
    Waitus 10
    Reset E
    Set Rw
    Set Lcdcs
End Sub

Declare Sub Cleartext(byval Ay As Byte)
Sub Cleartext(ay As Byte)
    Txpoint = Char_row * Ay
    Call Writecommand(csrw)
    Call Writedata(txpoint_l)
    Call Writedata(txpoint_h)
    Call Writecommand(mwrite)
    For W1 = Txpoint To Textsize : Call Writedata(&H20) : Next
End Sub

Declare Sub Cleargraphic
Sub Cleargraphic()
    Call Writecommand(csrw)
    Call Writedata(grpoint_l)
    Call Writedata(grpoint_h)
    Call Writecommand(mwrite)
    For W1 = 1 To Graphicsize : Call Writedata(0) : Next
End Sub

Declare Sub Displaytext(byval Ss As String * Char_row , Byval Ax As Byte , Byval Ay As Byte)
Sub Displaytext(byval Ss As String * Char_row , Byval Ax As Byte , Byval Ay As Byte)
    W1 = Char_row * Ay : Txpoint = W1 + Ax                  'This subroutine duplicates LOCATE x,y: LCD "text"
    Call Writecommand(csrw)
    Call Writedata(txpoint_l)
    Call Writedata(txpoint_h)
    Call Writecommand(mwrite)
    I1 = Len(ss)
    For I2 = 1 To I1 : T = Mid(ss , I2 , 1) : I3 = Asc(t) : Call Writedata(i3) : Next
End Sub

Declare Sub Setpixel(byval Ax As Word , Byval Ay As Word)
Sub Setpixel(ax As Word , Ay As Word)
   I1 = 1 : I2 = Ax Mod 8 : I2 = 7 - I2                     'location of new pixel within the byte

   Ay = Char_row * Ay : Ax = Ax / 8 : Ay = Ay + Ax
   Grpoint = Graphicstart + Ay                              'address of desired screen location
   Call Writecommand(csrw)                                  'Put cursor on desired location and
   Call Writedata(grpoint_l)                                'find out what is there before write
   Call Writedata(grpoint_h)
   Call Writecommand(mread)

    Set A0                                                  '}
    Reset Lcdcs                                             '}   The datasheet does not describe this process
    Set Rw                                                  '}   or its requirement very well.  E (RD) must be
    Set E                                                   '}   set in order to read from LCD RAM memory
    Dirport = 0                                             '}    
    I3 = Rport                                              '}    
    Reset E                                                 '}  
    Reset Rw                                                '}
    Reset A0                                                '}   This is needed when writing a new pixel to a
    Set Lcdcs                                               '}    graphic location.  Existing displayed information
    Dirport = 255

   Set I3.i2                                                'merge new pixel within existing byte

   Call Writecommand(csrw)
   Call Writedata(grpoint_l)
   Call Writedata(grpoint_h)
   Call Writecommand(mwrite)
   Call Writedata(i3)                                       'write new byte to the graphic screen
End Sub


Dim Grpoint As Word , Grpoint_h As Byte At Grpoint + 1 Overlay , Grpoint_l As Byte At Grpoint Overlay
Dim Txpoint As Word , Txpoint_h As Byte At Txpoint + 1 Overlay , Txpoint_l As Byte At Txpoint Overlay

Dim I1 As Byte , I2 As Byte , I3 As Byte , W1 As Word
Dim T As String * 1


Call Raio8335init()
Call Cleartext(0)
Grpoint = Graphicstart
Call Cleargraphic()
Call Displaytext( "Hello" , 2 , 0)

Call Setpixel(200 , 100)


End

'=========================================
'LCD
'=========================================
#if Crt_size = "240x128"
     Initdatalcd:
     Data 0 , &H40 , 1 , &H10 , 1 , &H87 , 1 , &H07 , 1 , &H1D , 1 , &H25 , 1 , &H7F , 1 , &H1E , 1 , &H00       'System Set
     Data 0 , &H44 , 1 , &H00 , 1 , &H00 , 1 , &H80 , 1 , &HE0 , 1 , &H01 , 1 , &H80 , 1 , &H00 , 1 , &H00 , 1 , &H00 , 1 , &H00       'Scroll
     Data 0 , &H5A , 1 , &H00                                    'HDot_scr
     Data 0 , &H5B , 1 , &H01                                    'Ovlay
     Data 0 , &H5C , 1 , &H00 , 1 , &H70                         'CGram_adr
     Data 0 , &H5D , 1 , &H00 , 1 , &H00                         'CSRform
     Data 0 , &H59 , 1 , &H17                                    'Disp_On
     Data 0 , &H4C                                               'CSRdir_r
     Data 9 , 9                                                  'Init end
#endif

#if Crt_size = "320x240"
Initdatalcd:
     Data 0 , &H40 , 1 , &H10 , 1 , &H87 , 1 , &H07 , 1 , &H27 , 1 , &H50 , 1 , &HEF , 1 , &H28 , 1 , &H00       'System Set
     Data 0 , &H44 , 1 , &H00 , 1 , &H00 , 1 , &HEF , 1 , &HB0 , 1 , &H04 , 1 , &HEF , 1 , &H00 , 1 , &H00 , 1 , &H00 , 1 , &H00       'Scroll
     Data 0 , &H5A , 1 , &H00                                    'HDot_scr
     Data 0 , &H5B , 1 , &H01                                    'Ovlay
     Data 0 , &H5C , 1 , &H00 , 1 , &H70                         'CGram_adr
     Data 0 , &H5D , 1 , &H00 , 1 , &H00                         'CSRform
     Data 0 , &H59 , 1 , &H17                                    'Disp_On
     Data 0 , &H4C                                               'CSRdir_r
     Data 9 , 9                                                  'Init end
#endif
 



E
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum