LCD SEROUT2 help


Closed Thread
Results 1 to 12 of 12
  1. #1
    Join Date
    Nov 2008
    Location
    Fort Collins, Colorado
    Posts
    8

    Default LCD SEROUT2 help

    Hi all,
    I have a serial LCD connected to a 16F88. I can get things to display on the LCD if I write the code like:

    Code:
    SEROUT2     lcd,396,[$FE,1,"Test"]
    But I am lost on how to get a variable to display.

    Code:
    SEROUT2     lcd,396,[$FE,1,variable]
    The end result I'm looking for is getting an RFID tag number from a reader and display that tag number on the lcd. I'm using a parallax RFID reader.

    Thanks for any help,
    Josh

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Code:
    SEROUT2     lcd,396,[$FE,1,#variable]
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Nov 2008
    Location
    Fort Collins, Colorado
    Posts
    8


    Did you find this post helpful? Yes | No

    Default

    I got this code to work:

    Code:
    DEFINE OSC 8			'Internal Oscillator set to 8mhz
    OSCCON.4=1
    OSCCON.5=1
    OSCCON.6=1
    
    ANSEL=0				'Turns off A/D converter
    
    lcd	Var PORTB.5
    
    tag1	Var	BYTE
    
    Pause 500
    
    SEROUT lcd,0,[$FE,1]
    
    Pause 200
    
    SEROUT lcd,0,[$FE,1,"Test"]
    
    Pause 2000
    
    SEROUT2 lcd,396,[$FE,$C0,"2nd Line???"]
    
    tag1=123
    
    SEROUT2 lcd,396,[$FE,$94,DEC tag1]
    But now I'm trying to get a ten digit number to display, something like

    1000504B02

    and i keep getting errors.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    How are you storing this 10 digit number? In an array?
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Nov 2008
    Location
    Fort Collins, Colorado
    Posts
    8


    Did you find this post helpful? Yes | No

    Default

    I'm not really sure how to store it, I tried just putting
    Code:
    tag1=100050A4B7
    But it truncates and displays only "FF"

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    The easy way would be
    Code:
    tag1	Var	LONG
    If you are using PBP 2.50

    Otherwise I would say you need to store it an array.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Nov 2008
    Location
    Fort Collins, Colorado
    Posts
    8


    Did you find this post helpful? Yes | No

    Default

    This is what I tried:

    Code:
    buf		VAR BYTE(10)	'Tag code stored as word
    
    SERIN2 rx,396,[STR buf\10]
    
    SEROUT2 lcd,396,[$FE,$C0,STR buf\10]
    The LCD then displays a three digit display but it's symbols and not anything readable.

  8. #8
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I am feeling lazy, so I will point you here.
    http://www.picbasic.co.uk/forum/showthread.php?t=544
    Dave
    Always wear safety glasses while programming.

  9. #9
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: LCD SEROUT2 help

    Hello all,

    since i didnt find anywhere in the forum the solutions or a thread for the following question, i would like to request your advice.

    I'm currently building an RFID reader tag with PIC16F628a and LCD 2x16.

    i'm trying to display the tag number on the LCD screen.

    My problem is that i want to use SERIN2 for getting the tag number and the SEROUT2 for displaying it to the LCD.

    Since i only know how to use 2x16LCD command as follows:

    DEFINE LCD_DREG PORTB 'define port to LCD
    DEFINE LCD_DBIT 4 'RB4 RB5 RB6 RB7 to D4 D5 D6 D7 display
    DEFINE LCD_RSREG PORTA 'RS on porta
    DEFINE LCD_RSBIT 0 'RS on porta.0
    DEFINE LCD_EREG PORTA 'Enable on porta
    DEFINE LCD_EBIT 1 'Numero Enable porta.1
    DEFINE LCD_BITS 4 '
    DEFINE LCD_LINES 2 'lines 2

    So i have connected the pic16f628 according to the above configuration for the LCD 2x16.

    I have also connected the RX pin in order to read the data from the RFID output data.

    SERIN2 portb.1, 84, [WAIT($02), Str buf\10]

    The problem is that the TX from the pic16f628a is not connected anywhere.

    How do i display the tag number with serout2 command to an LCD 2x16?

    or lets start from the very basic staff.

    first of all to display something on the LCD using the serout2 command.

    I dont understand how to use the portb.2 which is the TX port for the pic16f628a to the LCD.

    thanks for any help.

    the following is my code.

    Code:
    @ device pic16f628a
    include "modedefs.bas"
    
    CMCON = 7
    define osc 8
    
    DEFINE LCD_DREG PORTB  'define port to LCD
    DEFINE LCD_DBIT 4      'RB4 RB5 RB6 RB7 to D4 D5 D6 D7 display
    DEFINE LCD_RSREG PORTA 'RS on porta
    DEFINE LCD_RSBIT 0     'RS on porta.0
    DEFINE LCD_EREG PORTA  'Enable on porta
    DEFINE LCD_EBIT 1      'Numero Enable  porta.1
    DEFINE LCD_BITS 4      ' 
    DEFINE LCD_LINES 2     'lines 2 
    PAUSE 200              ' Stop 200ms
    LCDOUT $FE,1           ' power lcd
    Lcdout $FE,1,4
    lcdout $FE, 1,"  Copyright 2011"
    lcdout $FE, $C0,"Leonardo Bilalis"
    pause 2000
    lcdout $FE,1
    ' -----[ Variables ]-------------------------------------------------------
    
    buf	    VAR	byte [10]' RFID bytes buffer
    tagNum	VAR	Byte	 ' from EEPROM table
    idx	    VAR	Byte	 ' tag byte index
    char	VAR	Byte	 ' character from table
    
    Main:
    lcdout $FE,1," Please use your"
    lcdout $FE, $C0,"    TAG"
    pause 500
    high portb.3
    pause 500
    SERIN2 portb.1, 84, [WAIT($02), Str buf\10]
    pause 500                             
    
    serout2 portb.2,84 [STR buf] 'this pin is nowhere connected :(
    pause 1000       'Pause ,1 sec 
    
    goto main

  10. #10
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default Re: LCD SEROUT2 help

    Hi,
    How do i display the tag number with serout2 command to an LCD 2x16?
    You don't..... you use LCDOUT. If you had a serial LCD (or back-pack) then you'd use SEROUT but since you have the LCD wired to your PIC in parallel 4-bit mode mode you use LCDOUT just like you're already doing in the code. And the STR modifier works with LCDOUT as well
    Code:
    LCDOUT $FE,$C0, "Tag: ", STR buf
    /Henrik.

  11. #11
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: LCD SEROUT2 help

    DEar Mr. Henrik,

    i will try and let you know in a bit.

    Regards,

    P.S.

    i DID IT!!!!!!!!!!!!!

    thanks a lot!!!!!!! thanks thanks. i didnt know that is so easy.

    Now i have a tag nubmer dipslayed in LCD 2x16.

    thank you very much for your help.
    Last edited by astanapane; - 5th June 2011 at 13:00.

  12. #12
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: LCD SEROUT2 help

    hi all again,

    this is the video from the code above.

    thanks Henrik for helping me to complete my code.


Similar Threads

  1. Serout and 18F87J50
    By Glenn_Webber in forum Serial
    Replies: 8
    Last Post: - 20th November 2009, 14:26
  2. SLOW Serin2 and Serout2
    By dragons_fire in forum General
    Replies: 3
    Last Post: - 26th June 2009, 02:38
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  4. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  5. Gps with 16f628
    By dragons_fire in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 8th June 2006, 03:38

Members who have read this thread : 0

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