Skip to main content
Visitor II
May 7, 2014
Question

Activation Level

  • May 7, 2014
  • 1 reply
  • 638 views
Posted on May 07, 2014 at 02:56

I'm using the STM8L101F3 with IAR. I would like to set and clear the Activation level bit.

There is no library function to access this and I'm not sure how to access this register from code.

Looking at iostm8l101f3.h, the register and bit is defined:

/* Global configuration register */

#ifdef __IAR_SYSTEMS_ICC__

typedef struct

{

  unsigned char SWD         : 1;

  unsigned char AL          : 1;

} __BITS_CPU_CFG_GCR;

#endif

__IO_REG8_BIT(CPU_CFG_GCR, 0x7F60, __READ_WRITE, __BITS_CPU_CFG_GCR);

#define CPU_CFG_GCR_AL           CPU_CFG_GCR_bit.AL

But trying to modify the bit from code using:

CPU_CFG_GCR_AL = 1;

generates an error:  Error[Pe020]: identifier ''CPU_CFG_GCR_AL'' is undefined

How can I modify this bit?

    This topic has been closed for replies.

    1 reply

    bluscapeAuthor
    Visitor II
    May 7, 2014
    Posted on May 07, 2014 at 13:12

    Ok, resolved it:

    CFG->GCR |= CFG_GCR_AL;