Abhiyanta-Community / Hardware-and-Timer-Interrupt-with-ATmega328p-Hardware

0 stars 0 forks source link

Implement a push button to generate Hardware Interrupt #4

Closed PRITVARMORA closed 2 years ago

PRITVARMORA commented 2 years ago

Modify the program to use the interrupt for triggering the LED pattern instead of continuously monitoring the Push Button.

vasoyasujal42 commented 2 years ago

==>Conclusion -->In this task we made interrupt for led sequence when we press push button first time led sequence if we press button second time led start form starting. -->In the code we set DDR and PORT for led and push button then after we pull-up pin for button. -->In EICRA we set ISC00 and ISC01 for LOW level logic. We used ISC00 and ISC01 for low(0) level sense. -->After EIMSK we set enable interrupt for INT0 HIGH(0) for pin-2. -->Farther we write a code for led for sequence and push button. -->Then after we ISR(Interrupt Service Routine) for INT0 and we add logic. -->In this task we not face any major error only we face small compiler error.

==>In this task we learn how to setup interrupt and how to use use for projects and what type of register we need to configure.

vasoyasujal42 commented 2 years ago

Meeting tasks assignments

Darshnik253 commented 2 years ago

In this task, we made interrupt for led sequence in that when we press push button second time then led start form starting. -->In the code we set DDR and PORT for led and push button then after we pull-up pin for button. -->In EICRA we set ISC00 and ISC01 for LOW level logic. We used ISC00 and ISC01 for low(0) level sense. -->After EIMSK we set enable interrupt for INT0 HIGH(0) for pin-2. -->Farther we write a code for led for sequence and push button. -->Then after we ISR(Interrupt Service Routine) for INT0 and we add logic. -->In this task we not face any major error only we face small compiler error. so from this task we learn how to setup interrupt and how to use use for projects and what type of register we need to configure.

PRITVARMORA commented 2 years ago

Hello, @vasoyasujal42 in your code https://github.com/Abhiyanta-Community/Tr1-Task-Bin-Oct-2021/commit/015b09a802b9dfb5b8b3927ab5d4ee01bd4c72ce

You have used delay inside the ISR which is not allowed even it will miss behave, I think that's only why you need to keep some un-calculated delay of 10000ms instead of 100ms right? one more thing : the ISR can not hold that much instructions you have written, as I have explained in the meeting according to interrupt vector table ISR for the interrupt you have used can only hold 3 bytes of instruction.

The crack is make an separate user defined function for the task you want to execute and then call it in the ISR, It may solve both the problems

vasoyasujal42 commented 2 years ago

In this task we use delay in ISR but its not work properly why, because in ISR we not use delay but we still use large delay in ISR then compiler reduce to very small time interval. Complier is configure to ISR not take large time interval if we still use delay then its reduce to very small time and we not write such a large code in ISR.