1) Is there any order in writing the DCRxx, ATCSR, ATRxx and PWMCR registers? 2) My program looks like that: PADDR=0x04; // PA2 (PWM0) = output PAOR=0x04; // PA2 = pullup SetBit(ATCSR,FOUR); // Counter Clk = fCPU ClrBit(ATCSR,THREE); ATRH=0x00; ATRL=0x00; DCR0H=0x05; PWMCR=0x01; // PWM0 enable What is wrong with that? There is no signal at the pin which is connected to a LED on the in-DART-STX Demo-board. Do I need the Overflow/Compare interrupts? Are there any examples for ST7Lite2 PWM mode in C? Thanks for any help!
When you write ''DCR0H=0x05;'', the 0x05 are placed into temporaly registers, not in the ''real'' PWM register. By adding TRANCR=0x01 after the DCR0H=0x05 the data is copied into the ''real'' PWM registers. Do not forget to do this later on in your program every time a PWM value has to be changed! Maybe you should place ''PWMCR=0x01'' before the DCR0H=0x05. But i'm not sure. When it still doesn't work i can give a part of code you can use. Just ask. Greets.
Thank you very much for your help! Indeed, it's important to set the TRAN bit, what i didn't! (With the LITE0, that ARTimer is quite different, unfortunately I have only LITE0 examples). But even with that bit set, it still doesn't work. I tried also to toggle position between the PWMCR and the DCR0H line, but there is still no effect! For the 'DCRxx' lines I disable the interrupts, and enable afterwards, but that doesn't help neither. Do have any other ideas? Thanks again, and have a nice evening!
Thank you very much for your help. You thought me about the TRAN bit. Although I have exactly the same program as you, it still doesn't work.
Even with a new uController it is still the same. Maybe there is someone out there from ST interested in helping their costumer? Up to now ST just pointed me to this forum.
The PWM function works well on PWM1 but not on PWM0, although they have absolutely the same configuration (Soft-and Hardware)! Anybody an idea why it is so?