trying to set cobra (EMX) LPCxxx port 1.6 pin as output hi & low.& hi & lo…tried this nothing happens…any thought? … This port pin is avail at the SD card pins & am using it fine for PWM already PWM0[4], but in some cases I just need a high or low
static Register IO1DIR = new Register(0xE0028018);
static Register IO1SET = new Register(0xE0028014);
static Register IO1CLR = new Register(0xE002801C);
Debug.Print("port test");
PINSEL2.ClearBits(3 << 12); // set to I/O port mode
uint portdir;
portdir = IO1DIR.Read(); //GET OTHER CURRENT PORT PIN DIRECTIONS
portdir = portdir | (1 << 6); //set p1.6 as output
IO1DIR.Write(portdir);
IO1CLR.Write(1 << 6); //set low
Thread.Sleep(1111);
IO1SET.Write(1 << 6); //set high
Thread.Sleep(1111);
IO1CLR.Write(1 << 6); //set low
Thread.Sleep(1111);
IO1SET.Write(1 << 6); //set high
P0xDIR
or
P1xDIR 0
Slow GPIO Direction PORTx control bits. Bit 0 in IOxDIR
controls pin Px.0, bit 31 IOxDIR controls pin Px.31.
0=Controlled pin is an input pin.
0x0
1=Controlled pin is an output pin.
hmmm…maybe they have it listed backwards…will try clearing it for fun…any other thoughts?
I’m 99% sure I’m on the proper pin, since I do working PWM there…just need a way to force the pin high at times (want try low also, so I know I’m really controlling it & its not high due to some random setting).
When I set pinsel bits to 00 it goes high since I believe the pullups are on by default & it is set to direction input…so I’m not really in control.
hey–that’s interesting…do you know if it can do 0 &100%? Not all chips can…I’m really doing double mode timing, but its eassentiually pwm…set when it goes high, when it goes low
I was still wondering why my posted code is not toggling the pin…seems rather strange…I wonder if something additional needs adjusted (in some unknown register, like port activation,ports disabled, etc)…This chip has more setup pregister than anything I’ve ever seen