SERIAL
PORT 1MHz FREQUENCY COUNTER
Self powered frequency counter
plugged into the serial port. Included a Visual Basic (VB6) code
and .EXE file, PIC assembly, PIC C code, and a circuit diagram. The PIC16F628A microcontroller is programmed to count the input frequency and transmit
it serially to the serial port. The micro controller is powered
by the signals of the serial port, so no external power supply is
needed. The counter is 20 bit transmitted by the UART in 3 bytes. The crystal
can be changed to a ceramic resonator if accuracy isn't essential.
You can read more about serial interface in http://www.beyondlogic.org/spp/serial.htm
Code is for MPLAB, MPLABX and compilers HI TECH or XC8.

The VB 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 RS242 input.
Pin 12 is the frequency input, input signal has to be TTL type.
Pin 8 is the UART output, it transmits the 20 bit count in three bytes in RS232 format. When pin 8 is high both transistors conduct and voltage at pin 2 of serial port is at -9V.
The other pins are not in use but must be left open circuit. |