OLED AXE134 command (254,14) turns the cursor ON, but which command turns it OFF ?

Buzby

Senior Member
I've looked at the Winstar datasheet, but I'm struggling to understand the cursor stuff.

The AXE134 lets me turn the cursor on, but is there a similar simple command to turn it off ?

EDIT : I've sussed it out, (254,12) !

cheers,

Buzby
 
Last edited:

inglewoodpete

Senior Member
The WinStart OLED datasheet that I have appears to be written by experts for experts.

I researched the commands when I set up my first 2 x 16 OLED back in 2013. The following is a snip from the declarations of that project. It should help other users who are struggling to understand the datasheet.

Rich (BB code):
'      OLED Commands                    bX (Eg b0:, b3:) refers to the bit rather than the PICAXE byte
Symbol cOLEDDisplayClear= %00000001 ' 1 Clear Display (takes 1.7mS)
Symbol cOLEDCursorHome  = %00000010 ' 2 Home          (takes 1.7mS)
Symbol cOLEDEntryModeSet= %00000110 ' 6 Entry Mode Set b2:1 b1:1 move char position forward (b1:0 for backwards)
Symbol cOLEDDisplayOff  = %00001000 ' 8 Display Off b3:1, b2:0(display off), b1:0(csr off), b0:0(csr flash off)
Symbol cOLEDDispCurOff  = %00001100 '12 Display On  b3:1, b2:1(display on),  b1:1(csr on),  b0:1(csr flash)
Symbol cOLEDDispCurOn   = %00001110 '14 Display On  b3:1, b2:1(display on),  b1:1(csr on),  b0:1(csr flash)
Symbol cOLEDCursorShift = %00010000 '16 b4:1, b3:0 (move cursor)/1(move display), b2:0 (sh left)/1(sh right)
Symbol cOLEDFunctionSet = %00110010 '50 b5:1, b4:1(8-bit data), b3:1(2 line LCD) b2:0 (5x7 dots)/1 (5 x 10 dots)
'Symbol cOLEDCharGenAddr= %01cccrrr 'ccc: 8 CG chars; rrr: 8 rows of 5 bits (CG data byte follows: ...xxxxx)
Symbol cOLEDPosnRow0    = %10000000 '128 Position cursor to first row  (b3-b0 = Column 0 to 15) %1000xxxx $8x
Symbol cOLEDPosnRow1    = %11000000 '192 Position cursor to second row (b3-b0 = Column 0 to 15) %1100xxxx $Cx
 

Buzby

Senior Member
Thanks for that !.

The datasheet is virtually impenetrable, it's difficult to determine just what the display offers.

One feature I would like is User Defined Characters. Reading the datasheet seems to indicate these might be possibe, or maybe not.

Does the display support this feature, and if so, has anybody got any example code ?

Cheers,

Buzby
 

marks

Senior Member
Hi Buzby,
their are many ways to achieve what you want ,one way I like is to modify the driver code an example at post #21
 

inglewoodpete

Senior Member
I haven't programmed special characters into an OLED but the following LCD code should work. You will have to use/write your own data transmission subroutines. Chr2LCD just sends the byte while Cmd2LCD would send the 254 prefix first

Rich (BB code):
'ymbol cLCDCharGenAddr  = %01cccrrr 'ccc: 8 CG chars; rrr: 8 rows of 5 bits (CG data byte follows: ...xxxxx)
Symbol cLCDCharGenAddr0 = %01000000 'Character 0, Pixel Row 0 (to 7 for 1 character)
Symbol cLCDPosnRow0     = %10000000 'Position cursor to first row  (b3-b0 = Column 0 to 15) %1000xxxx $8x
Symbol cLCDPosnRow1     = %11000000 'Position cursor to second row (b3-b0 = Column 0 to 15) %1100xxxx $Cx
'
' **** Define and Write Special Characters to LCD RAM *****
'
'Sp Char 0: Up Arrow
' 00100  Byte 0    Value =  4
' 01110       1            14
' 10101       2            21
' 00100       3             4
' 00100       4             4
' 00000       5             0
' 00000       6             0
' 00000       7             0
'Sp Char 1: Right Arrow
' 00000  Byte 0    Value =  0 
' 00100       1             4
' 00010       2             2
' 11111       3            31
' 00010       4             2
' 00100       5             4
' 00000       6             0
' 00000       7             0
'[/color]
LoadSpecialChars:
         bLCDChar = cLCDCharGenAddr0      'Character 0 Row 0 (8 bytes per character; 6 characters to be defined here)
         GoSub Cmd2LCD                    'Position input start point
         For bLoop = 0 To 39              'Pointer to LCD's character RAM locations 0 to 47 (first 6 characters)
'          (Characters)       Up Arrow           Right Arrow          Down Arrow          Left Arrow         Select Button   
'  (Define  5  characters) 0 0 0  0 0 0 0 0   1  1  1 1 1 1 1 1   2 2 2 2 2  2  2 2   3 3 3  3 3 3 3 3   4  4  4  4  4  4 4 4
'  (8-bytes per character) 0 1 2  3 4 5 6 7   0  1  2 3 4 5 6 7   0 1 2 3 4  5  6 7   0 1 2  3 4 5 6 7   0  1  2  3  4  5 6 7
            LookUp bLoop, (4,14,21,4,4,0,0,0,  0,4,2,31,2,4,0,0,  0,0,0,4,4,21,14,4,  0,4,8,31,8,4,0,0,  0,14,17,21,17,14,0,0), bLCDChar
            GoSub Chr2LCD                 'Position cursor (input point)
         Next bLoop
         bLCDChar = cLCDPosnRow1          'Bottom Row, 1st character position
         GoSub Cmd2LCD                    'Position cursor (input point)  - This gets the LCD out of data entry mode
         Return
 

hippy

Technical Support
Staff member
The OLED Commands are the same as standard HD44780 LCD commands except for a few additions.

The Display Set command controls the display and cursor -
Code:
               DCB
$08-$0F  %00001xxx

           D : 0 = Display Off   1 = Display On
           C : 0 = Cursor Off    1 = Cursor On
           B : 0 = Cursor Steady 1 = Cursor Flash
From which there are four sensible possibilities, when unused 'x' are set to zero -
Code:
$08  %000010xx  Display Off
$0C  %0000110x  Display On, No Cursor
$0E  %00001110  Display On, Steady Cursor
$0F  %00001111  Display On, Flashing Cursor
Programming CGRAM characters is achieved by sending a '%01ccc000' command where 'ccc' is the character number 0-7 (000-111), followed by 8 bytes of 5-bit data, for example -
Code:
Command  $40  %01000000
Data     $1B     %11011   ##-##
Data     $1B     %11011   ##-##
Data     $00     %00000   -----
Data     $04     %00100   --#--
Data     $11     %10001   #---#
Data     $0E     %01110   -###-
Data     $00     %00000   -----
 

Buzby

Senior Member
Thanks all for your help.

I feel a bit silly asking questions like this, when I've got the datasheet in front of me, but I don't want to waste hours decoding it if someone has done it before. Usually I can read a datasheet no problem, but this one needs too much effort !.

I've copied hippy's example like this :
Code:
serout OLED("CGRAM test")
serout OLED(254,192)            ' line 2 pos 1

' Make my character at CGRAM address 0 
serout OLED(254, %01000000, $1B, $1B, $00, $04, $11, $0E, $00 )

' Make my character at CGRAM address 1 
serout OLED(254, %01001000, $1B, $1B, $04, $04, $11, $0E, $00 )

' Make my character at CGRAM address 2 
serout OLED(254, %01010000, $1B, $1B, $11, $04, $11, $0E, $00 )
Now how do I display my creations, assuming they actually got into in the OLED ?.

Cheers,

Buzby
 

hippy

Technical Support
Staff member
Now how do I display my creations, assuming they actually got into in the OLED ?.
Issue cursor positioning, eg SEROUT...(254,192), after you have programmed the CGRAM because doing that may have altered where it thinks the cursor is at.

Then, simply use them as ASCII character values 0 through 7, so SEROUT...(0) should show CGRAM character 0 etc

If the driver software treats $00 as a special case you can usually use 8 to 15 instead.

PS : You'll need some baud rates in those SEROUT :)
 

Buzby

Senior Member
Hi hippy,

I've now got User Defined Graphics working.

I took me a while to see how they work. The key is that the UDG locations are listed in the datasheet down the left side of the font table pictures, not somewhere I would first look for User Defined stuff !.

Thanks,

Buzby
 
Top