CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Using Timer0 interrupt

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Sensor



Joined: 04 Nov 2004
Posts: 33

View user's profile Send private message Send e-mail

Using Timer0 interrupt
PostPosted: Tue Dec 20, 2005 6:54 pm     Reply with quote

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.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 21, 2005 4:45 pm     Reply with quote

http://www.ccsinfo.com/forum/viewtopic.php?t=20760&highlight=timer0
http://www.ccsinfo.com/forum/viewtopic.php?t=24530&highlight=timer+interrupt
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group