Sunday, April 14, 2013

How to Convert 16-bit Binary digits to BCD for 8051

This post is simply showing how to convert Binary 16-bit to five BCD digits.  The routine's importance come from that 8051 is a 8-bit microprocessor so it can't handle data in 16-bits directly. The routine has many uses such as with arithmetic calculator or frequency meter.

As usual I put a bit detailed flowchart aside with the assembly code which is also come with full describing comments. Download links are given at the bottom of the post.


BIN2BCDFLOWCHART
010203


Downloads


To download code and flowchart click here

Friday, April 12, 2013

Digital Frequency Meter for 8051

A good use of the frequency counter is to calibrate other equipment. For example a signal generator that doesn't have its own digital display. The meter will show the exact frequency being produced by the signal generator.  Based on the 8051 microcontroller. It is assumed that you know how to interface LCD with the microcontroller.

Code, flowchart, schematic diagram and Proteus simulation is given in the ‘Downloads’ section at the bottom of this page. 

Firmware



  • This Program is to count frequency from T1 (P3.5), by using mode 1 Counter 16 bit.

  • Counter resets every 1 second that generated by timer 0, mode 1, timer 16 bit.

  • Every 1 second data will show on LCD Character.

  • The  assembly code is followed by detailed comments describe each routine

  • The flowchart below describing the concept and procedure.


Freq Meter

Hardware Schematic


All parts and components with full connection is shown below.

Capture2

Features



  • Minimum hardware with high accuracy

  • Sensitivity is perfect from 1 Hz to 500 KHz

  • Work and tested on most of periodic signals (Square, Sin, Saw tooth, .. )


Downloads


The code was compiled in Kiel uvision 4 and simulation was made in Proteus v7.8 SP2.
To download code , flowchart and proteus simulation click here