Module 5 : Experiments on Microcontrollers

Lecture 40 : Frequency Divider Using AT89C51

 Aim To divide the given signal frequency applied at P3.5 by a digital value as obtained from Port-0 and output the signal through one of the port pins (say P1.0), i.e. OUT PUT_FREQ = (INP_FREQ) / (PORT0*2) Components/Software Atmel 89C51 micro controller 8051 simulator- win8051 Universal SP3 Programmer Software to load the code into Universal SP3 Programmer Computer System with Windows operating system and RS 232 Cable +5V D.C Power Supply SPST switches-1 Resistors-8.2k-1 Capacitors-30pF-2, 10uF-1 10MHz crystal Signal Generator and CRO Procedure Write the assembly code in win8051 simulator , compile it and check for errors Once the code is error free, run it and check the output. After checking the code in the simulator, the code (in .HEX format) was loaded into Atmel 89c51 microcontroller using Universal SP3 Programmer. Make connections as shown in the circuit diagram. Load some value into PORT0 by externally giving some digital input. Square wave of 0 to +5V is given to the Pin P3.5 (timer 1 external clock input.) Observe the signal at pin P1.0 in the CRO and ensure that it satisfies the formula (INP_FREQ)/(PORT0*2) Change the frequency of input square and observe the frequency of out put square wave and each time ensure that it satisfies the above formula.  (OUT PUT_FREQ = (INP_FREQ) / (PORT0*2) ) Method Timer-1 is used for dividing the input signal by a given number obtained from Port-0. Assembly Code Observations Since input square wave is used as Timer 1 external clock input see the external clock requirements in the datasheet of Atm8051. Conclusion Input signal frequency was divided by the following formula and out put the signal through pin P1.0. OUT PUT_FREQ = (INP_FREQ) / (PORT0*2) Circuit Diagram Fig  40.1 Circuit diagram for frequency divider experiment