fastgrandad
New Member
Hi
I am writing a program that uses the Time variable and found it to be slow as a result of using serout to send data to an axe133 OLED display. Other posts on the Time/serout issue state that using the hserout hardware port avoids this problem.
My simple test program using serout works fine but converting it to hserout doesn't; all I get are random characters and I can't see why. They both use the same pin on the 20M2 chip, C.0, and are set for 2400 Baud. I have tried inverted and non-inverted data settings on the 20M2 and the axe133, put in extended pauses between each hserout command, but to no avail. The working serout and non working hserout versions are listed below.
Can someone please tell me why the latter doesn't work?
serout version
hserout version
I'm sure it's something silly but can't see it!
Thanks
Paul
I am writing a program that uses the Time variable and found it to be slow as a result of using serout to send data to an axe133 OLED display. Other posts on the Time/serout issue state that using the hserout hardware port avoids this problem.
My simple test program using serout works fine but converting it to hserout doesn't; all I get are random characters and I can't see why. They both use the same pin on the 20M2 chip, C.0, and are set for 2400 Baud. I have tried inverted and non-inverted data settings on the 20M2 and the axe133, put in extended pauses between each hserout command, but to no avail. The working serout and non working hserout versions are listed below.
Can someone please tell me why the latter doesn't work?
serout version
Code:
#no_data
init:
Symbol OLEDPin= C.0 ; Sets Picaxe output Pin
Symbol Baud = N2400 ; Set Baud rate for OLED
b0=0
pause 2000 ; wait for display to initialise
Main:
do
serout OLEDPin,Baud,(254,1) ; Clear display
pause 30
serout OLEDPin,Baud,(254,128) ; move to start of first line
serout OLEDPin,Baud,("Test display ",#b0)
pause 1000
b0=b0+1
loop until b0>5
serout OLEDPin,Baud,(254,1) ; Clear display
serout OLEDPin,Baud,(254,128) ; move to start of first line
serout OLEDPin,Baud,("Test end")
pause 1000
Goto Main
end
Code:
#no_data
init:
hsersetup B2400_4, %10
pause 2000 ; wait for display to initialise
b0=0
Main:
do
hserout 0,(254,1) ; Clear display
pause 200
hserout 0,(254,128) ; move to start of first line
pause 200
hserout 0,("Test display ",#b0)
pause 1000
b0=b0+1 ; increment b0
loop until b0>5
hserout 0,(254,1) ; Clear displapause 30
pause 200
hserout 0,(254,128) ; move to start of first line
pause 200
hserout 0,("Test end")
pause 1000
Goto Main
end
Thanks
Paul