AXE033 tests. Variable isn't displayed on LCD if it's above 9. Why?

Lobobo

Member
Hi. Please help me with AXE033 LCD module. I am testing my new AXE033 LCD board with RTC and I've stuck with simple :confused: task.
I am using PICAXE 28X1 and AXE033 LCD module connected via serial port. I am trying to display some text and variable, so everything works if variable does not exceeds 9. When it's value above 9 it's displayed with errors and weird symbols :( And it's fine on simulator :confused:
Please look at my code:

Code:
Setfreq m2

symbol counter = b0
pause 5000			'wait for reconect programming lead with LCD lead

main:

inc counter
if counter > 21 then
counter = 0
endif

sertxd (254,1)				'clear display
pause 30					'this goes always after "clear display" command
sertxd (254,128)				'move to beginning of the first line
sertxd ("Counter: ", #counter,"  ")
pause 500
goto main
I tried with two gaps after variable and without it, but result is always the same. My later task is to show temperature on this screen, but I am afraid the value will be higher than one digit and it won't work. What is wrong here?
Thank you.
 

westaust55

Moderator
Cannot see any reason it would not work for your 28X1.

As you say, it works in the PE simulator.

With my 40X1 at both the intended 2 Mhz and also at 4 Mhz (with the terminal speed adjusted accordingly - which you must be doing to see 0 to 9).


Also when modified (see below) to output to another pin (output5) at 4 MHz it is working for me in real hardware with a 40X1 and both an AXE033 and a non AXE033 LCD module.
There is no N2400_2 parameter in the PE to test at 2 MHz with SEROUT (could work it out later . . . )

Code:
; Setfreq m2

symbol counter = b0
pause 5000			'wait for reconect programming lead with LCD lead

main:

inc counter
if counter > 21 then
counter = 0
endif

SEROUT 5, N2400_4, (254,1)				'clear display
pause 30					'this goes always after "clear display" command
SEROUT 5, N2400_4, (254,128)				'move to beginning of the first line
SEROUT 5, N2400_4, ("Counter: ", #counter,"  ")
pause 500
goto main
 

Lobobo

Member
OK. I'll try to move my LCD from serial port, to output pin, hopefully it will work, otherwise I didn't know what to do...
Thanks.
 

Lobobo

Member
Bingo!!!
Works fine over ordinary output pin. I suppose there is kind of bug or something is wrong to communicate via serial output pin prepared to be used with PC.

Thanks for advice.
 

Bill.b

Senior Member
hi

To display numbers on the AXE033 you have to convert to ASCII. then following code will convert the variable in b0 into 3 ASCII characters b1,b2 and b3 to be passed
to the AXE033, the example is for the I2C connection,
you will have modify for serial.

Code:
bintoascii b0,b1,b2,b3	'Convert  Date To ASCII
	writei2c 0,(b1,b2,b3,255)
	pause 10
regards bill
 

westaust55

Moderator
@Bill.b

Adding the hash character (#) in front of a variable name will achieve the same thing.

For the lines:
SERTXD ("Counter: ", #counter," ")
BINTOASCII Counter, b1,b2,b3
SERTXD (b1,b2,b3, " ")

The only difference is that the second SERTXD outputs leading zeros as well
 
Last edited:
Top