nicolelawsc
- 10th April 2006, 20:10
hi all,
i am dealing with a rf transmitter and receiver project. there are 3 transmitter and 1 receiver used in this project. transmitter used pic16f84a and the receiver used 16f877a.
below is the code
transmitter:
include "modedefs.bas"
define osc 4
input porta.0
output portb.0
output portb.1
output portb.2
output portb.3
led_on:
high portB.1
if porta.0=1 then transmit
transmit:
low portb.1
high PORTB.2
serout PORTB.0,N9600,["A",1]--(tansmitter1),
--serout PORTB.0,N9600,["A",2]--(transmitter2)
--serout PORTB.0,N9600,["A",3]--(transmitter3)
low PORTB.2
low portb.1
goto led_on
end
receiver:
serin PORTB.2,N9600,["A"],rx
SELECT CASE rx
CASE 1
goto station1
CASE 2
goto station2
CASE 3
goto station3
END SELECT
station1:
lcdout $FE,1, "station one"
portb.6=0
portb.3=1
pause 2000
portb.3=0
goto loop
station2:
lcdout $FE,1, "station two "
portb.6=0
portb.5=1
pause 2000
portb.5=0
station3:
lcdout $FE,1, "station three "
portb.3=1
portb.5=1
pause 1000
portb.3=0
portb.5=0
goto loop
end
my problem now is at the receiver i use lcd to test the result and i found out the serin command at the receiver and the select case below it also did not perform at all.It just direct go through content in station 1 only. station 2 and 3 totally did not perform.
another problem is i want to define the value of X1, X2,X3, Y1,Y2,and Y3.
but the value of X1,Y1,and X2 are negative value so how can i deal with it?all in word.
X1 = ? (X1=-2)
Y1 = ? (Y1=-2)
X2 = ? '(X2=-2)
Y2 = 6000 '(Y2=6)
X3 = 6000 '(X3=6)
Y3 = 6000 '(Y3=6)
hope to hear u soon.thank you for ur consideration. :)
i am dealing with a rf transmitter and receiver project. there are 3 transmitter and 1 receiver used in this project. transmitter used pic16f84a and the receiver used 16f877a.
below is the code
transmitter:
include "modedefs.bas"
define osc 4
input porta.0
output portb.0
output portb.1
output portb.2
output portb.3
led_on:
high portB.1
if porta.0=1 then transmit
transmit:
low portb.1
high PORTB.2
serout PORTB.0,N9600,["A",1]--(tansmitter1),
--serout PORTB.0,N9600,["A",2]--(transmitter2)
--serout PORTB.0,N9600,["A",3]--(transmitter3)
low PORTB.2
low portb.1
goto led_on
end
receiver:
serin PORTB.2,N9600,["A"],rx
SELECT CASE rx
CASE 1
goto station1
CASE 2
goto station2
CASE 3
goto station3
END SELECT
station1:
lcdout $FE,1, "station one"
portb.6=0
portb.3=1
pause 2000
portb.3=0
goto loop
station2:
lcdout $FE,1, "station two "
portb.6=0
portb.5=1
pause 2000
portb.5=0
station3:
lcdout $FE,1, "station three "
portb.3=1
portb.5=1
pause 1000
portb.3=0
portb.5=0
goto loop
end
my problem now is at the receiver i use lcd to test the result and i found out the serin command at the receiver and the select case below it also did not perform at all.It just direct go through content in station 1 only. station 2 and 3 totally did not perform.
another problem is i want to define the value of X1, X2,X3, Y1,Y2,and Y3.
but the value of X1,Y1,and X2 are negative value so how can i deal with it?all in word.
X1 = ? (X1=-2)
Y1 = ? (Y1=-2)
X2 = ? '(X2=-2)
Y2 = 6000 '(Y2=6)
X3 = 6000 '(X3=6)
Y3 = 6000 '(Y3=6)
hope to hear u soon.thank you for ur consideration. :)