cancel
Showing results for 
Search instead for 
Did you mean: 

MCCSR

pulvirenti
Associate II
Posted on December 06, 2007 at 08:11

MCCSR

8 REPLIES 8
pulvirenti
Associate II
Posted on December 05, 2007 at 08:46

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?

Thanks

wolfgang2399
Associate II
Posted on December 05, 2007 at 10:43

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

pulvirenti
Associate II
Posted on December 05, 2007 at 10:55

during debug I tried to clear by software but none results.

What can I do?

wolfgang2399
Associate II
Posted on December 05, 2007 at 12:38

How did you try to clear the bit 'by software'??? And when did you read the MCCSR again?

WoRo

pulvirenti
Associate II
Posted on December 05, 2007 at 12:55

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 do

wolfgang2399
Associate II
Posted on December 06, 2007 at 05:09

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.

WoRo

pulvirenti
Associate II
Posted on December 06, 2007 at 05:50

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!!!!!!!!

wolfgang2399
Associate II
Posted on December 06, 2007 at 08:11

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