Sensor
Joined: 04 Nov 2004 Posts: 33
|
Using Timer0 interrupt |
Posted: Tue Dec 20, 2005 6:54 pm |
|
|
I am using a PIC16F627A. I am using compiler PCWH version 3.241.
What I am trying to do is decode the DiSeQC Code sent from a DishNetwork Satellite Receiver. The DiSeQC code is sent in bursts of a 22kHz tone. So for a '0', there is a 22khz tone present for 1mS and no tone for .5mS. For a '1', there is a 22kHz tone present for .5mS and no tone for 1mS.
So my plan is to use Timer1 as a counter and count the number of pulses from the 22kHz in a 1.5mS time frame. For a '0', I should see 22 pulses, and for a '1', I should see 11 pulses.
My problem is I don't know how to count the pulses on Timer1 for only 1.5mS. I assume I need to use the Timer0 interrupt and have the interrupt occur every 1.5mS. How do I set this up? Also, I don't necessarily want the interrupt to happen every 1.5mS... I only want the interrupt to occur 1.5mS after the rising edge of the first pulse on Timer1 is seen. How do I do this?
If I can figure out the Timer0, then after every 1.5mS, I will store that bit, clear the Timer1 counter, and reset the interrupt. I will do this until I get 4 bytes of data. Then the PIC will just sit and wait for the next code burst.
Can someone please help with programming the Timer0 interrupt. In summary, I need to set up the Timer0 interrupt so it generates an interrupt 1.5mS after the first pulse is seen on the Timer1 counter. Then in the interrupt subroutine, I need to store whether the data was a '1' or a '0', reset the interrupt and reset the counter. |
|