Shop OBEX P1 Docs P2 Docs Learn Events
Dorm 3.0 Door sign . — Parallax Forums

Dorm 3.0 Door sign .

Peter KG6LSEPeter KG6LSE Posts: 1,383
edited 2011-03-11 14:31 in Robotics
being a Geek in college I must invent a better whiteboard .
I really want to use a IPAD but there is now way Ill stick a 600$ device out of my room .
so I am using the parallax Serial LCD module to display stuff out side of my room

and here is the kicker I can store a TON of pre made messages In the BS2 and with the needed button latch a message . Eg ( Grub time ) ( sleeping ) ( come on in !) so on .

or just default to a list of my contact info .


There was not a schematic as its just 3 wires on a BOE board .

Peter

PHOTO
AND
PHOTO

CODE>>> Attachment not found.

and a video of it VIDEO

Comments

  • WhitWhit Posts: 4,191
    edited 2011-01-28 07:10
    Neat project! Nothing says Geek like an LCD message board outside your room.

    Its no iPad, but you could move up to the uOLED-128-G1 for not too much money - http://www.parallax.com/Store/Accessories/Displays/tabid/159/CategoryID/34/List/0/SortField/0/Level/a/ProductID/452/Default.aspx
    You could display your avatar and other cool color graphics too!

    One day you will be older and have kids - You will show them you latest creation - they will look and you (like my daughter does) and say, "Dad, your such a nerd..." OUCH!
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2011-02-01 12:43
    so far the sign is doing good.

    I may have to add a TEMP reading one of thease days .

    Esp considering the weather here ..

    Peter
    EDIT well in true fashon I did my first RCTIME to LCD project
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    
    
    
    
    
    
    
    
    
    TX              PIN     0               ' serial output to LCD
    
    
    ' -----[ 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
    
    
    ' -----[ Initialization ]--------------------------------------------------
    
                             ' allow LCD to initialize
    
    
    Part1 VAR WORD
    
    Main:
    SEROUT Tx, T2400,[LcdBLon]'backlight on 
    
    
    
    
    DO
    'READ POT
    HIGH 1
    PAUSE 1
    RCTIME 1,1, Part1
    
    
    DEBUG DEC part1 ,CR
    
     'SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    
    SEROUT Tx, T2400,[DEC part1]
    PAUSE 300
    
     SEROUT Tx, T2400,[LcdCls]
    
    
    
    
    LOOP
    

    and a
    Video


    so far is super simple but ill admit getting that dev board was just what I needed to get back to building stuff .
  • bsnutbsnut Posts: 521
    edited 2011-02-04 07:55
    KG6LSE,
    Nice job that you did and it says geek all the way. Now, all you have to do find is a use for the rest of the 15 I/O pins.
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2011-02-06 13:27
    I found a thermistor in my junk drawer . so some time Ill get its values and do scaling to make it happy .

    Peter
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2011-03-02 13:09
    I have a Problem . its racking my brain . I dont see anything wrong My Only guess is the buffer in the RFID read thingy ..



    i added the Serial RFID reader and both sections work in there own program but not in the same one ..

    I used stock parallax code and did some trimming on the RFID package to make it be clean ..


    If I uncommnet a section of code it gives me a Error stating "DATA occupies same location as program"


    ' =========================================================================
    '
    '   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
    ' Modded  By Peterthethinker peter Dekluyver 
    '   {$STAMP BS2}
    '   {$PBASIC 2.5}
    '
    ' =========================================================================
    
    
    ' -----[ Program Description ]---------------------------------------------
    
    
    ' -----[ Revision History ]------------------------------------------------
    
    
    ' -----[ I/O Definitions ]-------------------------------------------------
    
    TX              PIN     0               ' serial output to LCD
    LastTag         CON     3
    
    
    #DEFINE __No_SPRAM = ($STAMP < BS2P)            ' does module have SPRAM?
    
    
    
    
    ' -----[ Constants ]-------------------------------------------------------
    
    
        T2400       CON     396
        T9600       CON     84
        T19K2       CON     32
     
    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 ]-------------------------------------------------------
    
    
      buf           VAR     BYTE(10)                ' RFID bytes buffer
    
    tagNum          VAR     NIB                     ' from EEPROM table
    idx             VAR     BYTE                    ' tag byte index
    char            VAR     BYTE                    ' character from table
    
    ' -----[ EEPROM Data ]-----------------------------------------------------
    
    Tag1            DATA    "0F03027DAA"       'My Tag     
    Tag2            DATA    "04129C1A1C"
    Tag3            DATA    "041402CCD7"
    
    ' -----[ Initialization ]--------------------------------------------------
    
    Reset:
      HIGH TX                               ' setup serial output pin
      PAUSE 100                             ' allow LCD to initialize
    
    
    
    ' -----[ Program Code ]----------------------------------------------------
    
    Main:
    
    DO 
    
    
    
    
    
    
    SEROUT Tx, T2400,[LcdBLon]' backlight on 
    SEROUT Tx, T2400,[LcdCLs]
    'SEROUT Tx, T2400,["ROOM #129"]                     ' HERE to 
    'SEROUT Tx, T2400,[LcdLine2]''   down a line 
    'SEROUT Tx, T2400,["Peter Dekluyver"]
    'PAUSE 2000
    'SEROUT Tx, T2400,[LcdCLs]                            ' HERE is where the Uncomment error is active 
    'GOSUB NOW
    PAUSE 1000
    LOOP
    
    
    
    'NOW:
    GOSUB  ROOM
    GOSUB  PHONE
    GOSUB  EMAIL  
    GOSUB  SKYPE
    GOSUB  HOURS
    
    RETURN
    
    
    TIMER:
    '  PAUSE 5000
    
    ' GOSUB  ROOM
    ' GOSUB  PHONE
    ' GOSUB  EMAIL  
    ' GOSUB  SKYPE
    ' GOSUB  HOURS
    ' SEROUT Tx, T2400,[LcdBLoff]'backlight OFF
    RETURN
    
    
    
      'GOTO Main
      END
    
    
    ' -----[ Subroutines ]-----------------------------------------------------
    
    
    
    RFID:
        '#IF __No_SPRAM #THEN
        SERIN 1, 396, [WAIT($0A), STR buf\10]    ' wait for hdr + ID
     
      '#ENDIF
    
    Check_List:
      FOR tagNum = 1 TO LastTag                     ' scan through known tags
        FOR idx = 0 TO 9                            ' scan bytes in tag
          READ (tagNum - 1 * 10 + idx), char        ' get tag data from table
          #IF __No_SPRAM #THEN
            IF (char <> buf(idx)) THEN Bad_Char     ' compare tag to table
          #ELSE
            GET idx, chkChar                        ' read char from SPRAM
            IF (char <> chkChar) THEN Bad_Char      ' compare to table
          #ENDIF
        NEXT
        GOTO Tag_Found                              ' all bytes match!
    
    Bad_Char:                                       ' try next tag
      NEXT
    
    Tag_Found:
      DEBUG "gold" ,CR   ' TO PC
     SEROUT Tx, T2400,["Welcome Peter"]         
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["To THE ROOM"]
     PAUSE 2000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
       
      RETURN
      END
    
    
    
    
    
    
    
    
    ''''''''''''''''''''''''''''''''''''BLINK
    
    BLINK:
     SEROUT Tx, T2400,[LcdBLon]'backlight OFF
     PAUSE 50
     SEROUT Tx, T2400,[LcdBLoff]'backlight OFF
     PAUSE 50
    RETURN
    ''''''''''''''''''''''''''''''''''''MYROOM
    ROOM:
     SEROUT Tx, T2400,["Welcome to"]         
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["My Room"]
     PAUSE 2000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    RETURN
    ''''''''''''''''''''''''''''''''''''PHONE
    PHONE:
     SEROUT Tx, T2400,["My Phone # Is"]         
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["(909)-634-4250"]
     PAUSE 2000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    RETURN
    ''''''''''''''''''''''''''''''''''''EMAIL
    EMAIL:
     PAUSE 100
     SEROUT Tx, T2400,["My Email is "]
     PAUSE 750
     SEROUT Tx, T2400,[LcdCls]       
     SEROUT Tx, T2400,["Peterthethinker"]     
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["@yahoo.com"]
     PAUSE  3000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    RETURN
    ''''''''''''''''''''''''''''''''''''SKYPE
    SKYPE:
     PAUSE 100
     SEROUT Tx, T2400,["Skype Me @"]
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]             
     PAUSE 250
     SEROUT Tx, T2400,["MVP-studios"]
     PAUSE 2000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    RETURN 
    ''''''''''''''''''''''''''''''''''''HOURS
    HOURS:
     SEROUT Tx, T2400,["My Hours are "]
     PAUSE 1000
     SEROUT Tx, T2400,[LcdCls]      
     PAUSE 100
     SEROUT Tx, T2400,["MON/WED"]
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["OPEN ALL DAY!"]
     PAUSE 2000
     SEROUT Tx, T2400,[LcdCls]       
    
     SEROUT Tx, T2400,["TUES/THRS"]
     PAUSE 1000
     SEROUT Tx, T2400,[LcdCls]      
     PAUSE 100
     SEROUT Tx, T2400,["BIO 8AM-NOON"]
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["History 3PM-5PM"]
     PAUSE 3000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    
     SEROUT Tx, T2400,["WEEKENDS"]
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["OPEN ALL DAY"]
     PAUSE 3000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    RETURN
    
    



    Peter
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2011-03-04 16:26
    OK this is Odd .
    I did a copy paste in to a fresh BS2 file on a second computer and its not giving me any fits
    ' =========================================================================
    '
    '   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
    ' Modded  By Peterthethinker peter Dekluyver 
    '   {$STAMP BS2}
    ' {$PBASIC 2.5}
    '
    ' =========================================================================
    
    
    ' -----[ Program Description ]---------------------------------------------
    
    
    ' -----[ Revision History ]------------------------------------------------
    
    
    ' -----[ I/O Definitions ]-------------------------------------------------
    
    TX              PIN     0               ' serial output to LCD
    LastTag         CON     3
    
    
    #DEFINE __No_SPRAM = ($STAMP < BS2P)            ' does module have SPRAM?
    
    
    
    
    ' -----[ Constants ]-------------------------------------------------------
    
    
        T2400       CON     396
        T9600       CON     84
        T19K2       CON     32
     
    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 ]-------------------------------------------------------
    
    
      buf           VAR     BYTE(10)                ' RFID bytes buffer
    
    tagNum          VAR     NIB                     ' from EEPROM table
    idx             VAR     BYTE                    ' tag byte index
    char            VAR     BYTE                    ' character from table
    
    ' -----[ EEPROM Data ]-----------------------------------------------------
    
    Tag1            DATA    "0F03027DAA"       'My Tag     
    Tag2            DATA    "04129C1A1C"
    Tag3            DATA    "041402CCD7"
    
    ' -----[ Initialization ]--------------------------------------------------
    
    Reset:
      HIGH TX                               ' setup serial output pin
      PAUSE 100                             ' allow LCD to initialize
    
    
    
    ' -----[ Program Code ]----------------------------------------------------
    
    Main:
    
    DO 
    
    
    
    
    
    
    SEROUT Tx, T2400,[LcdBLon]' backlight on 
    SEROUT Tx, T2400,[LcdCLs]
    SEROUT Tx, T2400,["ROOM #129"]                     ' HERE to 
    SEROUT Tx, T2400,[LcdLine2]''   down a line 
    SEROUT Tx, T2400,["Peter Dekluyver"]
    PAUSE 2000
    SEROUT Tx, T2400,[LcdCLs]                            ' HERE is where the Uncomment error is active 
    GOSUB NOW
    PAUSE 1000
    LOOP
    
    
    
    NOW:
    GOSUB  ROOM
    GOSUB  PHONE
    GOSUB  EMAIL  
    GOSUB  SKYPE
    GOSUB  HOURS
    
    RETURN
    
    
    TIMER:
    '  PAUSE 5000
    
    ' GOSUB  ROOM
    ' GOSUB  PHONE
    ' GOSUB  EMAIL  
    ' GOSUB  SKYPE
    ' GOSUB  HOURS
    ' SEROUT Tx, T2400,[LcdBLoff]'backlight OFF
    RETURN
    
    
    
      'GOTO Main
      END
    
    
    ' -----[ Subroutines ]-----------------------------------------------------
    
    
    
    RFID:
        '#IF __No_SPRAM #THEN
        SERIN 1, 396, [WAIT($0A), STR buf\10]    ' wait for hdr + ID
     
      '#ENDIF
    
    Check_List:
      FOR tagNum = 1 TO LastTag                     ' scan through known tags
        FOR idx = 0 TO 9                            ' scan bytes in tag
          READ (tagNum - 1 * 10 + idx), char        ' get tag data from table
          #IF __No_SPRAM #THEN
            IF (char <> buf(idx)) THEN Bad_Char     ' compare tag to table
          #ELSE
            GET idx, chkChar                        ' read char from SPRAM
            IF (char <> chkChar) THEN Bad_Char      ' compare to table
          #ENDIF
        NEXT
        GOTO Tag_Found                              ' all bytes match!
    
    Bad_Char:                                       ' try next tag
      NEXT
    
    Tag_Found:
      DEBUG "gold" ,CR   ' TO PC
     SEROUT Tx, T2400,["Welcome Peter"]         
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["To THE ROOM"]
     PAUSE 2000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
       
      RETURN
      END
    
    
    
    
    
    
    
    
    ''''''''''''''''''''''''''''''''''''BLINK
    
    BLINK:
     SEROUT Tx, T2400,[LcdBLon]'backlight OFF
     PAUSE 50
     SEROUT Tx, T2400,[LcdBLoff]'backlight OFF
     PAUSE 50
    RETURN
    ''''''''''''''''''''''''''''''''''''MYROOM
    ROOM:
     SEROUT Tx, T2400,["Welcome to"]         
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["My Room"]
     PAUSE 2000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    RETURN
    ''''''''''''''''''''''''''''''''''''PHONE
    PHONE:
     SEROUT Tx, T2400,["My Phone # Is"]         
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["(909)-634-4250"]
     PAUSE 2000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    RETURN
    ''''''''''''''''''''''''''''''''''''EMAIL
    EMAIL:
     PAUSE 100
     SEROUT Tx, T2400,["My Email is "]
     PAUSE 750
     SEROUT Tx, T2400,[LcdCls]       
     SEROUT Tx, T2400,["Peterthethinker"]     
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["@yahoo.com"]
     PAUSE  3000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    RETURN
    ''''''''''''''''''''''''''''''''''''SKYPE
    SKYPE:
     PAUSE 100
     SEROUT Tx, T2400,["Skype Me @"]
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]             
     PAUSE 250
     SEROUT Tx, T2400,["MVP-studios"]
     PAUSE 2000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    RETURN 
    ''''''''''''''''''''''''''''''''''''HOURS
    HOURS:
     SEROUT Tx, T2400,["My Hours are "]
     PAUSE 1000
     SEROUT Tx, T2400,[LcdCls]      
     PAUSE 100
     SEROUT Tx, T2400,["MON/WED"]
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["OPEN ALL DAY!"]
     PAUSE 2000
     SEROUT Tx, T2400,[LcdCls]       
    
     SEROUT Tx, T2400,["TUES/THRS"]
     PAUSE 1000
     SEROUT Tx, T2400,[LcdCls]      
     PAUSE 100
     SEROUT Tx, T2400,["BIO 8AM-NOON"]
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["History 3PM-5PM"]
     PAUSE 3000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    
     SEROUT Tx, T2400,["WEEKENDS"]
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["OPEN ALL DAY"]
     PAUSE 3000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    RETURN
    
  • bot7711bot7711 Posts: 16
    edited 2011-03-04 17:23
    Are you still having your problem? I noticed you commented out you NOW: lable in the first program, you had a ' in front of it.
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2011-03-04 19:59
    it runs BUT here is the kicker . Unless I scan a card ( good or bad ) it will not pass over the RFID code back to the main code .

    what I am trying to do is If a valid card is at the reader at the time of scan GOSUB hello peter yada yada . but if no card is there at the time of scan pass on to the next message in the list ..


    I think is the wait command thats messing with me //
    Peter
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2011-03-04 22:48
    OK I added a switch to trigger the RFID reader . its not what I wanted but it wil do for a few day til I find how to do ti the way I want .
    ' =========================================================================
    '
    '   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
    ' Modded  By Peterthethinker peter Dekluyver 
    '   {$STAMP BS2}
    ' {$PBASIC 2.5}
    '
    ' =========================================================================
    
    
    ' -----[ Program Description ]---------------------------------------------
    
    
    ' -----[ Revision History ]------------------------------------------------
    
    
    ' -----[ I/O Definitions ]-------------------------------------------------
    
    TX              PIN     0               ' serial output to LCD
    LastTag         CON     3
    
    
    #DEFINE __No_SPRAM = ($STAMP < BS2P)            ' does module have SPRAM?
    
    
    
    
    ' -----[ Constants ]-------------------------------------------------------
    
    
        T2400       CON     396
        T9600       CON     84
        T19K2       CON     32
     
    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 ]-------------------------------------------------------
    
    
      buf           VAR     BYTE(10)                ' RFID bytes buffer
    
    tagNum          VAR     NIB                     ' from EEPROM table
    idx             VAR     BYTE                    ' tag byte index
    char            VAR     BYTE                    ' character from table
    
    ' -----[ EEPROM Data ]-----------------------------------------------------
    
    Tag1            DATA    "0F03027DAA"       'My Tag     
    Tag2            DATA    "04129C1A1C"
    Tag3            DATA    "041402CCD7"
    
    ' -----[ Initialization ]--------------------------------------------------
    
    Reset:
      HIGH TX                               ' setup serial output pin
      PAUSE 100                             ' allow LCD to initialize
    
    
    
    ' -----[ Program Code ]----------------------------------------------------
    
    Main:
    SEROUT Tx, T2400,[LcdBLon]' backlight on 
    SEROUT Tx, T2400,[LcdCLs]
    
    DO 
    
                              
    IF IN3 =0 THEN GOSUB RFID ELSE GOSUB RoomNum
    IF IN3 =0 THEN GOSUB RFID ELSE GOSUB WELCOME
    IF IN3 =0 THEN GOSUB RFID ELSE GOSUB Phone 
    IF IN3 =0 THEN GOSUB RFID ELSE GOSUB EMAIL 
    IF IN3 =0 THEN GOSUB RFID ELSE GOSUB SKYPE
    IF IN3 =0 THEN GOSUB RFID ELSE GOSUB Hours
    
    
    PAUSE 1000
    
    
    
    
    LOOP
    ' -----[ END OF Program Code ]----------------------------------------------------
    
    
    
    
    ' -----[ RFID Subroutine ]-----------------------------------------------------
    
    
    
    RFID:
    
       LOW 2' NOT USED 
       #IF __No_SPRAM #THEN
        SERIN 1, T2400, [WAIT($0A), STR buf\10]    ' wait for hdr + ID
      #ELSE
        SERIN 1, T2400, [WAIT($0A), SPSTR 10]
      #ENDIF
      HIGH 2 ' NOT USED 
    
    Check_List:
      FOR tagNum = 1 TO LastTag                     ' scan through known tags
        FOR idx = 0 TO 9                            ' scan bytes in tag
          READ (tagNum - 1 * 10 + idx), char        ' get tag data from table
          #IF __No_SPRAM #THEN
            IF (char <> buf(idx)) THEN Bad_Char     ' compare tag to table
          #ELSE
            GET idx, chkChar                        ' read char from SPRAM
            IF (char <> chkChar) THEN Bad_Char      ' compare to table
          #ENDIF
        NEXT
        GOTO Tag_Found                              ' all bytes match!
    RETURN
    Bad_Char:
                                     '  try next tag
      NEXT
    RETURN
    
    Bad_Tag:
      tagNum = 0
    
    GOTO tagdone
    
    Tag_Found:
     DEBUG buf,CR
     SEROUT Tx, T2400,["Welcome Peter"]         
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["TO THE ROOM"]
     PAUSE 2000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
     TOGGLE 10   ' for alarm  later on
     GOSUB blink
     GOSUB blink
     GOSUB blink
     GOSUB blink
     GOSUB blink
    
    
    
    GOTO tagdone
    
    
    tagdone:
    RETURN
    
    
    
    
    ' -----[ Subroutines ]-----------------------------------------------------
    
    
    
    
    ''''''''''''''''''''''''''''''''''''BLINK
    
    BLINK:
     SEROUT Tx, T2400,[LcdBLon]'backlight on
     PAUSE 50
     SEROUT Tx, T2400,[LcdBLoff]'backlight OFF
     PAUSE 50
     SEROUT Tx, T2400,[LcdBLon]'backlight on
     PAUSE 50
     SEROUT Tx, T2400,[LcdBLoff]'backlight OFF
     PAUSE 50 
     SEROUT Tx, T2400,[LcdBLon]'backlight on
     PAUSE 50
     SEROUT Tx, T2400,[LcdBLoff]'backlight OFF
     PAUSE 50
     SEROUT Tx, T2400,[LcdBLon]'backlight on
    RETURN
    
    
    ''''''''''''''''''''''''''''''''''RoomNum
    
    RoomNum:
    SEROUT Tx, T2400,["ROOM #129"]                    
    SEROUT Tx, T2400,[LcdLine2]''   down a line 
    SEROUT Tx, T2400,["Peter Dekluyver"]
    PAUSE 2000
    SEROUT Tx, T2400,[LcdCLs] 
    PAUSE 100
    RETURN
    
    
    ''''''''''''''''''''''''''''''''''''WELCOME
    Welcome:
     SEROUT Tx, T2400,["Welcome to"]         
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["My Room"]
     PAUSE 2000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    RETURN
    ''''''''''''''''''''''''''''''''''''PHONE
    PHONE:
     SEROUT Tx, T2400,["My Phone # Is"]         
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["(909)-634-4250"]
     PAUSE 2000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    RETURN
    ''''''''''''''''''''''''''''''''''''EMAIL
    EMAIL:
     PAUSE 100
     SEROUT Tx, T2400,["My Email is "]
     PAUSE 750
     SEROUT Tx, T2400,[LcdCls]       
     SEROUT Tx, T2400,["Peterthethinker"]     
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["@yahoo.com"]
     PAUSE  3000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    RETURN
    ''''''''''''''''''''''''''''''''''''SKYPE
    SKYPE:
     PAUSE 100
     SEROUT Tx, T2400,["Skype Me @"]
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]             
     PAUSE 250
     SEROUT Tx, T2400,["MVP-studios"]
     PAUSE 2000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    RETURN 
    ''''''''''''''''''''''''''''''''''''HOURS
    HOURS:
     SEROUT Tx, T2400,["My Hours are "]
     PAUSE 1000
     SEROUT Tx, T2400,[LcdCls]      
     PAUSE 100
     SEROUT Tx, T2400,["MON/WED"]
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["OPEN ALL DAY!"]
     PAUSE 2000
     SEROUT Tx, T2400,[LcdCls]       
    
     SEROUT Tx, T2400,["TUES/THRS"]
     PAUSE 1000
     SEROUT Tx, T2400,[LcdCls]      
     PAUSE 100
     SEROUT Tx, T2400,["BIO 8AM-NOON"]
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["History 3PM-5PM"]
     PAUSE 3000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    
     SEROUT Tx, T2400,["WEEKENDS"]
     PAUSE 500
     SEROUT Tx, T2400,[LcdLine2]
     PAUSE 250
     SEROUT Tx, T2400,["OPEN ALL DAY"]
     PAUSE 3000
     SEROUT Tx, T2400,[LcdCls]
     PAUSE 100
    RETURN
    
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2011-03-06 18:11
    IF IN3 =0 THEN GOSUB RFID ELSE GOSUB RoomNum
    IF IN3 =0 THEN GOSUB RFID ELSE GOSUB WELCOME
    IF IN3 =0 THEN GOSUB RFID ELSE GOSUB Phone 
    IF IN3 =0 THEN GOSUB RFID ELSE GOSUB EMAIL 
    IF IN3 =0 THEN GOSUB RFID ELSE GOSUB SKYPE
    IF IN3 =0 THEN GOSUB RFID ELSE GOSUB Hours
    

    This might help you in what you want to
    ' -----[ Subroutines ]-----------------------------------------------------    
    Tag_Found:
    
    ON tagNum GOSUB Routine0,  Routine1, Routine2, Routine3
    
    
    
    ' -----[Card's Subroutines ]-----------------------------------------------------
    
    
    ' To use differnet Card for differnet amount of Time
    
    ' Card # 0 is fot Unauthorized CARD
    ' Card # 1 is fot 15 Minutes and 00 Seconds
    ' Card # 2 is fot 30 Minutes and 00 Seconds
    ' Card # 3 is fot 59 Minutes and 59 Seconds
    '
       'Unauthorized CARD Routine
                                                                                'Unauthorized CARD Led Light......
      Routine0:
       mins=$00
       secs=$00
      GOSUB Set_Time
      HIGH  Invaild_Card                                                         'Turn ON Led
      DO
      HIGH   tick
      PAUSE 500
      LOW   tick
        GOSUB Get_Time
        IF mins=$00 AND secs=$20 THEN EXIT
       DEBUG HOME, HEX2 mins, ":", HEX2 secs, CR
       DEBUG CR, CR, "Unauthorized CARD", CR
      LOOP
      DEBUG CLS, CLS                                                             ' Turn OFF Led
      LOW  Invaild_Card
      GOTO main
    
     '15 Minutes CARD Routine
      Routine1:
      mins=$00
      secs=$00
      GOSUB Set_Time
       GOSUB Get_Time
    
      DO
      HIGH   tick
      PAUSE 30
      LOW   tick
       IF mins=$00 AND secs=$05 THEN
      HIGH   relay
      HIGH   card15
      ENDIF
                                                                                    ' Turn ON  Relay
        IF mins=$15 AND secs=$00 THEN EXIT
       GOSUB Get_Time
      DEBUG HOME, HEX2 mins, ":", HEX2 secs, CR
      DEBUG CR, CR, "15 MIN CARD ", CR
      LOOP
      DEBUG CLS, CLS
      LOW  relay
      LOW  card15                                                                   ' Turn OFF  Relay
      GOTO main
    
    
     '30 Minutes CARD Routine
    
      Routine2:
      mins=$00
      secs=$00
      GOSUB Set_Time
       GOSUB Get_Time
    
      DO
      HIGH   tick
      PAUSE 30
      LOW   tick
       IF mins=$00 AND secs=$05 THEN
      HIGH   relay
      HIGH   card30
      ENDIF
                                                                                    ' Turn ON  Relay
        IF mins=$30 AND secs=$00 THEN EXIT
       GOSUB Get_Time
      DEBUG HOME, HEX2 mins, ":", HEX2 secs, CR
      DEBUG CR, CR, "30 MIN CARD "
      LOOP
      DEBUG CLS, CLS
      LOW  relay
      LOW  card30                                                                   ' Turn OFF  Relay
      GOTO main
    
    
      '60 Minutes CARD Routine
      Routine3:
      mins=$00
      secs=$00
      GOSUB Set_Time
      GOSUB Get_Time
    
      DO
      HIGH   tick
      PAUSE 30
      LOW   tick
      IF mins=$00 AND secs=$05 THEN                                                 ' Turn ON Relay
      HIGH   relay
      HIGH   card60
       ENDIF
    
        IF mins=$59 AND secs=$59 THEN EXIT
       GOSUB Get_Time                                                               ' 60 MIN CARD
      DEBUG HOME, HEX2 mins, ":", HEX2 secs, CR
      DEBUG CR, CR, "60 MIN CARD "
      LOOP
      DEBUG CLS, CLS
      LOW   relay
      LOW   card60                                                                   ' Turn OFF  Relay
      GOTO main
    


    it runs BUT here is the kicker . Unless I scan a card ( good or bad ) it will not pass over the RFID code back to the main code .

    GOTO tagdone


    tagdone:
    RETURN


    You have to tell your code where to go next
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2011-03-10 06:05
    sam I looked . yours go to the SUBs after a card is scanned ..right?


    My device goals were 2 things . it reads a RFID reader so I can disarm a alarm and display a " welcome home peter " message .


    it also displays a constant message if no RFID card is present ..

    the last function is where I had to cheat .


    I used a push tact switch to enable the GOSUB . IN3 is low then read .



    as if I just go to it and do the RFID SUB as a poor mans polling ,
    the code will hang and wait for a serial input .til the end of time .

    I think its the wait command in the RFID read section .

    I feel a Prop or some other 2 or more core MCU is needed .. OR interrupts.. both a BS2 cant do as far as i am aware




    peter
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2011-03-11 14:31
    The Basic Stamp can do what you want to Just Here something else I did
    DO
    'SEROUT CommPin, BaudValue, [CLRP]                            ' Clears any prior position info
    LOW  H25_Fan                                                  ' Turn OFF Cooling Fan
    DEBUG " Pick_One" ,CR
     
    cntr = cntr + 1 * ByPass_Switch                              ' This Routine was add because if you pushed the ByPass
    IF ( cntr = 5 ) THEN                                         ' switch again it would go HOME not just STOP
    IF Home_Switch   = 0 THEN                                     ' This is the HOME INPUT SWICH on the
    GOSUB Backwards                                               ' gate opener arm retracked postion switch
    ELSEIF IN2 = 1 THEN
    GOSUB Forwards                                                ' This  part of the routine need to be fix
    ELSE                                                          ' ELSEIF IN2 = 1 THEN
    GOSUB Start
    ENDIF
    ENDIF
     
     
    Reader1:
    LOW Enable1                                                         ' activate the reader - 1
     DEBUG "Reader1"
      #IF __No_SPRAM #THEN
        SERIN RX1, T2400, 150, Reader2, [WAIT($0A), STR buf\10]          ' wait for hdr + ID
      #ELSE
        SERIN RX1, T2400, 150, Reader2, [WAIT($0A), SPSTR 10]
      #ENDIF
      HIGH Enable1                                                       ' deactivate reader - 1
      PAUSE 200
       GOTO Check_List
     
     
    Reader2:
      LOW Enable2                                                        ' activate the reader - 2
      DEBUG "Reader2"
      #IF __No_SPRAM #THEN
        SERIN RX2, T2400, 150, Pick_One, [WAIT($0A), STR buf\10]          ' wait for hdr + ID
        #ELSE
        SERIN RX2, T2400, 150, Pick_One, [WAIT($0A), SPSTR 10]
      #ENDIF
      HIGH Enable2                                                       ' deactivate reader - 2
      PAUSE 200
     GOTO Check_List
    LOOP
     
    

    This what you have now


    SERIN RX, T2400, [WAIT($0A), STR buf\10] ' wait for hdr + ID

    Use this

    This line time out then gose to other card reader

    SERIN RX1, T2400, 150, Reader2, [WAIT($0A), STR buf\10]

    Here where you would put your own code name routine I have this Reader2
Sign In or Register to comment.