Dave
Thank you for all your help
I'm not sure I know how to do this?
Must I use something like the Pulsin command, I have not done this before?
<hr>The PDF file says the CD signal has a fast response but doesn't say how fast. Instead of trying to use serin/serout I would first just look at the pulsetrain to determine if CD is fast enough that you won't miss bits.
I am using the LED just to test if it goes low if I send data with the transmitter, just to make sure my circuit is wired correctly and that it only works if my receiver is sending data.
I have added 2 LEDs for debugging purposes.
A green one on PortB.4 and a Red one on PortB.5
If CD is low, the green LED will blink, if CD is high, the Red LED will blink.
While the transmitter is still powered down, I switch on the receiver, and the Green LED just constantly blink on and off, which tells me that the CD is Low from the beginning?
When I then swith the Transmitter on and send data, the Green LED still blink at the same frequency?
I'm not sure if I am missing something, but I am still in the amateur student phase.
Here is my code.
<code>
'************************************************* ***************
'* Name : Receiver.bas &n bsp; &nbs p; *
'************************************************* ***************
Include "modedefs.bas"
DEFINE OSC 4 ' Set the Xtal frequency
SerialInPin VAR PORTC.2 ' Serial Out
LEDPin Var PORTC.3
REDLed VAR PORTB.5
GreenLED VAR PORTB.4
CDPin VAR PORTD.2
DATAReceived VAR Byte
I VAR BYTE
ADCON1 = 7
Main:
HIGH LEDPin
Pause 5000
Low LEDPin
Loop:
IF CDPin = 0 THEN
HIGH GreenLED
Pause 100
LOW GreenLED
PAUSE 100
else
HIGH REDLed
Pause 100
LOW REDLed
PAUSE 100
ENDIF
Goto LOOP
END
</code>
Bookmarks