Shop OBEX P1 Docs P2 Docs Learn Events
LCD Display works — Parallax Forums

LCD Display works

Buck RogersBuck Rogers Posts: 2,181
edited 2013-10-03 14:10 in BASIC Stamp
Hello!
When I bought the display at the beginning of last month I had plans of using it to display the activities of the parts in my collection. It happens that it works.

I took the sample code from the collection, as described here:
[FONT=times new roman][SIZE=4]
[/SIZE][/FONT]' =========================================================================
'
'   File...... Serial_LCD_Template.BS2
'   Purpose... Template for Parallax Serial LCD
'   Author.... (c) Parallax, Inc. -- All Rights Reserved
'   E-mail.... support@parallax.com
'   Started...
'   Updated... 11 FEB 2005
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================




' -----[ Program Description ]---------------------------------------------




' -----[ Revision History ]------------------------------------------------




' -----[ I/O Definitions ]-------------------------------------------------


TX              PIN     0               ' serial output to LCD
PL1             PIN     1               ' To the PAL
PL2             PIN     2               ' From the PAL
' -----[ Constants ]-------------------------------------------------------


#SELECT $STAMP
  #CASE BS2, BS2E, BS2PE
    T2400       CON     396
    T9600       CON     84
    T19K2       CON     32
  #CASE BS2SX, BS2P
    T2400       CON     1021
    T9600       CON     240
    T19K2       CON     110
#ENDSELECT


LcdBaud         CON     T19K2


LcdBkSpc        CON     $08             ' move cursor left
LcdRt           CON     $09             ' move cursor right
LcdLF           CON     $0A             ' move cursor down 1 line
LcdCls          CON     $0C             ' clear LCD (use PAUSE 5 after)
LcdCR           CON     $0D             ' move pos 0 of next line
LcdBLon         CON     $11             ' backlight on
LcdBLoff        CON     $12             ' backlight off
LcdOff          CON     $15             ' LCD off
LcdOn1          CON     $16             ' LCD on; cursor off, blink off
LcdOn2          CON     $17             ' LCD on; cursor off, blink on
LcdOn3          CON     $18             ' LCD on; cursor on, blink off
LcdOn4          CON     $19             ' LCD on; cursor on, blink on
LcdLine1        CON     $80             ' move to line 1, column 0
LcdLine2        CON     $94             ' move to line 2, column 0


LcdCC0          CON     $F8             ' define custom char 0
LcdCC1          CON     $F9             ' define custom char 1
LcdCC2          CON     $FA             ' define custom char 2
LcdCC3          CON     $FB             ' define custom char 3
LcdCC4          CON     $FC             ' define custom char 4
LcdCC5          CON     $FD             ' define custom char 5
LcdCC6          CON     $FE             ' define custom char 6
LcdCC7          CON     $FF             ' define custom char 7




' -----[ Variables ]-------------------------------------------------------




' -----[ EEPROM Data ]-----------------------------------------------------




' -----[ Initialization ]--------------------------------------------------


Reset:
  HIGH TX                               ' setup serial output pin
  PAUSE 100                             ' allow LCD to initialize
  HIGH PL1
  LOW  PL2
' -----[ Program Code ]----------------------------------------------------


Main:
    ' your code here
  X VAR Word
  Z VAR Word
  Z1 VAR Word
  SEROUT TX,LcdBaud,[LcdCls]
  Z = 20
  FOR X=32 TO 127
  SEROUT TX,LcdBaud, [X]
  PAUSE 750
  SEROUT PL1,LcdBaud,[X]
  PAUSE 375
  PULSIN Pl2, Z, Z1
  SEROUT TX, LcdBaud, [Z1]
 ' SEROUT TX,LcdBaud,[65]
 ' PAUSE 100
 ' SEROUT TX,LcdBaud,[66]
 ' PAUSE 100
 ' SEROUT TX,LcdBaud,[67]
 ' PAUSE 175
 ' SEROUT TX,LcdBaud,[32]
 '  GOTO Main
 NEXT
  END




' -----[ Subroutines ]-----------------------------------------------------


Ignore those items marked with the ' thing. They mark out first attempts to send text unassisted to the display.

First I had the program send out a stream of ordinary ASCII characters and in this case they were the classic group of 32 to 127 to be displayed on the thing. Since the display doesn't clear stuff unless the user wants it to, I added the clear display code next, and that was sent before the stream was sent as next.

I then selected from my collection a PAL16L8 and mounted it on a regular small breadboard. (Oddly enough its the same one mounted on the HWB.) And added two red LED to show activity. After working out the programming logic shown above I then sent the same thing to it, and now back, in this case I used a PULSIN command to capture it, (I was going to use the SERIN one but the structure behind was too arcane and would have been too involved.) the data it grabbed was stuffed into the second blurb, the Z1 variable, from there it was passed to the SEROUT one in the same fashion as the X one was used before. Obviously the displayed data does not match the first set of displayed data because of both the PAL16L8 and perhaps the structure of the PULSIN command.

However regardless of what happens now, the thing works and that's what matters.

Oh and Ron you owe me a box of Oreo Cookies.........

Comments

  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2013-10-03 06:35
    Oh and Ron you owe me a box of Oreo Cookies.........

    Do I? For what pray tell?!?
  • Buck RogersBuck Rogers Posts: 2,181
    edited 2013-10-03 08:29
    Do I? For what pray tell?!?

    Hello!
    For being right regarding the connectors. For putting up with everything I threw at the original discussion regarding the device. Most of all, reacting appropriately to the (now discontinued probably) clearance sale for the display and the others. But you don't really need to track down a box and find out where I live. I threw that in to prompt a response.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2013-10-03 08:59
    Hello!
    For being right regarding the connectors. For putting up with everything I threw at the original discussion regarding the device. Most of all, reacting appropriately to the (now discontinued probably) clearance sale for the display and the others. But you don't really need to track down a box and find out where I live. I threw that in to prompt a response.

    You know, generally if someone helps you out, you might owe them a box of cookies - not the other way around!! :smile:

    In any case I'm glad you solved your problem.

    Were any of the displays actually destroyed in your quest to resolve the issue?
  • Buck RogersBuck Rogers Posts: 2,181
    edited 2013-10-03 14:10
    You know, generally if someone helps you out, you might owe them a box of cookies - not the other way around!! :smile:

    In any case I'm glad you solved your problem.

    Were any of the displays actually destroyed in your quest to resolve the issue?

    Hello!
    No thank goodness! I only have the one display like that here, and it is working just fine. And of course you are correct.

    So far everything is working. My one issue is still tweaking the code.

    On Tuesday when visiting Microcenter to collect the wires, and two items I might need for my other projects, I did see yet another display to add to the mix,
    http://www.parallax.com/product/27979 that one is the 4 x 20 Serial LCD display with backlight.

    I also saw a Prop board that was, well new to me,
    http://www.parallax.com/product/32910 It is the Prop activity board.

    And also new items to keep Quickie going.
Sign In or Register to comment.