So, I am trying to extend a "Blinky" (blinks an LED) example program that came with the IAR Kickstart IDE and debugger. When I initialize more than one data direction register the code runs but the signals no longer "output."
Any thoughts?
The code below toggles PH7 if I uncomment "//GPIO_PORTG_DIR_R =
0x03;" no more I/O output.main(void) { volatile unsigned long ulLoop;
// // Enable the GPIO port that is used for the on-board LED. // //SYSCTL_RCGC2_R = SYSCTL_RCGC2_GPIOA; //SYSCTL_RCGC2_R = SYSCTL_RCGC2_GPIOF; SYSCTL_RCGC2_R = SYSCTL_RCGC2_GPIOG; SYSCTL_RCGC2_R = SYSCTL_RCGC2_GPIOH;
// // Do a dummy read to insert a few cycles after enabling the peripheral. // ulLoop = SYSCTL_RCGC2_R;
// // Enable the GPIO pin for the LED (PF3). Set the direction as output, and // enable the GPIO pin for digital function. // PX0 use 0x01, PX1 use 0x02, PX2 use 0x04, PX3 use 0x08, // Px4 use 0x10, PX5 use 0x20, PX6 use 0x40, PX7 use 0x80 //GPIO_PORTA_DIR_R = 0x08; //GPIO_PORTF_DIR_R = 0x01; //GPIO_PORTG_DIR_R = 0x03; GPIO_PORTH_DIR_R = 0x80;
//GPIO_PORTA_DEN_R = 0x08; //GPIO_PORTF_DEN_R = 0x01; //GPIO_PORTG_DEN_R = 0x03; GPIO_PORTH_DEN_R = 0x80;
while(1) { // // Turn on the LED. // //GPIO_PORTA_DATA_R |= 0x08; //GPIO_PORTF_DATA_R |= 0x01; //GPIO_PORTG_DATA_R |= 0x03; GPIO_PORTH_DATA_R |= 0x80;
// // Delay for a bit. // for(ulLoop = 0; ulLoop < 400000; ulLoop++) { }
// // Turn off the LED. // //GPIO_PORTA_DATA_R &= ~(0x08); //GPIO_PORTF_DATA_R &= ~(0x01); //GPIO_PORTG_DATA_R &= ~(0x03); GPIO_PORTH_DATA_R &= ~(0x80);
// // Delay for a bit. // for(ulLoop = 0; ulLoop < 100000; ulLoop++) } Note this is a code snippet and the "{" and "}" are not necessarily in the right place.
Thanks much!
Ed V.