11/21/2023 0 Comments Arduino timer interrupt pin 2![]() #if defined ( AVR_ATmega168) || defined ( AVR_ATmega48) || defined ( AVR_ATmega88) || defined ( AVR_ATmega328P) || ( AVR_ATmega1280) Volatile unsigned long int FreqPeriod::captd Volatile unsigned char FreqPeriod::f_capt TIMSK1 = _BV(ICIE1) // enable input capture interrupt for timer 1 ![]() TCCR1B = 0x01 // No prescaler (prescaler=1) TCNT1 = 0 // reset the counter - 16 bit counter If(bit_is_set(TCCR1B ,ICES1)=1) // If rising edge is detected ![]() Volatile uint8_t PulseCount // number of pulses received in current frame Volatile unsigned int Pulses // array holding number of ticks for a square shape signal, length between a rising edge to its next rising edge). What I am expecting the code do is to measure the period of a signal (ie. Aside from this, does the code looks working to you guys ? (This is my first try of programming in Arduino) Did you select the right one from the tools > Serial Port menu" ? I compiled and uploaded the file using COM5 and it uploads the file but now that I want to see the results, it is not working. Here is my code, when I run it and press on the Serial Monitor, I get an error saying "Serial 'COM5' not found.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |