hi dears
i use this code on keil v5.16a. when i clear a register , the pin position dont chane to 0, and it stay o 1. but in version 4.7 it works correctly. thank you.
#include "LPC177x_8x.h"
#define t 2000
void Delay (uint32_t Time) { uint32_t i;
i = 0; while (Time--) { for (i = 0; i < 50; i++); } }
int main (void) { // ---------------- Configuration ---------------
LPC_GPIO3->DIR = 1<<25 ; /* LEDs PORT3.25 are Output */ while(1) {
LPC_GPIO3->SET = 1<<25; Delay(t);
//LPC_GPIO3->DIR->CLR = 1<<25 ; LPC_GPIO3->CLR = 1<<25; Delay(t); } }
But note that when you run on the real hardware, your delay will be shorter. Maybe much shorter. The compiler is even free to totally remove your busy-loop since it doesn't produce any meaningful side effect the compiler can see.
Have you on the real hardware checked the pin with an oscilloscope?
I use keil 5.16a the problem is in simulator and elevation board. when in lpc1788 i set gpio3 direction output (like LPC_GPIO3->DIR = 1<<25 ;) and set every fio3set (like LPC_GPIO3->SET = 1<<25;)as 1 any fio3pin position don't change to 1. but in other ports every thing is ok. you can try this in General Purpose Input/Output 3 (GPIO3) window.
in keil 4.7 there is not this problem.
best regards