MC908GP32 - Hi  I'm trying to produce a 38kHz signal through using TI...

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MC908GP32 - Hi  I'm trying to produce a 38kHz signal through using TI...

1,227 Views
IckleMe
Contributor I

Hi

I'm trying to produce a 38kHz signal through using TIM on a GP32. I have copied a programme from the TIM manual for 'Output Compare' but have been unable to get it to work.

I need to produce this signal, along with an output using SCI, which will then be modulated and transmitted using a IR LED.

If anyone has any suggests on why it would not work, and how it can be fixed, or even a simpular way of providing the signal I would be extremely grateful.

Many thanks

 

 

Added p/n to subject.






Message Edited by Ickle Me on 2008-04-21 01:29 PM

Message Edited by Ickle Me on 2008-04-21 01:31 PM

Message Edited by NLFSJ on 2008-04-21 05:37 PM

Message Edited by NLFSJ on 2008-04-21 05:39 PM
Labels (1)
0 Kudos
3 Replies

325 Views
allawtterb
Contributor IV
If all you need to do on this pin is create the carrier frequency it would be easier just to use PWM mode to create the carrier.  Have you tried using the PWM yet?
0 Kudos

325 Views
bigmac
Specialist III
Hello,
 
Using unbuffered PWM mode it is still necessary to control the duration of the carrier burst.  The most straight forward method would seem to count the number of carrier cycles generated.  This could be done by enabling the channel interrupt (it would occur once per carrier cycle), and terminating the burst from within the ISR when the required count is reached.
 
There would still need to be a relatively fast bus clock rate.  Assuming 8 MHz bus, the TMOD setting would require to be 210 for a 38 kHz carrier.  The channel register setting might be 64 to give 30 percent duty.  Within the channel ISR processing, the PWM output could be disabled by clearing the TOVx bit within the channel status and control register (0 percent duty), and leaving other control bits unchanged.  There would be a maximum of 145 cycles allowed for this to take place, prior to the commencement of the next carrier cycle (on timer overflow).
 
The channel interrupt would continue whether or not there is PWM output waveform, and this might also be useful tor timing the gaps between carrier bursts, without the necessity for using the other TIM module.
 
Regards,
Mac
 
0 Kudos

325 Views
bigmac
Specialist III
Hello,
 
There was extensive discussion of timing issues pertaining to IR carrier generation (RC5 code) wthin the following lengthy thread.
 
Using output compare interrupts to generate the carrier was thought to be feasible with a sufficiently high bus clock frequency, but timing is likely to be tight because of ISR overheads.  It is quite likely that the ISR would need to be written in assembler to meet the timing constraints.
 
Additionally, all other interrupts would need to be disabled to prevent possible disruption to the TIM channel interrupts during each carrier burst transmission.
 
The alternative method is a timed firmware loop.  This method was adopted within the posted sample code (written for RS08KA2 device).  For the HC908 device the timing would need to be re-assessed.
 
What IR code format do you intend using?
 
Regards,
Mac
 
0 Kudos