Question: Kindly perform the following code in language C. It would be better if the code is typed rather than being handwritten. thanks in advance. Q2-

Kindly perform the following code in language C. It would be betterKindly perform the following code in language C. It would be better if the code is typed rather than being handwritten. thanks in advance.

Q2- Answer the following questions (Total 10 Marks) Assume you want to program an ATmega328 MCU to print the number of times a user press and then release a pushbutton connected to an input pin using an External Interrupt. Complete the following code (Arduino Sketch): [10 Marks) //global variables here void setup() { //disable all interrupt cli(): Serial.begin(9600); pinMode(2, INPUT_PULLUP); EICRA EIMSK = sei(): ) //write value here //write value here //enable interrupts void loop() 2 //define ISR ISR(INTO_vect) Relevant ATmega328 registers: EICRA - External Interrupt Control Register A The external interrupt control register A contains control bits for interrupt sense control BH (Ox60) Read/Write Initial Value 6 0 EICRA 3 ISC11 RW 0 2 ISC10 R/W 0 1 ISC01 R/W 0 R R 0 ISCOO RAW 0 D ISC01 ISCOO Description 0 0 The low level of INTO generates an interrupt request. 0 1 Any logical change on INTO generates an interrupt request 1 0 The falling edge af INTO generates an interrupt request 1 1 The rising edge of INTO generates an interrupt request EIMSK-ExternalInterrupt Mask Register But 6 5 4 3 2 0x1D(0:30) INT1 Read/Write R R R R R RW Initial Value D 0 0 0 0 2 EIMSK R INTO RW 0 0 0 Q2- Answer the following questions (Total 10 Marks) Assume you want to program an ATmega328 MCU to print the number of times a user press and then release a pushbutton connected to an input pin using an External Interrupt. Complete the following code (Arduino Sketch): [10 Marks) //global variables here void setup() { //disable all interrupt cli(): Serial.begin(9600); pinMode(2, INPUT_PULLUP); EICRA EIMSK = sei(): ) //write value here //write value here //enable interrupts void loop() 2 //define ISR ISR(INTO_vect) Relevant ATmega328 registers: EICRA - External Interrupt Control Register A The external interrupt control register A contains control bits for interrupt sense control BH (Ox60) Read/Write Initial Value 6 0 EICRA 3 ISC11 RW 0 2 ISC10 R/W 0 1 ISC01 R/W 0 R R 0 ISCOO RAW 0 D ISC01 ISCOO Description 0 0 The low level of INTO generates an interrupt request. 0 1 Any logical change on INTO generates an interrupt request 1 0 The falling edge af INTO generates an interrupt request 1 1 The rising edge of INTO generates an interrupt request EIMSK-ExternalInterrupt Mask Register But 6 5 4 3 2 0x1D(0:30) INT1 Read/Write R R R R R RW Initial Value D 0 0 0 0 2 EIMSK R INTO RW 0 0 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!