serial data to LCD


Closed Thread
Results 1 to 9 of 9
  1. #1

    Default serial data to LCD

    I am trying out an experiment where one pic16f84 sends out serial data, whilst another receives the data on an LCD. I can only get the LCD to display a 0 for the received data with my code. Any suggestions?

    transmitter

    INCLUDE "modedefs.bas"
    pause 1500

    START
    SEROUT PORTB.4,N2400,["1234"]
    PAUSE 50
    GOTO START

    receiver

    INCLUDE "modedefs.bas"
    pause 500
    START
    M VAR BYTE
    SERIN PORTB.5,N2400,[M]
    lcdout $FE,1,#M
    LCDOUT $FE,$C0,"HELLO"
    PAUSE 300
    GOTO START

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


    Did you find this post helpful? Yes | No

    Default

    Me thinks this will be of interest to you.
    http://www.picbasic.co.uk/forum/show...erial+backpack
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    And changing
    Code:
    START
    SEROUT PORTB.4,N2400,["1234"]
    to
    Code:
    START
    N = 1234
    SEROUT PORTB.4,N2400,[DEC N]
    might help
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Much simple... your SERIN line is wrong

    SERIN PorPin, Mode, Variable

    Using the square bracket says you want to wait a specific character..

    Code:
    INCLUDE "modedefs.bas"
    M VAR BYTE
    pause 500
    START
            SERIN PORTB.5,N2400,#M
            lcdout $FE,1,#M
            GOTO START
    if you send 1234... it will never fit in a BYTE variable.. max=255...

    Leave your transmitter code as is, but change 1234, to 123 for now to see what happen.


    PS: DEC modifier should not work for SEROUT, but for SEROUT2 .
    Last edited by mister_e; - 18th November 2008 at 20:53.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Thanks to everyone for the quick replies. I havent had chance to try the corrected code as yet, Ill post back when I get chance.

    Regards, John

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Ok I now have a working prototype, thanks to all that contributed.
    Transmitter:

    INCLUDE "modedefs.bas"
    N VAR BYTE
    FOR N=0 TO 255
    serout PORTB.0,N300,[N]
    TOGGLE PORTB.1
    PAUSE 100
    NEXT N

    Receiver:

    INCLUDE "modedefs.bas"
    N VAR BYTE
    PAUSE 1000
    START
    LCDOUT $FE,$C0,"SERIAL RECEIVER"
    SERIN PORTB.4,N300,N
    LCDOUT $FE,1,#N
    PAUSE 50
    GOTO START

  8. #8


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by cunninghamjohn View Post
    Ok I now have a working prototype, thanks to all that contributed.
    Transmitter:

    INCLUDE "modedefs.bas"
    N VAR BYTE
    FOR N=0 TO 255
    serout PORTB.0,N300,[N]
    TOGGLE PORTB.1
    PAUSE 100
    NEXT N

    Receiver:

    INCLUDE "modedefs.bas"
    N VAR BYTE
    PAUSE 1000
    START
    LCDOUT $FE,$C0,"SERIAL RECEIVER"
    SERIN PORTB.4,N300,N
    LCDOUT $FE,1,#N
    PAUSE 50
    GOTO START
    Hello,

    You can put the schema to understand it better.

    Thank you

  9. #9


    Did you find this post helpful? Yes | No

    Default

    The receiver is simply the LCD display example in the picbasic pro manual, with a 4MHz crystal and uses 4 data lines to the LCD. The serial input is on pin 10. The transmitter is a 16F84 with 4MHz xtal, pull up resistor on MCLR and the serial output on pin 10. Power for both modules is a battery pack and 7805 regulator.
    I am thinking of replacig the wire linking the tx to the rx with one of those 433MHz tx/rx modules so I can use the display remotely.

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Nokia 3310 display text
    By chai98a in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 26th August 2007, 03:39
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  4. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

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