Monitor LCD values while running

stevasm

New Member
HI - I know that you can see LCD values in the Picaxe editor simulator. What about if I am running live? I have my programming cable connected to the Picaxe. How can I see what it would be outputting to the LCD (without actually hooking an LCD up to the Picaxe)? Is there a way to do this?

thanks
 

hippy

Technical Support
Staff member
If you are using an AXE133 or similar serial display you may be able to simply redirect the SEROUT commands to the 'Serial Out' pin rather than the pin which goes to the LCD.

If you have defined the pin using a SYMBOL command then you will only need to change that definition.

If you have a PICAXE which doesn't allow SEROUT to redirect to the 'Serial Out' pin, or want to format the output for easier readability on the screen, you can craft #MACRO and #DEFINE definitions which will allow you to create a command which can send to LCD or 'Serial Out', even both.

If you can let us know which PICAXE you are using, what LCD you have, provide some code examples showing how you are currently sending display data to the LCD, that will help determine what would be best to do.
 

stevasm

New Member
Hi - I am using a Picaxe 40X2. The code to my LCD looks like this: serout D.2,T9600,("0",#TrackCurrent) The LCD I am using is a Sparkfun 20x40 serial LCD.
I have two connectors on my circuit board. One programs the Picaxe (three pins). The other is also three pins and outputs to the LCD (D.2, +5v, Gnd). I somehow fried the LCD. I have ordered a new one, but while I am waiting I want to see if I can monitor what the LCD would display some other way.
 

hippy

Technical Support
Staff member
40X2 ... serout D.2,T9600,("0",#TrackCurrent)
That's good because the 40X2 has its 'Serial Out' on pin A.4

The first pass would be to change all "SEROUT D.2, T9600" to "SEROUT LCD, LCD_BAUD" then define 'LCD' and 'LCD_BAUD' at the top of the program, with a choice of configuring for LCD or 'Serial Out' output. Something like ...
Code:
#Picaxe 40X2
#Terminal 9600

; Uncomment the line below if an LCD is connected
; #Define LCD_ATTACHED

#IfDef LCD_ATTACHED
  Symbol LCD      = D.2   ; To actual LCD
  Symbol LCD_BAUD = T9600 ; Uses UART polarity, idle high
#Else
  Symbol LCD      = A.4   ; Serial Out on 40X2
  Symbol LCD_BAUD = N9600 ; Uses RS232 polarity, idle low
#EndIf

PowerOnReset:
  #IfDef LCD_ATTACHED
    High LCD              ; LCD uses UART polarity, idle high
  #EndIf

MainLoop:
  Do
     ...
     SerOut LCD, LCD_BAUD, ("0", #TrackCurrent)
     ...
  Loop
 

stevasm

New Member
thanks - this worked, especially after I turned off the Display non ascii as text. However, the data does not line wrap at 20 chars like the LCD does. So I am having a problem reading the data. Is there a way to make it look like the LCD display in terms of formatting?
 

hippy

Technical Support
Staff member
Is there a way to make it look like the LCD display in terms of formatting?
You can add code which will force a new line after filling an LCD line which may help, for example -
Rich (BB code):
SerOut LCD, LCD_BAUD, ("0", #TrackCurrent)
#IfNDef LCD_ATTACHED
  SerOut LCD, LCD_DATA, (CR, LF)
#EndIf
Note that's "#IfNDef" not "#IfDef" -- "if not defined".
 

stevasm

New Member
thanks, what I just realized is that I am pushing values into different positions of the LCD using code like the following. Will the serial monitor will be able to figure this out and position the text in the correct position?

serout LCD, LCD_BAUD,(254,146)
SerOut LCD, LCD_BAUD, ("0", #TrackCurrent)
 
Top