Using LOOKUP


Closed Thread
Results 1 to 2 of 2

Thread: Using LOOKUP

  1. #1
    Join Date
    Jul 2010
    Posts
    12

    Default Using LOOKUP

    My project is to read in a string of 19 characters from a GPS's serial port using HSERIN. Then using
    LOOKUP to parse the 10th and 11th characters in the TIME string and act upon the results.

    I have the HSERIN working at 9600baud and can display the received string on the LCD. But, I
    can't seem to get the LOOKUP syntax correct. Even the examples in the MicroCode Studio and PBP
    manual do not compile correctly and it is very frustrating.

    Here is my program:

    DEFINE HSER_TXSTA 24H
    DEFINE HSER_RCSTA 90H
    DEFINE HSER_BAUD 9600
    DEFINE HSER_SPBRG 25

    TIME VAR BYTE(19)

    PAUSE 2000 'FOR LCD

    LCDOUT $FE,$1 'CLEAR LCD
    PAUSE 200

    LCDOUT "TEST HSERIN" 'DISPLAY "TEST HSERIN" ON LCD LINE 1
    PAUSE 1000

    GOSUB CURHOME2 'MOVE LCD CURSOR TO LINE 2

    MOREHSER:

    HSERIN [WAIT("C708")] ' WAIT FOR "C708"
    HSERIN [STR TIME\19]

    LOOKUP 10,[TIME],B1 ' FIND 10TH CHARACTER IN THE 'TIME' STRING
    LCDOUT B1 ' DISPLAY 10TH CHARACTER ON LCD


    LCDOUT STR TIME\19
    GOSUB CURHOME2 'LINE 2
    GOTO MOREHSER

    CURHOME2:
    LCDOUT $FE, $C0
    RETURN

  2. #2
    Join Date
    Jul 2010
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by N6VMO_ View Post
    My project is to read in a string of 19 characters from a GPS's serial port using HSERIN. Then using
    LOOKUP to parse the 10th and 11th characters in the TIME string and act upon the results.

    I have the HSERIN working at 9600baud and can display the received string on the LCD. But, I
    can't seem to get the LOOKUP syntax correct. Even the examples in the MicroCode Studio and PBP
    manual do not compile correctly and it is very frustrating.

    Here is my program:

    DEFINE HSER_TXSTA 24H
    DEFINE HSER_RCSTA 90H
    DEFINE HSER_BAUD 9600
    DEFINE HSER_SPBRG 25

    TIME VAR BYTE(19)

    PAUSE 2000 'FOR LCD

    LCDOUT $FE,$1 'CLEAR LCD
    PAUSE 200

    LCDOUT "TEST HSERIN" 'DISPLAY "TEST HSERIN" ON LCD LINE 1
    PAUSE 1000

    GOSUB CURHOME2 'MOVE LCD CURSOR TO LINE 2

    MOREHSER:

    HSERIN [WAIT("C708")] ' WAIT FOR "C708"
    HSERIN [STR TIME\19]

    LOOKUP 10,[TIME],B1 ' FIND 10TH CHARACTER IN THE 'TIME' STRING
    LCDOUT B1 ' DISPLAY 10TH CHARACTER ON LCD


    LCDOUT STR TIME\19
    GOSUB CURHOME2 'LINE 2
    GOTO MOREHSER

    CURHOME2:
    LCDOUT $FE, $C0
    RETURN
    I just answered my own question by...READING THE BOOK!

    LOOKUP can't be used to parse arrays with a variable. ARRAYREAD works better.

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts