Thank you, little teaser :)

Hello, first off is how much I appreciat all the responsed I get. It keeps me motivated and interested. Not to mention the ammount of help people provide!

Any way, another order came in to today of a lot more parts for my project. (LCD screen which displays the temperature and a little rolling message of 'Trevor's JTAG')

I have got the temperature working! It was one of the best things I have done so far. I was a little disappointed because i paid 2£ for a little digital temperature monitor which is quite a lot if you think how small it is! But there again it does the job very nicely.
Any way here is my results:
http://i56.tinypic.com/r0t44n.jpg

What happens at the moment is if the temp is below 24 degrees then the LED flickers to warn of it being to low. When it is above 24 it is constantly on to say it is right! I know this is a little basic but for a start I am impressed. Now If I am right The command to send it over the LCD is:

Main:
readtemp C.0,b1 ; This puts the value in to B1
serout B.7,N2400,(#b1) ; transmits the value to serial LCD
goto Main

Thank you very much for you time and if you have any questions or idea for my little project feel free to post a comment :) Thanks!
 

nick12ab

Senior Member
If you're just constantly sending the value to the serial LCD with no control commands or spaces won't you just get a continuous stream of joined numbers on the display?
 

jtcurneal

Senior Member
What you have will send the temp to the LCD module,
but it will keep putting the new temp righ after the preverious temp.
and you will have the LCD display covered with numbers

Before you send the new temp information,
send a command to place the curser back at the beginning
for example
serout b.7,N2400,(254,128) ; reset the curser to the beginning of line 1

Joel
 

elios

Senior Member
The main thing I see there is that there isn't a pause in the loop large enough for the LCD to recongise the end of the serial string being sent to it?
 

mrburnette

Senior Member
LCD and digital thermometer

Any way, another order came in to today of a lot more parts for my project. (LCD screen which displays the temperature and a little rolling message of 'Trevor's JTAG')
I have found that the easiest way to use a multi-line LCD is to configure logic for each line (a subroutine or blocked-code). Then in the main program, you can call LCD_L1, LCD_L2, etc. assuming sub-routines or you can use the IF/Select Case commands to control which lines are updated. Nice part is that this produces modular code that you can expand in the future if you go to a 4-line or larger display.

I have an example here using a non-standard display:
http://www.instructables.com/id/PICAXE-Pitcher-Perfect-Thermometer/

and below using both a "T" and "N" and PC display with the LCD control parameters read from EEPROM (full code: http://www.picaxeforum.co.uk/showthread.php?19123-Morse-Code-Decoding-8WPM-with-a-PICAXE-08M2

Code:
'Example - will not run AS-IS

Point = 150 : Read Point, S_01	' LCD Command byte
Point = 151 : Read Point, S_02	' LCD Clear Screen
Point = 152 : Read Point, S_03	' LCD POS on Line 1
Point = 153 : Read Point, S_04	' LCD POS on Line 2
Point = 154	: Read Point, S_05	' LCD TOP LINE END POS +2
Point = 155	: Read Point, S_06	' LCD BTM LINE END POS +2
Point = 156	: Read Point, S_07	' LCD second character (spacer) normally " "

' --------------------------------- more init stuff --------------------------

LCD = 1		' Default to LCD Display and formatting
IF PINC.6 = 0 then' IS the Physical pin #4 at ground?
	LCD = 0	' Switch to PC terminal/monitor
	S_07 = 32	' Always send a CHR(32) as second character to terminal
ENDIf

BAUD = BAUDMODE_T	' Default to "True" TTL RS232 signaling "idle high"
IF PINC.7 = 0 then	' IS the Physical pin #3 at ground?
	BAUD = BAUDMODE_N	' Default to "Inverted TTL RS232 signaling "idle low"
ENDIF

' Example: For Scott Edwards display: LCD = 1 and BAUD = BAUDMODE_N
' Example: For SparkFun display:      LCD = 1 and BAUD = BAUDMODE_T
' Example: For PC Hyperterminal:      LCD = 0 and BAUD = BAUDMODE_N

' ------------------- more code --------------------------
' Write copyright and disclosure
IF LCD = 0 then
	serout MONITOR,BAUD,("(c) M.R.Burnette",LF,CR)
	serout MONITOR,BAUD,("Morse Reader V8",LF,CR)
ELSE
	' LCD stuff
	serout MONITOR,BAUD,(S_01,S_02)
	Pause 4000	' 1/2 second
	serout MONITOR,BAUD,(S_01,S_03,"(c) M.R.Burnette")
	serout MONITOR,BAUD,(S_01,S_04,"Morse Reader V8 ")
	Pause 32000 ' FOUR second
	serout MONITOR,BAUD,(S_01,S_03,"________________")
	serout MONITOR,BAUD,(S_01,S_03)
ENDIF

--------------------- More Main Code ---------------------
IF LCD = 1 then
			INC CharCount : INC CharCount
			IF CharCount = S_06	THEN	'Off Screen Line 2
				serout MONITOR,BAUD,(S_01,S_03,"________________")
				serout MONITOR,BAUD,(S_01,S_03)
				CharCount = 2		' Line 1 of LCD ready
			ElseIF CharCount = S_05 THEN	'Off Screen Line 1
				serout MONITOR,BAUD,(S_01,S_04,"________________")
				serout MONITOR,BAUD,(S_01,S_04)
				' Line 2 of LCD ready ... starts with character 17
			ENDIF
		ENDIF
		serout MONITOR,BAUD,(Temp,S_07)	' Common print to Monitor

----------- End sample ------------------
For scrolling, some LCD's have that function already in the firmware... you issue a command to the display, load a string, and start the scrolling. In the dumber displays, you will have to implement it in software. If using a PICAXE with a scratchpad memory, you can use a For-Next loop and indirect addressing to easily implement a software scroll. If the uC does not have scratchpad, you can use the EEPROM and the "Read" command in a loop to do the same thing.

- Ray
 
Last edited:
Top