HCS08 trying to output 100kHz PWM signal

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

HCS08 trying to output 100kHz PWM signal

3,782 Views
Venom2000
Contributor I
Hey guys,
I'm using a HCS08 microcontroller (Codewarrior 5.7.0) and my trouble is concerning the PWM output.
I want to output a 100kHz signal on pin PTF4. Does anyone have any sample code or know how to go about programming this using C code (not assembly).
Thanks
 
-Chris
Labels (1)
0 Kudos
4 Replies

426 Views
bigmac
Specialist III
Hello Chris,
 
Welcome to the forum.
 
There is a trade off between the frequency of a PWM output, and the PWM resolution that can be achieved, and this will depend on the bus frequency you are using.  For example, with a 10MHz bus frequency and a PWM frequency of 100kHz, the maximum PWM resolution would be limited to 100 pulse width values.
 
To say you require the output to occur at PTF4 is meaningless unless you also state the specific MCU type.
 
Regards,
Mac
 
0 Kudos

426 Views
Venom2000
Contributor I
Thanks for the quick replay bigmac.
As you can tell I'm very new to this chip and the Codewarrior software.
 
The MCU I'm using is the HCS908AW. Supposedly the bus speed is 20MHz but I am unsure of how to verify this. I'd prefer to leave the bus speed as high as possible and have the output pin PTF4 at 100kHz (10us time period).
So far I haven't been able to modify the period or the frequency. I'm using the Device Initialization plugin to change the bean parameters.
 
Thanks again for your help,
 
-Chris
0 Kudos

426 Views
Witztronics
Contributor IV
Chris,
 
Attached is some sample code from one of our development kits.  In the sample code, we use PE and the 9S08AW16 to generate a DAC output using the PWM. 
 
Hopefully, it will help.
 
Message Edited by t.dowe on 2009-10-27 01:14 PM
0 Kudos

426 Views
Venom2000
Contributor I
Thanks a lot guys, I now have the PWM working.
0 Kudos