November 22, 2024, 06:40:27 PM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


PROP1 serial devices and LCD

Started by SideStreet, November 19, 2007, 10:33:53 AM

Previous topic - Next topic

SideStreet

Using these addressable serial devices (DC16, RC4), on same I/O (PIN7) and works perfect. 

Since the Parallax 4x20 LCD Backlit is a serial device, can I safely use the same I/O PIN7 for the LCD as well?
Then I could CLS or something, to get ride of the gibberish from the other devices and then the LCD code?

Just trying to use the last of my brain cells and be safe, thanks for any advice?   

JonnyMac

November 19, 2007, 11:02:13 AM #1 Last Edit: November 19, 2007, 11:04:27 AM by JonnyMac
You could give it a try, but you'd be forced into updating the LCD after any command to an EFX-TEK device, because those commands will show up in and trash your display.  And... if you happen to have "!" in an LCD string this will fool the EFX-TEK devices into think a command is coming.  It would be easier, in the long run, to put the LCD on a separate pin.
Jon McPhalen
EFX-TEK Hollywood Office

SideStreet

Thanks for good advice.

You are defiantly correct it would be better to use a separate I/O.  Just trying to utilize one of my boards in its currant configuration, out of I/Os and I still have a lot of code space left.  I thought it might work without smoking anything, but not 100% on how?

The DC16 and RC4 are in separate boxes with CAT5 connectors to the Prop1 with a LCD and a trigger.  Looks a little better on set and more durable than the tiny servo wires going to each box.

You wouldn?t happen to have a little snippet sample so I can keep the rest of my hair?

Thanks again you?re the best.



JonnyMac

If you're looking for a "snipped" of code for the Parallax Serial LCD code, here' the program I wrote when I was an Applications Engineer at Parallax.

' =========================================================================
'
'   File...... Serial_LCD_Demo.BS1
'   Purpose... Basic Serial LCD use, including customer characters
'   Author.... (c) Parallax, Inc. -- All Rights Reserved
'   E-mail.... support@parallax.com
'   Started...
'   Updated... 11 FEB 2005
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  TX              = 6             ' serial output to LCD


' -----[ Constants ]-------------------------------------------------------

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

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


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

SYMBOL  idx1            = B2            ' loop counter
SYMBOL  idx2            = B3
SYMBOL  char            = B4            ' characters for display
SYMBOL  newChar         = B5
SYMBOL  pntr            = B6            ' eeprom pointer
SYMBOL  pos             = B7            ' position


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

Custom_Chars:
  EEPROM (LcdCC0, $0E, $1F, $1C, $18, $1C, $1F, $0E, $00)
  EEPROM (LcdCC1, $0E, $1F, $1F, $18, $1F, $1F, $0E, $00)
  EEPROM (LcdCC2, $0E, $1F, $1F, $1F, $1F, $1F, $0E, $00)
  EEPROM (LcdCC3, $00, $0A, $0A, $00, $11, $0E, $06, $00)

Msg2:
  EEPROM ("IS VERY COOL!  ", 3)


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

Reset:
  HIGH TX                               ' setup serial output pin
  PAUSE 100                             ' allow LCD to initialize

DnLoad_Custom_Chars:
  FOR idx1 = 0 TO 35                    ' download 4 characters
    READ idx1, char                     ' get data from table
    SEROUT TX, T2400, (char)            ' send to LCD
  NEXT


' -----[ Program Code ]----------------------------------------------------

' Clear the display and remove cursor and blinking attributes.

Main:
  SEROUT TX, T2400, (LcdBLoff, LcdOn1, LcdCls)
  PAUSE 250
  SEROUT TX, T2400, ("THE BASIC STAMP")


' Scroll "chomper" animation across LCD line 2

Animation:
  FOR idx1 = 0 TO 15                    ' scroll across line
    pntr = 36 + idx1                    ' point to new character
    READ pntr, newChar                  ' read it
    FOR idx2 = 0 TO 4                   ' animate current position
      LOOKUP idx2, (0, 1, 2, 1, newChar), char
      pos = LcdLine2 + idx1
      SEROUT TX, T2400, (pos, char)     ' put current frame at position
      PAUSE 75
    NEXT
  NEXT


' Flash LCD backlight (works only with backlit model)

Flash:
  FOR idx1 = 1 TO 4
    SEROUT TX, T2400, (LcdBLon)
    PAUSE 750
    SEROUT TX, T2400, (LcdBLoff)
    PAUSE 250
  NEXT

  GOTO Main
  END


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


Q: What kind of "set" are you referring to?
Jon McPhalen
EFX-TEK Hollywood Office