PIC18F46K20 Starter Kit help !!!

Discussion in 'Embedded Systems and Microcontrollers' started by kevin.ho, Apr 16, 2009.

  1. kevin.ho

    Thread Starter New Member

    Apr 16, 2009
    2
    0
    hi guys..

    i has been assigned a task on FSK transmission and receiving using PIC18F46K20. i had been successfully modulate the binary signal. But, i have no idea have to demodulate the signal using PIC18F46K20 Starter Kit. anyone can help me ??

    [​IMG]

    thx a lot

    regards,

    kevin
     
  2. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    What is the data rate, and your code so far for encoding/transmitting?

    Interrupt on pin + timer should get you going.
     
  3. kevin.ho

    Thread Starter New Member

    Apr 16, 2009
    2
    0
    thx thatoneguy..
    erm.. i used two frequency for the transmitting, 20Hz for "1" and 40Hz for "0" .. total 80 bits transmitted .. the transmitting is wired, not wireless.
    Analog Output from R2R ladder ( for the transmitting part , which connected to Port B1 - B7 of PIC18F46K20 Starter Kit) connected to the analog input at another PIC18F46K20 Starter Kit.

    regarding to the coding ..
    i am using C programming. I generate sine wave using look up table and output to Port B. Two different delay was used in order to generated two different frequency sine wave in order to represent "1" and "0".

    can u explain to me in detail how to use interrupt and timer to demodulate the signal ?
     
  4. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Which compiler are you using? It might be easier to find an Interrupt example for that part. There should be some examples that came with your compiler, and with the Starter Kit with "interrupt" in the title. Interrupts are much easier than in assembly code, simply remember to keep the interrupt routine as short as possible. I typically only set variables and other quick tasks, then actually process them in the main loop.

    For demodulation, set a receive pin or analog CCP to generate an interrupt on change, then calculate the time between two changes, you will end up with 25 or 50mS between pulses. Since two processor clocks are involved, the bit rate will need to be set, or somehow recovered, by sending a 1010 code with the first transmission, or some other method to synchronize the bit clock for long runs of zeros, unless exactly x cycles are sent for each bit.

    Download the "PicKit 3 Debug Express Examples" for the 44 pin Demo Board, example 08-Interrupts has High and Low priority interrupts in an LED blinking program, which is a bit of overkill, but extremely well commented, as are all the examples.
     
Loading...