sanddune008
New Member
Hi All,
Problem statement:
I am struck writing code to encode bit 0 and 1. Using PWM and Timer0
It is as follows:
encoding of bit 1
I have to retain pulses(38Khz) exact for duration = 13*(1/38Khz)
and keep no pulses for duration = 82*(1/38khz)
similarly the encoding for bit 0
I have to retain pulses(38Khz) exact for duration = 13*(1/38Khz)
and keep no pulses for duration = 120*(1/38khz)
similarly there is a different encoding for lead out burst and lead in burst.
My Approach:
1. set up the PWM with duty cycle...etc for generating 38Khz pulses..
2. Parallel run the Timer0 with time duration equivalent of 13*(1/38Khz)
3. Inside the Timer0 ISR, I will make the corresponding associated CCP1 OFF and simultaneously set the Timer0 with new time duration of 82*(1/38khz) for which the CCP1 pin has to be low
Here i am struck how to proceed with timing a very important parameter.
can any one give a better approach to improve the timings?I am sending the command at 38 Khz carrier frequency
This is where I am facing problem ,
1. The IR code scheme or protocol whatever contains multiple encode formats, OFF duration (No PWM pulses) varies based on the command (ex mycase: 0xAE). Bit 1, bit 0, extra burst pairs lead out , lead in,frame endseq all of them have same ON duration but differ in their OFF duration. In my case I have to sent all of them bit0, bit1, Lead out burst ,Lead in burst seq and frame end seq in a sequence for controlling a device.
2. Now, I have check for whether it is bit 0 or bit 1 or lead out or lead in or seqence end in the Timer0 ISR and based on this Timer0 has to be loaded. With the OFF duration. won't that affect my timing ? .Remember all the bit sequence(in a command) has to be at one go with no gap in between the command bits
Thanks to all in advance
Problem statement:
I am struck writing code to encode bit 0 and 1. Using PWM and Timer0
It is as follows:
encoding of bit 1
I have to retain pulses(38Khz) exact for duration = 13*(1/38Khz)
and keep no pulses for duration = 82*(1/38khz)
similarly the encoding for bit 0
I have to retain pulses(38Khz) exact for duration = 13*(1/38Khz)
and keep no pulses for duration = 120*(1/38khz)
similarly there is a different encoding for lead out burst and lead in burst.
My Approach:
1. set up the PWM with duty cycle...etc for generating 38Khz pulses..
2. Parallel run the Timer0 with time duration equivalent of 13*(1/38Khz)
3. Inside the Timer0 ISR, I will make the corresponding associated CCP1 OFF and simultaneously set the Timer0 with new time duration of 82*(1/38khz) for which the CCP1 pin has to be low
Here i am struck how to proceed with timing a very important parameter.
can any one give a better approach to improve the timings?I am sending the command at 38 Khz carrier frequency
This is where I am facing problem ,
1. The IR code scheme or protocol whatever contains multiple encode formats, OFF duration (No PWM pulses) varies based on the command (ex mycase: 0xAE). Bit 1, bit 0, extra burst pairs lead out , lead in,frame endseq all of them have same ON duration but differ in their OFF duration. In my case I have to sent all of them bit0, bit1, Lead out burst ,Lead in burst seq and frame end seq in a sequence for controlling a device.
2. Now, I have check for whether it is bit 0 or bit 1 or lead out or lead in or seqence end in the Timer0 ISR and based on this Timer0 has to be loaded. With the OFF duration. won't that affect my timing ? .Remember all the bit sequence(in a command) has to be at one go with no gap in between the command bits
Thanks to all in advance