2020-09-23 04:00 AM
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