All Item Include
uC 8051 makes effective frequency counter
by: Fazal Pathan, Physical Research Laboratory, Ahmedabad, India
Figure 1 shows an efficient and costeffective frequency counter using an Atmel 89C2051 mC Reference 1). The design can use any mC of the 8051 family. The circuit counts frequency and sends the count to a PC via the serial port. The signal connects to pin 3.4 of the mC. The TTL-compatible output of the mC drives the 1488, which converts the output to RS-232 voltage levels. The output of the 1488 connects to the RxD pin on the serial port of the PC. In this design, only unidirectional communication exists between the mC and the PC. But you can use the TxD line to control another device.The assembly routine in Listing 1 shows initialization of the timer, counter, and interrupts. The main program sets up T0 to count external pulses and T1 to count time in the autoreload mode 2 (Reference 2). The main program monitors the main-program flag, frqflg, until the flag is set. Then, the main program sends the counted frequency to the PC’s port using mode 1. First, it sends the special character “L” to recognize the following 3 bytes as valid data. Then it sends the value of register R2, which is the most significant byte of the counter value. This value increments every time the counteroverflows.Then, the main program sends the values of registers TH0 and TL0 to the PC’s port. After sending the data, the program again jumps to the main routine, in which it clears the timer and counter and reinitializes them, and then starts counting again. The mC counts the value in hexadecimal format; the PC can then convert it to decimal format. In this example, we used a 12-MHz crystal and a baud rate of 2400 bps.However, you can use higher clock frequencies and baud rates, because the mC can operate to 24 MHz.We use the system in Figure 1 for photon counting in astronomical instrumentation.We give thanks to the Department of Space,Government of India, for material support and BG Anandarao,PhD, for encouragement.
( Download File : frequency1.zip )
;program counts the pulse and transmite trhough p3.1 pin only