This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Maybe a bug of MDK 4.21 on simulator LPC1114 GPIO

hi, i use software simulator of MDK 4.21 for LPC1114 GPIO. here is the Code:

int main (void)
{

int i;

LPC_GPIO[0]->DIR |= (1<<1); //prot0.1 as output

LPC_GPIO[0]->DIR |= (1<<2); //port0.2 as output

while( 1 )

{

LPC_GPIO[0]->MASKED_ACCESS[1<<1] = (1<<1); //set port0.1 as 1

for(i=0;i<10000;i++);

LPC_GPIO[0]->MASKED_ACCESS[1<<2] = (0<<2); //set port0.2 as 0

for(i=0;i<10000;i++);

}

}

When the first statement(set port0.1 as 1) finished, the simulator work OK, the port0.1 is 1.
but when the next statement(set port0.2 as 0) finished, it clear the port0.2 as 0, and Port0.1 has been cleard to 0 also!!

Parents
  • The user manual - §9.2.1 - says: "Reading and writing of data registers are masked by address bits 13:2"

    And §9.4.1 shows a diagram where two least significant bits of the mask address isn't used.

    so 1<<2 is mask address for port0.0
    and 1<<3 is mask address for port0.1
    and 1<<4 is mask address for port0.2

Reply
  • The user manual - §9.2.1 - says: "Reading and writing of data registers are masked by address bits 13:2"

    And §9.4.1 shows a diagram where two least significant bits of the mask address isn't used.

    so 1<<2 is mask address for port0.0
    and 1<<3 is mask address for port0.1
    and 1<<4 is mask address for port0.2

Children