Avery Zycherman

TIM based PWM on HC08GR8

Discussion created by Avery Zycherman on Aug 26, 2006
Latest reply on Aug 27, 2006 by Avery Zycherman

What I am trying to do is build an LED light fader using the TIM channels for PWM generation. The tricky part is that I want to control the fades/brightens by sending little control packets to the MCU from a PC via SCI (this data communication is not tricky, its the variable nature of the fader).

A sample packet would look like this:

L (char, lets the proccesor know i am sending a Lighting instruction)
255 (desired R level)
255 (desired G level)
255 (desired B level)
011 (Timing High Byte)
184 (Timing Low Byte) --> Timing together in decimal = 3000
E (char, ends packet)

So with this packet I am requesting that the MCU raise the levels of 3 LEDs from whatever level they are at (lets say 0 for the example) to 255 (full), and to do it over the course of 3000ms (3s).

I am having an extraordinary amount of trouble with this, can anyone offer some suggestions? I am coding in C.