Your serin pin would be connected to the demodulated output pin of your receiver, so a resistor on the serin pin would not accomplish anything. The thing is, with your transmitter not keyed, the receiver will still pick up spurious RF which will be ported out of the demodulated output pin. Then, your serin will ultimately interpret this noisy data as a valid command unless you put qualifiers in your data stream. I was getting invalid commands from noise until I added the second qualifier. That's why in my code I have "A" and "Z" as the qualifiers and the number is the command code. As for your serin TIMEOUT question, yes, if the pin does not change state it times out and goes to NONE. My receiver is not battery operated so I do not have anything in place to put it to sleep and wake it up such as a serial interupt. There is likely better ways to qualify the data and I would appreciate it if some people would post some further information. Here is a part of my RX code for you to see. Again, I am not an expert but this works perfectly for my application;
'Winamp Receiver Controller. Feeds button switches to KeyWiz keyboard controller via RF
'link from remote control
'Revised January 15, 2006
'Transmitter Program is winamptx.txt
'-----------------------------------------------------------------------------------------
Include "modedefs,bas"
@ DEVICE pic16F876, HS_OSC
' System Clock Options
@ DEVICE pic16F876, WDT_ON
' Watchdog Timer
@ DEVICE pic16F876, PWRT_ON
' Power-On Timer
@ DEVICE pic16F876, BOD_ON
' Brown-Out Detect
ADCON1 = 7 'turn off analogues
'PIN DESIGNATIONS
Datain var porta.0 'Data in from RF Module
Testled var porta.1 'I'm Alive!
'Spare var porta.2 '
'Spare var porta.3 '
'Spare var porta.4 '
'Spare var porta.5 '
Homebut var portb.0 'Home button to move curser to first track
Zbut var portb.1 'Z
Enterbut var portb.2 'Enter
Upbut var portb.3 'Up Arrow
Sbut var portb.4 'S
Rbut var portb.5 'R (Need CTRL + R for Reverse) and (CTRL + SHIFT + R for Randomize)
Endbut var portb.6 'End Button to move curser to end button
Onebut var portb.7 '(Need CTRL + SHIFT + 1)for Sort by Title
CTRLbut var portc.0 'CTRL
SHIFTbut var portc.1 'S
Downbut var portc.2 'Down Arrow
Altbut var portc.3 'Alt
'Spare var portc.4 'Spare
Qbut var portc.5 'Q
Cbut var portc.6 'C
Bbut var portc.7 'B
'------------------------------------------------------------------
'------------------------------------------------------------------------------------------
B0 var byte
B0 = 0
B3 var bit
B3 = 0
'------------------------------------------------------------------------------------------
'SET VARIABLES
TrisA = %11101
Trisb = %11111111
Trisc = %11111111
High PortA.2:High PortA.3:High PortA.4:High PortA.5
High PortB
High PortC
'I'm Alive!
High Testled
pause 100
Low Testled
pause 100
High Testled
pause 100
Low Testled
pause 100
High Testled
pause 100
Low Testled
pause 100
Scan: Serin Datain, N1200,["A","Z"],B0 'wait for 2 synchronizing qualifiers before loading into B0
If B0 = 5 Then Scrollup
If B0 = 13 Then Scrolldown
If B0 = 11 Then Volup
If B0 = 12 Then Voldown
If B0 = 1 Then Sortlst
If B0 = 2 Then Randomize
If B0 = 3 Then HomeEnd
If B0 = 4 Then Shuffle
If B0 = 6 Then Enterplay
If B0 = 7 Then PrevTrack
If B0 = 8 Then NextTrack
If B0 = 9 Then Pauseplay
If B0 = 10 Then Queue
goto Scan
Sortlst: Low CTRLbut:Low SHIFTbut
Pause 30
Low Onebut
Pause 50
high CTRLbut:High SHIFTBut:High Onebut
pause 200
goto Scan
Randomize: Low CTRLbut:Low SHIFTbut
Pause 30
Low Rbut
Pause 50
high CTRLbut:High SHIFTBut:High Rbut
pause 200
goto Scan
Bookmarks