send and receive data using pic 16f84a


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2006
    Location
    johor,Malaysia
    Posts
    57

    Default send and receive data using pic 16f84a

    Need Help

    I write the serout and serin command to send data from PIC to another PIC

    can anyone tell me, how to solve it, thank you

    i am try many way to solve it , but still cant solve it

    i am using PIC16F84A model try a simple code below

    TX DATA


    INCLUDE "modedefs.bas"
    DEFINE OSC 4

    loop:
    IF PORTB.0=0 Then
    GoSub led_on
    Else
    GoSub led_off
    EndIF
    GoTo loop


    led_on:
    SerOut PORTB.1,N2400,[$FF,$FF,"OK","A"]
    Return

    led_off:
    SerOut PORTB.1,N2400,[$FF,$FF,"OK","B"]
    Return

    End



    RX DATA

    INCLUDE "modedefs.bas"
    DEFINE OSC 4
    dataon VAR BYTE
    led1 VAR PORTB.1
    led2 VAR PORTB.2

    Loop:

    SerIn PORTB.0,N2400,["OK"],dataon
    IF dataon="A" Then led_on
    IF dataon="B" Then led_off
    GoTo Loop

    led_on:
    High led1
    Low led2
    GoTo Loop

    led_off:
    Low led1
    High led2
    GoTo Loop

    End

    after i on the supply and push the switch the led does not light

    to see the led light on/off how could be???

    really need a help

    thank you

  2. #2
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Unhappy

    Huuuhh...

    you fire a lot of charaters by the TX-PIC, and the RX-PIC has to do his work by software.

    Just give him some time to does his work.
    Read the PBP-manual around the SEROUT-command and look at the DEFINE CHAR_PACING !!!

    Change the filling bytes from $FF to $00, maybe the RX-PIC will find the start of a new character even better.
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  3. #3
    Join Date
    Feb 2006
    Location
    johor,Malaysia
    Posts
    57


    Did you find this post helpful? Yes | No

    Default

    thankQ BigWumpus .

    now i try to send variable data to the another PIC and display the data in LCD HD44780.

    can u help me

  4. #4
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Default

    Ahhmmm...

    You read the PBP-manual ?
    You have found SEROUT, what's about SEROUT2 ?
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  5. #5
    Join Date
    Feb 2006
    Location
    johor,Malaysia
    Posts
    57


    Did you find this post helpful? Yes | No

    Default

    i have read pic basic manual in melabs but still cant understand it..

    can u give me another source...

    I am an amateur is PIC and pic basic pro program..

    this is myprogramming code can u help me in solving my problem..

    DEFINE CHAR_PACING
    INCLUDE "modedefs.bas"
    DEFINE OSC 4
    cnt var byte

    TrisB=%00000011
    cnt=0
    loop:
    IF PORTB.0=1 Then
    cnt=cnt+1
    endif
    if PORTB.1=1
    GoSub senddata
    EndIF
    GoTo loop


    senddata:
    SerOut PORTB.1,N2400,["OK",#cnt]
    return

    End



    RX DATA

    symbol second = 1000
    INCLUDE "modedefs.bas"
    DEFINE OSC 4
    dataon VAR BYTE

    TrisB=%000000001
    Pause second
    lcd $FE,1,"READY"
    Loop:

    SerIn PORTB.0,N2400,["OK"],dataon
    LcdOut $FE,#C0
    LcdOut "Count= ",#dataon
    GoTo Loop

    End

    my problem is the display doesnt show the correct data that is send from PIC

    i use LCD HD44780

  6. #6
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Wink

    I think you want to transfer byte-values.

    Use

    SerOut PORTB.1,N2400,["OK",cnt]

    and

    LcdOut $FE,$C0
    LcdOut "Count= ",dec dataon
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

Similar Threads

  1. Send data PIC to PC
    By konter in forum Off Topic
    Replies: 6
    Last Post: - 25th December 2009, 22:04
  2. Send data to PC USB
    By konter in forum Off Topic
    Replies: 2
    Last Post: - 18th December 2009, 21:57
  3. send data from VB 6 to PIC 16f84
    By win_832001 in forum Serial
    Replies: 2
    Last Post: - 9th March 2006, 14:21
  4. how to send data from VB to PIC 16f84
    By win_832001 in forum Serial
    Replies: 0
    Last Post: - 25th February 2006, 16:15
  5. send and receive data using pic 16f84a
    By PoTeToJB in forum Serial
    Replies: 1
    Last Post: - 25th February 2006, 14:47

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