
Originally Posted by
tazntex
Thanks SKIMASK, I believe you were referring to the RETURN in this section:
Yes
Ive recompiled it, still doesn't work, I check the serial out pin with Oscope and it shows a datastream, Out of curiosity, I have a whole sleeve of the processors so I replaced both but still no luck
And you HAVE tried this without the RF link? Yes? Without the manchester encoding?
Code:
'Serial Transmitter
@ DEVICE PIC16F628a,XT_OSC
@ DEVICE pic16F628a, WDT_OFF ' Watchdog Timer
@ DEVICE pic16F628a, PWRT_ON ' Power-On Timer
@ DEVICE pic16F628a, MCLR_ON ' Master Clear Options (Internal)
@ DEVICE pic16F628a, BOD_ON ' Brown-Out Detect
@ DEVICE pic16F628a, LVP_OFF ' Low-Voltage Programming
@ DEVICE pic16F628a, CPD_OFF ' Data Memory Code Protect
@ DEVICE pic16F628a, PROTECT_OFF
define osc 4 <-Define's won't work unless they're in CAPS (RTFM)
include "bs2defs.bas"
CMCON=7 : i var byte : encoded var word : dgood var porta.2 : serpin var porta.3
nokey con $ff : synch con 254 : keyin var portb : mydata var byte : trisb = $ff : trisa = $17
ro VAR PORTB.0 : ri VAR PORTB.1 : bkl VAR PORTB.2 : es VAR PORTB.3 : rb VAR PORTB.4
lb VAR PORTB.5 : bl VAR PORTB.6 : na VAR PORTB.7
findkey: if rn = 0 then mydata=5 : goto dout
if lb = 0 then mydata=6 : goto dout
if ri = 0 then mydata=2 : goto dout
if ro = 0 then mydata=1 : goto dout
if es = 0 then mydata=4 : goto dout
if bl = 0 then mydata=7 : goto dout
if bkl = 0 then mydata=3 : goto dout
goto findkey
dout: dgood=0 : pause 100 : For i=0 TO 7
IF mydata.0[i] = 0 Then
encoded.0[i*2]=0 : encoded.0[i*2+1]=1
Else
encoded.0[i*2]=1 : encoded.0[i*2+1]=0
EndIF
Next i : serout serpin,N2400,[$55,$55,$55,$55,$55,synch,encoded]
if keyin = nokey then x2
goto findkey
x2: dgood=1 : mydata=0 : serout serpin,N2400,[$55,$55,$55,$55,$55,synch,mydata]
goto findkey
end
'Serial Receiver
INCLUDE "bs2defs.bas"
@ DEVICE PIC16F628a,XT_OSC
@ DEVICE pic16F628a, WDT_OFF ' Watchdog Timer
@ DEVICE pic16F628a, PWRT_ON ' Power-On Timer
@ DEVICE pic16F628a, MCLR_ON ' Master Clear Options (Internal)
@ DEVICE pic16F628a, BOD_ON ' Brown-Out Detect
@ DEVICE pic16F628a, LVP_OFF ' Low-Voltage Programming
@ DEVICE pic16F628a, CPD_OFF ' Data Memory Code Protect
@ DEVICE pic16F628a, PROTECT_OFF
DEFINE OSC 4
mydata var byte : encoded var word : serpin var porta.1 : porta=0 : portb=0 : trisa=2
trisb=$80 : CMCON=7 : i var byte : PAUSE 50
loop: gosub loop1
select case mydata
case 0
toggle 0 : pause 250
case 1
HIGH 1 : pause 50 : if mydata <> %0101 then low 1
case 2
HIGH 2 : pause 50 : if mydata <> %0110 then low 2
case 3
HIGH 3 : pause 50 : if mydata <> %0010 then low 3
case 4
HIGH 4 : pause 50 : if mydata <> %0001 then low 4
case 5
toggle 5 : pause 250
case 6
toggle 6 : pause 250
end select
goto loop
loop1: SERIN serpin,N2400,[254],encoded : For i=0 TO 7
IF encoded.0[i*2]=0 Then
IF encoded.0[i*2+1]=1 Then mydata.0[i]=0
Else
mydata.0[i]=1
EndIF
Next i : Return
End
Bookmarks