I am working with a freescale MC9S12DT256 and attempting to get a pwm signal. As a first approach processor expert was used and successfully produced a pwm signal. Since this is for educational purposes the goal is define all memory locations manually. The code below will sometimes produce a pwm signal and other times not. I should also note that it compiles. I have tested it on multiple processors and get the same result. To ensure that it is correctly wired to the scope I have tested the code generated with processor expert and it works. At this point I am stuck and not sure where my problem is. Any help would be greatly appreciated. Erik
#include <hidef.h> /* common defines and macros */ #include <mc9s12dt256.h> /* derivative information */ #pragma LINK_INFO DERIVATIVE "mc9s12dt256b"
I would say its about 1 out of every 10 times that it works. For sure it fails more than it works. I think the casting portion is okay because I tested this portion of the code with bean generated code and had no problems. I use that line to cast it to a byte because the period is only 255 so the dutycycle should never be any larger. I will give the code a run without that function and just simply set the pwm dutycyle to a value and see if it works. Thanks for the reply and am open for any other suggestions. Erik