Professional Documents
Culture Documents
Clock and Timer Code
Clock and Timer Code
Clock and Timer Code
void PortF_Init(void){
SYSCTL_RCGC2 |= (1<<5); // 1) activate clock for Port F
delay = SYSCTL_RCGC2; // allow time for clock to start
GPIO_PORTF_DIR = 0x0E; // 5) PF4,PF0 in, PF3-1 out
GPIO_PORTF_DEN = 0x0e; // 7) enable digital I/O on PF4-0
}
void timer0_Init(void){
int main(void) {
//----> Initilize
PLL_Init();
PortF_Init();
timer0_Init();
while(1){
if((Timer0_RIS & 0x00000001) == 1){
GPIO_PORTF_DATA ^= (1<<2);
Timer0_ICR |= (1<<0);
}
}
}