// lab3_skel.c // Name: // 10.30.2023 // //Just like lab2 but with interrupts // // HARDWARE SETUP: // PORT C physical connections // PORTC: 7 6 5 4 3 2 1 0 // pwm_enable_n --| | | | | | | |--unused // digit select MSB----| | | | | |----unused // digit select ------| | | |------unused // digit select LSB--------| |--------unused // //Lower nibble of PORTC are to be left unused. Terminate 3-to-8 decoder //inputs with protoboard connections. #include #include #define TRUE 1 #define FALSE 0 //***************************************************************************** void init_TC0_normal(){ //setup timer for normal mode and overflow interrupt // TCC0_CTRLA |= TC_CLKSEL_DIV4_gc; //~440uS TCC0_CTRLB |= TC_WGMODE_NORMAL_gc; TCC0_PER = 0x00F0; TCC0_INTCTRLA = ?????????????????; //interrupt level bit zero set } //***************************************************************************** //***************************************************************************** TC0 overflow ISR // ISR(TCC0_OVF_vect){ //most all of your old code goes here }//end of ISR //*********************************************************************************** int main(){ //configure all PORT A pins as WIREDANDPULL OPC[2:0]=111 PORTCFG.MPCMASK = 0xFF; //write all the bits PORTA.PIN0CTRL = PORT_OPC_WIREDANDPULL_gc; //set output pull control //Port C upper nibble is all outputs PORTCFG.MPCMASK = 0xF0; //write upper nibble PORTC.PIN4CTRL = PORT_OPC_TOTEM_gc; //set output pull control init_TC0_normal(); //TC0 running in normal mode PMIC.CTRL ??????????????????; //enable low level interrupts sei(); //main while loop while(1){ //bound the count //break up disp_value to 4, BCD digits in array } //while } //main