Lcd i2c temperature display

zoo12

New Member
Good afternoon


Going through my stock of LCD displays and testing them no problem with the serial ones, I cannot get the AXE033 in I2C mode to work with my code.

The lower part of the code below was found on the forum, and worked well in serial mode, it gives current, min and max temperatures from a DS18B20. The two 4k7 resistors were not fitted as they are already on the AXE033 display. (Although I did temporary fit two 10ks in case) now removed))
The AXE was tested in I2C Mode ok using Dave Lincoln test code Hello 123. I can get the decimal points to display. The leg-less Y symbol wiggles when the temperature is increased but no digits of any use. I have hit the brick wall reading about the commands so I need some help please

http://www.picaxeforum.co.uk/showthread.php?19404-Help-with-high-low-temperature&p=181904&viewfull=1#post181904

Code:
'FRED I2C lcd display test.  temprature part tested ok on serial lcd Post 19404 #8
'i2c lcd tested ok with dave lincoln code.

#picaxe 08m2

main:
	pause 500	'Delay to allow AXE033 module to initialize
	'b0 = 43
	
	i2cslave $C6,i2cslow,i2cbyte	'Initialise I2C, AXE033 device = $C6
	
	writei2c 0, ($FE,$80, $FF)	'Move to line 1 char 0
	pause 10			'Delay to allow command to complete
	
	writei2c 0, ("Temp ",b1,$2E,b2,$FF)	'Tinkered show variable
	pause 10			'Delay to allow command to complete

	writei2c 0, ($FE,$C1, $FF)	'Move to line 2 char 1
	pause 10			'Delay to allow command to complete
	
	writei2c 0, ("Max ",b4,$2E,b5, "Min",b8,$2E,b9,$FF)' Tinkered Write  a variable
	pause 10			'Delay to allow command to complete
'Temp

w2 = 0
 
readtemp12 4,w1 'Read temp high resolution

If w1 > w3 then
let w3 = w1
endif

If w1 < w5 then
let w5 = w1
endif

w2 = w1
w2=w2*10/16		'Current
b0=w2/10		'First digits
b1=w2//10		'Decimal points

w4 = w3
w4=w4*10/16		'High
b4=w4/10		'First digits
b5=w4//10		'Decimal points

w6 = w5
w6=w6*10/16		'Low
b8=w6/10		'First digits
b9=w6//10		'Decimal points

 goto main
LCD i2c.JPGlcd i2c temp.JPG

thanks
 

zoo12

New Member
Lcds work great with David Lincoln Test Code also Pull ups are on AXE033 PCB so should not be required. Also added 10k just in case to scl scd lines.

as shown still get junk display
 

MartinM57

Moderator
Untested, but shouldn't it be:

writei2c 0, ("Temp ",#b1,$2E,#b2,$FF) 'Tinkered show variable...

etc?

(and potentially add 48 to the variables as well to get them as the ASCII equivalents rather than just numeric values)
 
Last edited:

nick12ab

Senior Member
Lcds work great with David Lincoln Test Code also Pull ups are on AXE033 PCB so should not be required. Also added 10k just in case to scl scd lines.

as shown still get junk display
@WestAust - you can revel in joy at my failure to notice that the pull-ups were on the AXE033.
 

hippy

Ex-Staff (retired)
Untested, but shouldn't it be:

writei2c 0, ("Temp ",#b1,$2E,#b2,$FF) 'Tinkered show variable...
Use of # is not supported in the I2C or HI2C commands. Variables are best broken into digit characters using BINTOASCII, and it's best to have valid data to send before sending those.
 

zoo12

New Member
Many thanks for reply
@MartinM57 I had sintex error using # but it was worth trying.

@Hippy BINTOASCII worked great once i found the correct variables to use, decided to go back to basics with simple display.

'LCD using AXE033 in I2C mode to display temperture 17/10/2011

#picaxe 08m2

#no_data

main:
pause 500 'Delay to allow AXE033 module to initialize

readtemp C.4,b0

i2cslave $C6,i2cslow,i2cbyte 'Initialise I2C, AXE033 device = $C6

writei2c 0, ($FE,$80, $FF) 'Move to line 1 char 0
pause 10 'Delay to allow command to complete

bintoascii b0,b1,b3,b4

writei2c 0, ("Temperture ",b3,b4," C", $FF)
pause 10 'Delay to allow command to complete

'debug

goto main
The above code gives a simple display, the next step is READTEMP12!
 
Top