lpcware

Can you turn off a sngle GPIO pin at once?

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by ssi.nisielektrotehnik on Thu Jun 11 01:27:03 MST 2015
Hello

I am currently studying on a LPC3141 development board. I am trying to turn off a single GPIO pin while leaving the others in the same states as they were. My problem is that i can turn them on individually but when i want to turn off just one pit it makes a "bus reset" and turns them all off. I cannot figure out why does it reset all of them when i use bit shifting. Here is an example of my code that does this:

define PINS            (*((volatile unsigned int *)0x130031C0))
#define MODE0         (*((volatile unsigned int *)0x130031D0))  //Zelo pomembno je da smo prepricani da je naslov isti
#define MODE0_SET (*((volatile unsigned int *)0x130031D4))
#define MODE0_RESET (*((volatile unsigned int *)0x130031D8))

#define MODE1 (*((volatile unsigned int *)0x130031E0))
#define MODE1_SET (*((volatile unsigned int *)0x130031E4))
#define MODE1_RESET (*((volatile unsigned int *)0x130031E8))


void delay (void);

void c_entry(void){

  //Prg gpio pins (glej user manual str 312-318
  //Bit manipulation (spremenim samo 1 bit v registru inne celega)
  MODE1 = MODE1 | (0x1 << 6); //TO premakne bit 1 za 10 mest in s tem spremenimo samo 1 bit v registru
  MODE1 = MODE1 | (0x1 << 8);
 
  while(1){
        MODE0 = MODE0 | (0x1 << 6);
        MODE0 = MODE0 | (0x1 << 8);
    delay();
      MODE1 = MODE1 | (0x1 << 6); //TO premakne bit 1 za 10 mest in s tem spremenimo samo 1 bit v registru
  MODE1 = MODE1 | (0x1 << 8);
MODE0 = MODE0 & !(0b1000000);
    delay();
  }
 
}
void delay (void){
    volatile int stej = 1000000;
    while(stej){
      stej = stej - 1;
    }
   
  }

Ty and have a nice day

SSI elektrotehnik

Outcomes