Re: pulse duration measurement with flowcode
Posted: Fri Jun 10, 2011 5:22 pm
Hello Pravat,
Thanks for the C file I will have a look and investigate for you. Had a quick look and nothing is jumping out at me.
Flowcode for AVR is compatible with WINAVR as that is what Flowcode uses. Make sure you include the internals file in your AVR studio project.
Hello Echase,
Timer 1's duration really depends on the clock source but I doubt you will be able to get 10 seconds with a single count cycle, What would be better would be to use a timer with a fast interrupt rate and then use this as your base time period and simply count the number of interrupts you require before continuing.
The interrupt properties should allow you to switch to source to the external pin. If not then you will need to use C code.
The handler is the code that is ran when the interrupt is generated. When the handler is finished your program will resume where it left off.
Which version of Flowcode are you using? Timer 1 should be fully supported by default, no custom interrupts required.
No this is not how it works. The timer will increment 1 time every time the clock signal goes high and low. If you have a prescaler then the timer will divide down the number of input pulses to lengthen the counting period. The interrupt is generated when the count value rolls over from its max value to 0.
TMR 2 will have separate oscillator input pins for you to use with the LP crystal other then the main OSC1 and OSC2 pins.
Thanks for the C file I will have a look and investigate for you. Had a quick look and nothing is jumping out at me.
Flowcode for AVR is compatible with WINAVR as that is what Flowcode uses. Make sure you include the internals file in your AVR studio project.
Hello Echase,
Timer 1's duration really depends on the clock source but I doubt you will be able to get 10 seconds with a single count cycle, What would be better would be to use a timer with a fast interrupt rate and then use this as your base time period and simply count the number of interrupts you require before continuing.
The interrupt properties should allow you to switch to source to the external pin. If not then you will need to use C code.
The handler is the code that is ran when the interrupt is generated. When the handler is finished your program will resume where it left off.
Which version of Flowcode are you using? Timer 1 should be fully supported by default, no custom interrupts required.
No this is not how it works. The timer will increment 1 time every time the clock signal goes high and low. If you have a prescaler then the timer will divide down the number of input pulses to lengthen the counting period. The interrupt is generated when the count value rolls over from its max value to 0.
TMR 2 will have separate oscillator input pins for you to use with the LP crystal other then the main OSC1 and OSC2 pins.