cancel
Showing results for 
Search instead for 
Did you mean: 

STM8L151F3U6TR comparator 1 register not writeable.

EStud.1
Associate

Hello

I'm using an STM8L151F3U6TR. A lot of things are working fine.

But the comparator 1 seems not to work.

It seems not possible to write its registers.

If I execute the following code with debugger, then "dummy" changes from 0xFF to 0x00.

I would have expected it to be 0x20 at the end.

According to the manual this bit is readable.

(I know you shouldn't set registers like this, but it should work anyway.)

void main(void)

{

  volatile static unsigned char dummy = 0xFF;

  COMP->CSR1 = 0x20; //set interupt enable bit

  dummy = COMP->CSR1; //Dummy is always zero! Why?

  while(1);

}

What could be the problem?

Any ideas?

Regards

Erich

0 REPLIES 0