I am in need of some help with some code that i have to write to turn the hc12 into a frequency counter. I have the basic idea of what i am going to do. but first let me give you a few of the specs that i have to be able to meet.
1) It must count frequencies up to 1Mhz
2) It must display only the two mose significan digits and iunclude a scale factor
3) It must have a push button to perform the measurement.
4) the reference period must be one second.
So far i have decided what i am going to do. I am planning on using the pulse accumulator as well as the RTI system to generate a interupt at a at a second time period and thorw the interupt on the pulse accumulator, as well as on the rti system. After the interupt has been triggered i want to go into a subroutine that will calculate the frequency and display it and wait for the external irq button to be pushed to return from the interupt and star the program over. Now a few questions. I have a few problems however, i am going to have to count overflows on the 16-bit pulse accumulator register since it can not hold the data for a 1MHz frequency, and i think i am going to have to poll to see when the overflow bit gets set. Here is where i have the questions at.
1) Will i be able to run the rti system in the background to generate a one second interupt and poll the Pulse accumulater overflow flag at the same time? If so, how do you set something like that up.
2) Is it possible to set one of the external pins or interupt switches to return from the RTI interupt and start the program over?
any help would be greats. Thanks.