You're not saying if this last piece of code is beeing tested using RF modules or not. If yes, go back to using a resistor(1k ish) and a wire(don't forget to connect the grounds together). Don't use very long wires and too big resistor(ohms not physical size ;-) ). Then try this code ......
Tx:
cmcon0 = 7
ansel = 0
TRISA = 0
TRISC=15
i VAR BYTE
PORTA.0 = 1 'True mode idles high
Pause 150 'Make sure reciever is in sync
loop:
For i = 0 TO 15
SerOut PORTA.0,0,[i]
Pause 1000 'Delay for Receive scope
Next i
GoTo Loop
Rx:
cmcon0 = 7
ansel = 0
TRISC = 0
TRISA = %00000001
PortA.1 = 1 'True mode idles high
'RF test program
DataRec VAR BYTE
Loop:
SerIn PORTA.0,0,100,Loop,DataRec
SerOut PORTA.1,0,[DataRec]
PORTC = DataRec
GoTo Loop
...... i've made small changes to make sure that the reciever is ready to recieve when the transmitter is sending.
If you can't make this work you probably should connect to a PC using inverted mode or a rs232 driver.
Ohh, almost forgot that you have a scope. Verify that you have correct timings, each bit should be 1/2400=416.6us long. Each transmission starts with a startbit(low), this pulse should be about 417us long. Some of the time this pulse will be followed by one or more low pulses, the time will ofcource be longer when this happens. It will always be a multiple of 417us(0.417ms, 0.833ms, 1.25ms and so on) but never more than (1+8)*0.416667=3.75ms. If the bit-timing is more than about 2% off you need to check your oscillators.
/Ingvar
Bookmarks