/*===================================================================== # # EECS461 at the University of Michigan # Blinky Demo # # Created 1-06-08, John W. Schmotzer # # Revision History: # =====================================================================*/ typedef union siu_pcr_u { /* Pad Configuration Registers */ volatile unsigned short R; struct { volatile unsigned short :3; // Unused bits volatile unsigned short PA:3; volatile unsigned short OBE:1; volatile unsigned short IBE:1; volatile unsigned short DSC:2; volatile unsigned short ODE:1; volatile unsigned short HYS:1; volatile unsigned short SRC:2; volatile unsigned short WPE:1; volatile unsigned short WPS:1; } B; } PCR; void main() { volatile PCR* config; /* Pointer for address of PCR "array" (elements 16-bit) */ volatile char* GPDO; /* char should be 8-bit */ volatile char* GPDI; int i, counter; /* INITIALIZATION */ config = (PCR *)0xC3F90040; /* Sets the first element address of the array */ GPDO = (char *)0xC3F90600; GPDI = (char *)0xC3F90800; for(i = 28; i <= 32; i++) /* can use up to pad 43 */ { /* Students should initialize at least 5 output pads */ config[i].B.PA = 0b00; config[i].B.OBE = 1; /* enable output buffer */ GPDO[i] = 0; /* write bit */ } /* PROGRAM LOOP - Make all the LED's blink in unison */ while(1) { for(i = 0; i<= 4000000; i++) {/*makes LED's blink with period .1 sec*/ if(i<(2000000)) { GPDO[28] = 0x1; GPDO[29] = 0x1; GPDO[30] = 0x1; GPDO[31] = 0x1; GPDO[32] = 0x1; } else { GPDO[28] = 0x0; GPDO[29] = 0x0; GPDO[30] = 0x0; GPDO[31] = 0x0; GPDO[32] = 0x0; } return; } // EOF