Stefan Mardale

I need help setting up the PWM - HCs12C32

Discussion created by Stefan Mardale on Jan 23, 2008
Latest reply on Jan 27, 2008 by Stefan Mardale

I'm new with this kind of kind of microcontrollers. I have a HCs12C32 development board and I'm trying to get tha hang of it.

I want to use the PWM to drive a small servo-motor.

What I coulnd't understand by myself is how to set the dutycicle for my PWM. What is the usual syntax?
I want to use it along with the ATD. I want to copy the value form the ATD register and by this modify the dutycicle.

Here is small part of my software:



First I get an warning message telling me: "Posible lose of data".
I tested it on a LED and it seems to work OK. The LED seemed to change it's brightness OK. However With the motor it doesn't work to fine. I'm having problems with dutycicles above(70%-It is a guess).

My basic question: How do i set the dutycicle corectly? Do I simply enter 1 for 1%, 23 for 23% 100 for 100%? (PWMDTY=23:smileywink:

Thank you!
Added p/n to subject.

Message Edited by NLFSJ on 2008-01-23 06:42 AM