Thanks for the reply ard_newbie, yes that code works as you intended it to be used. But do you know why if I just use your Delay routine in my code it doesn't work. i.e
while(1) {
REG_PIOB_SODR = PIO_PB27;
Delay(500);
REG_PIOB_CODR = PIO_PB27;
}
So whats so different from this apart from the xor:
while(1) {
REG_PIOB_SODR = PIO_PB27; //Enable output
Delay(500);
REG_PIOB_CODR = PIO_PB27; //Disable output
}
And the following actually works:
while(1) {
REG_PIOB_SODR = PIO_PB27;
for (i=0;i<1000;i++)
{
for (j=0;j<2000;j++) k = i-j;
}
REG_PIOB_CODR = PIO_PB27;
for (i=0;i<500;i++)
{
for (j=0;j<2000;j++) k = j-i;
}
}