What is a typical application for a FSK chip?
I have updated my circuit to monitor the CD pin on the Receiver
If high, I turn on an LED, but the LED switch on about every 10 seconds while the transmitter is still switched off?
Oops!!
I must have missed it and just assumed it must be high, sorry!
Will this code do the job to just test the CD pin functioning?
<code>
........
IF CDPin = 0 THEN
HIGH LEDPin
Pause 1000
LOW LEDPin
PAUSE 1000
ENDIF
.......
</code>
Pin 3 (CD) probably doesn't have enough swing to be sensed directly by a PIC pin. That's why the transistor is needed. In effect, it amplifies and inverts CD.
I'm not sure what you want the LED to indicate. I would just capture and decode the RXD pin whenever /CD is low. What you get on RXD should match what you send with the transmitter.
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.
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>
If you are connecting the receiver CD pin (pin 3) directly to PORTD.2, CD may not go high enough to be seen as HIGH by PORTD.2. That's why the transistor is needed and why you need to monitor /CD (refer to p6 of the PDF specs for the receiver).
Look at the code I referenced earlier in Code Examples for how to encode/transmit and receive/decode a pulse train. It's all you need for this application. It sends two bytes. Both bytes are followed by their complement so some basic error detection is built in. One can be an ID and the other indicate motion or all clear. All clear is sent when motion is followed by a period with no motion plus every hour or so to indicate "all's well".
FSK is needed when higher data rates are desired. The pair you're using can go as high as 160kbps while ASK modules are usually limited to 4-8kbps. In simple terms, ASK is like AM radio which is subject to interference while FSK is like FM which has better noise rejection.
Bookmarks