The Arduino generates an accurate 1 second time base for the counter by cascading timer0 and timer2. The link between digital inputs 3 and 4 connects the output of timer2, 250 Hz, to input of timer0. The software waits for the output of timer0 to go positive to start the count of frequency input to timer1. Timer1 is a 16 bits timer, it overflows at the count of 2 power of 16, that in turn advances overFlow register. At the end of the 1 second the 16 bit register is recorded. The Arduino then sends to the PC via the USB cable and the Com Port 6 bytes of data.
The Arduino has to be connected to the PC first and then the VB6 app started. The app searches for the Com Port by sending a byte and checking if the byte is echoed. It takes a few seconds. The app has to be switched off when the Arduino IDE programs the Arduino Uno.
The frequency input is TTL signal levels, for low signal a video amp has to be added. The specs recommend input up to 6 MHz, I tested it at 2 MHz.
The app and VB6 code can be downloaded from my website: http://www.moty22.co.uk/android.php
Comments