Jack:
1) thanks for the utmost account.
2) the idea is to drive a led by PWM. The datos isgoin a MCU for a program terminal V1.9. It controls the duty cycle byTPMC0V.The problem is when I clear TPMC0V, P.E. TPMC0V=0 orTPMC0V&=0X0000,this register not clear, but if I do the following:
while(TPMC0V!=0)
{
TPMC0V=0;
}
this register clear????
How do I know?
For example: if I write in thefile MCUinit.c of my program PWM4.mcp:
TPMC0V=0x0000; /**/
TPMC0V=0x001C * b_two - 0x5455B;/*TPMC0V takes values from linearequation
*/
and then write streams in the program terminal V1.9: e1e1e5e5e9e9 (loadbuffer) and then ll followed by "enter" (read buffer and loadedTPMC0V), the LED is turned on in low light, then again ll and "enter"increases the intensity, ll and enter again and the light is at maximumbrightness. In contrast, if charge 9e9e5e5e1e1 and pressed successively ll and"enter", the light intensity does not decrease .
However if write:
while(TPMC0V!=0)
{
TPMC0V=0;
}
TPMC0V=0x001C * b_two - 0x5455B;
Works well
I suspect the problem may be the mechanism of loadcoherentización waiting two byte in a buffer before loading on TPMC0V.
3)I send PWM4.mcp for your scrutinizing.
Any suggestion I well welcome
Thank you
Danielito
PWM4.zip
Message Edited by t.dowe on 2009-11-08 10:30 PM