2007-12-05 11:11 PM
2007-12-04 11:46 PM
OIF bit can't clear(It's always set) in Main Clock Control Status Register( MCCSR)
I have Evaluation Board of softech and I have a st72334 How can I do? Thanks2007-12-05 01:43 AM
Reading the datasheet you'll find all you need:
MAIN CLOCK CONTROL/STATUS REGISTER (MCCSR).....
Bit 0 = OIF Oscillator interrupt flag
This bit is set by hardware and cleared by software
reading the CSR register. It indicates when set
that the main oscillator has measured the selected
elapsed time (TB1:0).
0: Timeout not reached
1: Timeout reached
CAUTION: The BRES and BSET instructions
must not be used on the MCCSR register to avoid
unintentionally clearing the OIF bit.That's what I beleive: The flag only seems to be uncleared. It always will be set by hardware in the meantime, until you are reading the MCCSR flags again. WoRo
2007-12-05 01:55 AM
during debug I tried to clear by software but none results.
What can I do?2007-12-05 03:38 AM
How did you try to clear the bit 'by software'??? And when did you read the MCCSR again?
WoRo2007-12-05 03:55 AM
I tried with bres and nothing
with ld MCCSR,A( with a solution that cleared OIF bit) I read that Oif bit would be cleared reading MCCCSR but nothing I never seen OIF bit cleared. I tried to read it in various parts of program but nothing!! Thanks for help I don't know where I wrong and what to do2007-12-05 08:09 PM
As described in the datasheet :-W you do not clear the OIF by writing into MCCSR anyway, but only by reading MCCSR.
But: BSET/BCLR of any (!) bit in the MCCSR will clear the flag because BSET/BCLR consists of a sequence -read byte-set/clear bit-write byte- and reading the MCCSR will clear OIF. Loading MCCSR into register A, e.g. ld A,MCCSR you'll find the value of MCCSR in register A with the OIF beeing set. The very moment - reading MCCSR - the OIF flag has been cleared inside your micro. you can read the MCCSR with OIF being cleared until your micro reaches the elapsed time (controlled by TB0,TB1) when OIF will be set again by the hardware. You might test this effect, reading MCCSR twice consecutively, e.g ld X,MCCSR - ld A,MCCSR - you should find the bit0 beeing cleared in register A and set in X. WoRo2007-12-05 08:50 PM
During debug I used ur routine but nothing. I controlled bit status after two
reads but OIF bit is set!!!!! I don't know what I can do!!!! I need to aquire every second and the use of MC it's the only way I know.Ihave st72334. If u know another routine, please help me!!!!!!!!2007-12-05 11:11 PM
As I'm not familiar with the EvaBoard of Softec, I only can guess:
If you use the single step mode to check the program, the time from step to step may be the cause of setting the OIF?????? However, please post the part of your program, where you check the OIF and explain, how you are testing the sequence. WoRo