Art
When used with an LCD or serial out simply displays the current PID_Channel number +1, ie if PID_channel is 0 (channels are 0 to 3), the number 1 is displayed on the screen
The "TT" / "TP" are commands used by the GLCD module, Text type and Text position respectively (just noticed a typo in the example that should be TT not TP - but that makes no difference to the error). The zero at the end is part of the syntax to close the command to the GLCD controller, so it is instructing the program to write to the device (GLCD controller) at said address, "TT" tells the device to display text or the results as text, and then received zero to close the command.
Whilst I could re-write the code to simply write 1,2,3 etc for the display, it was the fact that a line of code thus
Code:
i2cwrite SDApin,SCLpin,$00,$39, "TT",#setpoints(2)dig 2,#setpoints(2)dig 1,0
compiles without error, but
Code:
I2cwrite SDApin, SCLpin, $39, "TT", DEC1 Pid_channel+1, 0
Fails when i2c is used....
The other thing that puzzles me is the following code compiles by no time is displayed on the GLCD....
Code:
'display time on GLCD
i2cwrite SDApin,SCLpin,$00,$39, "TP",0,6
i2cwrite SDApin,SCLpin,$D0,$00,[RTCSec,RTCMin,RTCHour,RTCWDay,RTCDay,RTCMonth,RTCYear,RTCCtrl] ; read DS1307 chip
If RTCHour.6=1 then
i2cwrite SDApin,SCLpin,$00,$39, "TP",0,6
CounterA=(RTCHour>>4)&$01 ' Work-Out 12 or 24 hour Display for Hours
else
CounterA=(RTCHour>>4)&$03
endif
CounterA=CounterA*10+(RTCHour&$0F) ' Display Hours appropriately for 12 or 24 hour Mode
If RTCHour.6=1 then
i2cwrite SDApin,SCLpin,$00,$39, "TT",#CounterA,0
else
i2cwrite SDApin,SCLpin,$00,$39, "TT",#CounterA Dig 1,#CounterA Dig 0,0
endif
i2cwrite SDApin,SCLpin,$00,$39, "TT", ":",#(RTCMin>>4)&$0F,#RTCMin&$0F,0
timeH=(RTCHour>>4) 'convert the BCD format of the hours register and store in variable timeH
timeH=(timeH &$03)*10
timeH=timeH+(RTCHour&$0F)
timeM=(RTCMin>>4)
timeM=(timeM &$07)*10
timeM=timeM+(RTCMin&$0F) 'convert the BCD format of the mins register and store in variable timeM
But again, work fine when HSEROUT is used inplace of i2cwrite....
I think I'll skip the i2c conversion and carry on with the stock serial version, and try and get the rs232 to USB board working with the GLCD driver board.
Bookmarks