Serial OLED Module (20x4)

Hi there is is my first post as I am stuck and seeing if there is still any help out there?

I am trying to set up a OLED 20x4 module and I am working few the code provided for this screen I will attach below, I can get the screen to show its welcome message and nothing else dose anyone know how to solve this? I would like it to flow few most of the messages on a loop E.G - power up screen - "have welcome message (normaly www.picaxe.com) - for 1st and 2nd line on screen then Following from this to ("This is msg 2") - then ("This is msg 3") so on..... .but I am unable to show any more messages? sorry if this is a stupid question


here is the code I am running off I can see ("This is msg 0 e.g Welcome ") - and ("This is msg 1 e.g Battery Charging") but nothing else

; AXE134 Serial 20x4 OLED using PICAXE-18M2
; Emulates basic serial operation of the popular AXE033 module
; CPS, May 2011
; JB, Jan 2012

#picaxe 18M2


; Supported Commands
; 0-7, 8-15 CGRAM characters
; 16-252 normal ASCII characters, according to selected character map table
; 253, X display 12 character pre-saved message from EEPROM memory, X can be 0-11
; 254, X OLED command, X can be 0 to 255
; 255, X control outputs C.2, C.1, C.0 (via lower 3 bits of X)

#define use_welcome ; display the welcome message upon power up

symbol baud = N2400_16 ; Serial baud rate 2400,N,8,1. Note main program runs at 16MHz

symbol spare0 = C.0 ; spare output 0
symbol spare1 = C.1 ; spare output 1
symbol spare2 = C.2 ; spare output 2
symbol RX = C.5 ; serial receive pin
symbol enable = C.6 ; OLED enable
symbol rs = C.7 ; OLED RS

; OLED data pins are on B.0 to B.7

; Store the 20 character user defined messages in EEPROM data memory
; First two messages are optionally used as welcome message

; Please remember 4 line displays always use the strange 1-3-2-4 line layout.

EEPROM 00, ("Welcome ") ; store msg 0 in the EEPROM memory
EEPROM 20, ("Battery Charging ") ; store msg 1 in the EEPROM memory
EEPROM 40, ("This is msg 2 ") ; store msg 2 in the EEPROM memory
EEPROM 60, ("This is msg 3 ") ; store msg 3 in the EEPROM memory
EEPROM 80, ("This is msg 4 ") ; store msg 4 in the EEPROM memory
EEPROM 100, ("This is msg 5 ") ; store msg 5 in the EEPROM memory
EEPROM 120, ("This is msg 6 ") ; store msg 6 in the EEPROM memory
EEPROM 140, ("This is msg 7 ") ; store msg 7 in the EEPROM memory
EEPROM 160, ("This is msg 8 ") ; store msg 8 in the EEPROM memory
EEPROM 180, ("This is msg 9 ") ; store msg 9 in the EEPROM memory
EEPROM 200, ("This is msg 10 ") ; store msg 10 in the EEPROM memory
EEPROM 220, ("This is msg 11 ") ; store msg 11 in the EEPROM memory

;initialise OLED
init:
gosub OLED_init ; initialise OLED

; display welcome message if desired
#ifdef use_welcome
let b1 = 0 ; message 0 on top line
gosub msg ; do it

low rs ; command mode
let pinsB = 192 ; move to line 2, instruction 192
pulsout enable,1 ; pulse the enable pin to send data.
high rs ; character mode again

let b1 = 1 ; message 1 on bottom line
gosub msg ; do it
#endif

; main program loop, runs at 16MHz

main:

serin RX,baud,b1 ; wait for the next byte

; NB keep character mode test as first item in this list to optimise speed
if b1 < 253 then
let pinsB = b1 ; output the data
pulsout enable,1 ; pulse the enable pin to send data.
goto main ; quickly loop back to top
else if b1 = 254 then
low rs ; change to command mode for next character
serin RX,baud,b1 ; wait for the command byte
let pinsB = b1 ; output the data
pulsout enable,1 ; pulse the enable pin to send data.
high rs ; back to character mode
goto main ; quickly loop back to top
else if b1 = 253 then
serin RX,baud,b1 ; wait for the next byte
gosub msg ; do the 16 character message
goto main ; back to top
else ; must be 255
serin RX,baud,b1 ; wait for the next byte
let pinsC = b1 & %00000111 | %10000000
; output the data on C.0 to C.1, keep RS high
goto main ; back to top
end if


; power on OLED initialisation sub routine
OLED_init:
let dirsC = %11000111 ; PortC 0,1,2,6,7 all outputs
let dirsB = %11111111 ; PortB all outputs

; Winstar OLED Module Initialisation
; according to WS0010 datasheet (8 bit mode)

pause 500 ; Power stabilistation = 500ms

; Function set - select only one of these 4 character table modes
;let pinsB = %00111000 ; 8 bit, 2 line, 5x8 , English_Japanese table
let pinsB = %00111001 ; 8 bit, 2 line, 5x8 , Western_European table1
;let pinsB = %00111010 ; 8 bit, 2 line, 5x8 , English_Russian table
;let pinsB = %00111011 ; 8 bit, 2 line, 5x8 , Western_European table2

pulsout enable,1 ;

let pinsB = %00001100 ; Display on, no cursor, no blink
pulsout enable,1

let pinsB = %00000001 ; Display Clear
pulsout enable,1
pause 7 ; Allow 6.2ms to clear display

setfreq m16 ; now change to 16Mhz

let pinsB = %00000010 ; Return Home
pulsout enable,1

let pinsB = %00000110 ; Entry Mode, ID=1, SH=0
pulsout enable, 1

high rs ; Leave in character mode
return


; display message from EEPROM sub routine
; message number 0-11 must be in b1 when called
; uses (alters) b1, b2, b3, b4
msg:
let b2 = b1 // 12 * 20 ; EEPROM start address is 0 to 11 multiplied by 20
let b3 = b2 + 20 - 1 ; end address is start address + (20 - 1)
for b4 = b2 to b3 ; for 20 times
read b4,b1 ; read next character from EEPROM data memory into b1
let pinsB = b1 ; output the data
pulsout enable,1 ; pulse the enable pin to send data.
next b4 ; next loop
return




Thanks In Advance! :)
 

AllyCat

Senior Member
Hi,

Welcome to the forum. It's usually better to paste program code within [ code] ... [/code] tags, but it looks as if the code you've posted is the normal embedded code for the AXE134Y modules ?

That program is intended to act as an "intelligent server" for instructions (ASCII character bytes) sent by a second PICaxe. These "control commands" are then received in the main loop by the following code:
Code:
main:
    serin RX,baud,b1            ; wait for the next byte
;   Do what was requested by the byte in b1 ....
goto main
In principle you can put any other instructions ("locally" into b1) at the top of "main" to be displayed on the OLED, but ultimately it will be better to structure the program with more or different subroutines.

Cheers, Alan.
 
Thank you very much for the help i will have a look into it.

K
Hi,

Welcome to the forum. It's usually better to paste program code within [ code] ... [/code] tags, but it looks as if the code you've posted is the normal embedded code for the AXE134Y modules ?

That program is intended to act as an "intelligent server" for instructions (ASCII character bytes) sent by a second PICaxe. These "control commands" are then received in the main loop by the following code:
Code:
main:
    serin RX,baud,b1            ; wait for the next byte
;   Do what was requested by the byte in b1 ....
goto main
In principle you can put any other instructions ("locally" into b1) at the top of "main" to be displayed on the OLED, but ultimately it will be better to structure the program with more or different subroutines.

Cheers, Alan.

Thank you Alan I will have a look in to this much appreciate your reply.

Kind Regards
Chris.
 

Flenser

Senior Member
Chris,

It sounds like the modified version of the AXE133 LED program lkaasje has just posted here does something similar to what you have asked.

If you replace the main loop section of your AXE134 OLED program with a copy of the main loop section from lkaasje's AXE133 LED program and create the extra EEPROM messages that his program uses it might show you how to go about what you ask.
 
Chris,

It sounds like the modified version of the AXE133 LED program lkaasje has just posted here does something similar to what you have asked.

If you replace the main loop section of your AXE134 OLED program with a copy of the main loop section from lkaasje's AXE133 LED program and create the extra EEPROM messages that his program uses it might show you how to go about what you ask.

Thank you for you time on this matter, I sure will give that a go

Kind Regards
Chris
 
Top