2007-02-01 09:46 PM
Frequency of PWM: very un-precise!?
2007-01-22 02:08 AM
Hi,
I use ST7lite19F with internal oscillator at 8MHz. I use initial re-calibration with: MCCSR = 0x00; EECSR = 0x00; RCCR = ((EEPROM[0] & 0xFF00) >> 8); I use PWM with clock at 32MHz: ATCSR = 0x1A; /* fcounter = 32 MHz, OVFIE */ ATR = 2496; With this setting my fPWM is fCOUNTER /(4096-2496) = 32MHz/1600 = 20KHz. Problem: when I go to measure the real frequency I found variable value, 18KHz to 33KHz ??!!! :o It's normal? :(2007-01-24 03:26 AM
To me this code:
RCCR = ((EEPROM[0] & 0xFF00) >> 8); sets RCCR to 0. The eeprom holds bytes, so 8 bits of eedata & 0xFF00 = 0. What are you setting the DCRx register(s) to? pjr2007-01-28 09:04 PM
Thanks for your reply!
Why RCCR is '0'? The DCRx start to ATR and it's go at 4096 for slowly start. Thanks2007-02-01 09:46 PM
Perhaps I have found!
I have mapped the EEPROM: MY_EEPROM = NO_INIT 0x1000 TO 0x107F; with: NV_VAR INTO MY_EEPROM; and defined it in main.c : #pragma DATA_SEG NV_VAR RAM_EXTERN unsigned int far EEPROM[0x40]; When I read the EEPROM with the command: MCCSR = 0x00; EECSR = 0x00; /* E2 in lettura */ RCCR = ((EEPROM[0] & 0xFF00) >> 8); is possible that I read the least bit of RCCR? Thanks for help!