16x2 AXE033Y oled

johnrelph

New Member
I have a DS18B20 Temperature Sensor connected to the display via a PICAXE 20M2 running this code from the manual
Code:
temp:	
	pause 500
	serout B.3,N2400, (0)
	pause 400
	readtemp B.4,b11			; read value into b1
	if b11 > 127 then negative	; test for negative
	serout B.3,N2400,(254,142,#b11)
	pause 90
	goto main1

negative:
	let b11 = b11 - 128			; adjust neg value
	serout B.3,N2400,(254,141,"-")
	serout B.3,N2400,(254,142,#b11)
	pause 100
	goto main1
It runs as it should but when the temperature drops below 0 and then rises again the minus sign stays on the display !!.
I have found this in another part of my program all ok up to 99 but if it reads 100 the 1 stays on the screen, I have tried putting a space in front of two digit numbers but has no effect.
 

johnrelph

New Member
Code:
setup:
	b15 = 0
	b16 = 1
	serout B.3,N2400, (1)
	pause 500
	low B.1
	low B.2
	
temp:	
	pause 500
	serout B.3,N2400, (0)
	pause 400
	readtemp B.4,b11			; read value into b1
	if b11 > 127 then negative	; test for negative
	serout B.3,N2400,(254,142,#b11)
	pause 90
	goto main1

negative:
	let b11 = b11 - 128			; adjust neg value
	serout B.3,N2400,(254,141,"-")
	serout B.3,N2400,(254,142,#b11)
	pause 100
	goto main1



;FUEL GAGUE
main1:	
		b10 = 100
		b9=0 b8=0 b7=0 b6=0 b5=0 b4=0 b3=0 b2=0 b1=0 b0=0					
	
main2:			
		readadc C.1,b0
		
		if b0 < 15 then full
		if b0 < 30 then seven
		if b0 < 35 then six
		if b0 < 40 then five
		if b0 < 45 then four
		if b0 < 50 then three
		if b0 < 55 then two
		if b0 < 60 then one
		if b0 > 59 then empty

full:		inc b9 if b9 = b10 then ful  goto main2
seven:	inc b8 if b8 = b10 then seve goto main2
six:		inc b7 if b7 = b10 then si   goto main2
five:		inc b6 if b6 = b10 then fiv  goto main2
four:		inc b5 if b5 = b10 then fou  goto main2
three:	inc b4 if b4 = b10 then thre goto main2
two:		inc b3 if b3 = b10 then tw   goto main2		
one:		inc b2 if b2 = b10 then onee goto main2
empty:	inc b1 if b1 = b10 then empt goto main2

ful:		
		serout B.3,N2400,(254,133,#100)goto temp 
seve:		
		serout B.3,N2400,(254,133,#70)goto temp 
si:		
		serout B.3,N2400,(254,133,#60)goto temp
fiv:		
		serout B.3,N2400,(254,133,#50)goto temp 
fou:		
		serout B.3,N2400,(254,133,#40)goto temp 
thre:		
		serout B.3,N2400,(254,133,#30)goto temp 
tw:		
		serout B.3,N2400,(254,133,#20)goto temp 
onee:		
		serout B.3,N2400,(254,133,#10)goto temp 

empt:		serout B.3,N2400,(254,133,#00)goto temp
 

Goeytex

Senior Member
This seems to work in the simulator as long as I remark out < serout B.3,N2400, (0) >

Code:
temp:	
	pause 500
	serout B.3,N2400, (0)
	pause 400
	readtemp B.4,b11			; read value into b1
	if b11 > 127 then negative	; test for negative
	
	serout B.3,N2400,(254,140," ",#B11) [COLOR="#FF0000"] 'Added Space[/COLOR]
	pause 90
	return 

negative:
	let b11 = b11 - 128			; adjust neg value
	serout B.3,N2400,(254,140,"-",#b11)
	pause 100
	return
 

johnrelph

New Member
This seems to work in the simulator as long as I remark out < serout B.3,N2400, (0) >

Code:
temp:	
	pause 500
	serout B.3,N2400, (0)
	pause 400
	readtemp B.4,b11			; read value into b1
	if b11 > 127 then negative	; test for negative
	
	serout B.3,N2400,(254,140," ",#B11) [COLOR="#FF0000"] 'Added Space[/COLOR]
	pause 90
	return 

negative:
	let b11 = b11 - 128			; adjust neg value
	serout B.3,N2400,(254,140,"-",#b11)
	pause 100
	return
< serout B.3,N2400, (0) > displays the clock on the second line.

thanks for the example, I was adding the space after the # mark, I will try it tomorrow.

Thank tou both for your help
 

nick12ab

Senior Member
Does it really ?

Have you modified the AXE033Y code ?
Read the datasheet. On the AXE033, sending 0 displays the time, and sending 1-7 shows predefined messages. To use CGRAM characters you must send 8-15. It is the AXE133 which doesn't behave like this.

@johnrelph

You also need to add a space after the variable preceded with # so that when the number of digits that make up the number reduces, the last digit of the previous number does not stay on the screen. Blanking the whole number (e.g. by using a predefined message) may cause the number to briefly flash off which will look unprofessional (not that it doesn't already with the use of a slow serial LCD).
 
Top