MOBILE HOME Technical Tips  


Self powered frequency counter plugged into the serial port. Included a Visual Basic (VB6) code, PIC code, and a circuit diagram. The PIC16F628A microcontroller is programmed to count the input frequency and transmit it serially to the serial port. The microcontroller is powered by the signals of the serial port, so no external power supply is needed. The counter is 17 bit (16 bits + overflow). The crystal can be changed to a ceramic resonator if accuracy isn't essential.
The signal input is connected via the chip comparator to allow sensitivity down to 100mV.
You can read more about serial interface in

You are free to use the circuit diagram and the software with no limitations.
Software includes PIC code and VB6 code. You are free to use the circuit diagram and the software with no limitations.

The VB6 application

Circuit Description
See also Technical Tips

Pin 4 at the serial port is turned to +12V by the software enabling RTS. It is regulated to 5V by 78L05. The 5V is the supply to the microcontroller.
Pin 3 is at -12V and pin 7 at +12V constantly and they are used to drive RX input between -9V (input HIGH) and +8v (input LOW) . These levels are sufficient to drive the RS232 input.

PIC16F628A contains a UART for serial comm and a 16 bit counter.
Input signal can be 0.1 to 5 vollts peak to peak.
Pin 17 is the frequency input, it's the PIC comparator input. Referance voltage to the comparator is 2.5V at pin 1. Output of the comparator at pin 2 is linked to the PIC counter input at pin 12.
Pin 8 is the UART output, it transmits the 16 bit count and overflow in three 8 bit words in RS232 format.
The other pins are not in use but must be left open circuit.


Comments and questions

Copy the number from the picture It stops net-robots from adding comments.

20.07.2014 - 02:02
Name: Moty
Comment: Hi Xtal. You are right, thank you for finding the error. I uploaded the old version of the firmware by mistake. Now it's corrected so please download the software again and try it.

19.07.2014 - 18:37
Name: xtal
Comment: Interesting, but software shouldn\'t work....CMCon was set to 7 disabled comparators , cmcon never altered so how to get output from RA3 ? , where was TMR1 set up for external input[RB6] .....

29.08.2013 - 02:02
Name: Moty
Comment: Can't be very intelligent robot.

28.08.2013 - 14:29
Name: uytrurty
Comment: Robot comment.

28.08.2013 - 14:28
Name: fhdrtye
Comment: Robot comment.