I been digging around in Atmel studio 7 so I can code the sam3x8e using registers plus c++. My problem is when I use delay_ms the code seems to go into some infinite loop on the delay_ms function. It steps through the code fine with F10 but soon as I press F5 the built in LED goes constant orange.
Anyone know what the issue is with delay_ms. Tried a few suggestions from other sites like including delay_init(), didn't hep. Someone else suggested #define F_CPU 84000000, didn't help, another said using a delay less than 300ms, no look there. So like a computer I'm in some need of input.
PMC->PMC_PCER0=(1<<12); REG_PIOB_PER |= PIO_PB27; REG_PIOB_OER |= PIO_PB27; REG_PIOB_CODR |= PIO_PB27; REG_PIOB_OWER |= PIO_PB27;
REG_PIOB_SODR = PIO_PB27; //Enable output
REG_PIOB_CODR = PIO_PB27;