PDA

View Full Version : send and receive data using pic 16f84a



PoTeToJB
- 25th February 2006, 07:45
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

win_832001
- 25th February 2006, 15:47
Projek ko tu xyah la nak gune serin seout... buat mcm aku je. ko gune concept parallel. mcm kite baljo digit dlu tu... klu xblh tanye laban lah..!!

-AiLiF-