How to use serial LCD in PICBASIC PRO?


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2008
    Location
    New York US
    Posts
    46

    Default How to use serial LCD in PICBASIC PRO?

    Hi All,
    I am trying to use SERIAL LCD BPI-216
    from Scott Edwards Electronics, Inc in my project
    to monitor setting parameters.
    Code:
    'Processor p16F84A
    DEFINE OSC 20  
    INCLUDE "modedefs.bas"
    TRISA = $0F ' Set PORTA to all input
    TRISB = %00000000 ' Set all of PORTB to outputs
    PORTB = $00 
    I CON 254
    CLR CON 1
    LINE2 CON 192
    L1_C7 CON 135 
    FR1 CON 255
    FR2 CON 128
    FR3 CON 64
    FR4 CON 32
    FR5 CON 16
    FR6 CON 8
    FR7 CON 4
    FR8 CON 2
    FR9 CON 1
    SER var PORTA.3
    'N2400 con 4
    MYVAR VAR BIT
    UP VAR BIT
    DOWN VAR BIT
    NV VAR BYTE
    CNT VAR BYTE
    CNT = 0
    MAIN:
    PAUSE 1000
    PORTB = $00
    MYVAR =PORTA.0
    IF MYVAR = 1 THEN RUN 
    UP = PORTA.1
    IF UP = 1 THEN INCNV
    DOWN = PORTA.2 
    IF DOWN = 1 THEN DECNV 
    LOOKUP CNT,[FR1,FR2,FR3,FR4,FR5,FR6,FR7,FR8,FR9],NV '
    serout SER,N2400,[I,CLR] 'clear and move to home position
    serout SER,N2400,[I,L1_C7,"mSEC"]' Print on the first line
    serout SER,N2400,[I,LINE2] 'Redirect to second line
    Serout SER,N2400,[#NV,"  "] 'Print Value of NV
    GOTO MAIN
    RUN:
    MYVAR =PORTA.0
    IF MYVAR = 0 THEN MAIN
     'Get CNT from string to var NV 
    PORTB = %10011001
    PAUSE  NV
    PORTB = %10101010
    PAUSE  NV
    PORTB = %01100110
    PAUSE NV
    PORTB = %01010101
    PAUSE NV 
    GOTO RUN
    INCNV:
    PAUSE 500
    CNT = CNT + 1
    IF CNT = 9 THEN CNT = 8
    RETURN
    DECNV:
    PAUSE 500
    CNT = CNT - 1
    IF CNT = -1 THEN CNT = 0
    RETURN
    END
    Program is working fine, only serial LCD is behaved.
    Where I can find info how to use serial LCD in PICBASIC Pro
    enviroment?
    Thanks in advance.
    Best Regards

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Provided that you have setted the baud rate to 2400 than the error you have made is the use of inverted instead of true state. (very likely you have thought that N was standing for no parity)
    Just change your code as for the below example and your lcd will work fine.


    Code:
    serout SER,T2400,[I,CLR] 'clear and move to home position
    serout SER,T2400,[I,L1_C7,"mSEC"]' Print on the first line
    serout SER,T2400,[I,LINE2] 'Redirect to second line
    Serout SER,T2400,[#NV,"  "] 'Print Value of NV
    Al.
    All progress began with an idea

  3. #3
    Join Date
    Dec 2008
    Location
    New York US
    Posts
    46


    Did you find this post helpful? Yes | No

    Default

    Dear Al,
    With your push it is working.Later try to test outside on boardwalk.
    Was sunny day, could not see nothing on LCD.
    Is it possible to install LCD or different staff in sunglasses to monitor data?
    What can I find on market to solve this problem?
    The same story with digital camera.During sunny days it is impossible
    to make nice composition, a picture on LCD is not visible.So LCD glasses is cheap solution for many applications.
    Appreciate any ideas.
    Best Regards

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