Micro-Controller 8051: data acquisition and control system


ShoutMix chat widget
Sunday, September 13, 2009
Programmable Frequency meter
This project is for measuring frequency of a digital signal. The project offer programmable selections and have many interesting features, below is a short summary of the working features of this project.:

  1. It measures frequency directly.
  2. By changing sampling or counting time , we can count pulses.
  3. Auto resets after completing one counting time.
  4. Displays the result for 2 Secs to note the number of pulses in that time.
  5. Auto zeros, and start re-counting.
  6. It allows manual operation like; start counting, Stop counting, reset to zero.
  7. It allows user to change the time preset values of 0.1 Sec, 0.5 Sec, 1.0 Sec, 5.0 Sec, 10.0 Sec, 30.0 Sec, 60.0 Sec, and 120.0 Sec.
  8. Easy to change to use different operations of counter.
Construction of Programmable Frequency and pulse counter.
This project have multi-task and general purpose digital pulse counter, and can be simply called counter/ timer. The construction of this counter/ timer involves as under:


  1. Micro-controller 8051 family, in this project i used at89c51 but any 8051 family microcontroller can be used.
  2. Multiplexed Seven Segment display (common anode) with six digit display is used.
  3. The Seven segments are directly controlled and interfaced with port 0 of micro-controller.
  4. Selection of digits is made with port 2 of at89c51 micro-controller.
  5. As port P0 do not have internal pull-up resistors, so at this port external pull-up resistor network or pack of 10K x 8 is used.
  6. In the schematic of counter / timer circuit , you will see, TTL 47ls04 inverter is used, it works fine, but if you feel the brightness of display is slightly low, then you can replace this with any general purpose PNP transistor.
  7. To start and stop counting, a digital gate is used , this is formed with TTL 74ls08, the AND GATE, which have two inputs and one output. One of the input is connected to microcontroller port pin P3.2 and other is input of signals. when counting is started P3.2 goes to logic 1 (digital logic 1 means +5V). So the pulses now reached to port pin P3.3 of micro-controller. Which external Interrupt 1, the microcontroller 8051 external interrupt is used to count the incoming pulses.
  8. When stop counting function is active, P3.2 goes to logic low, and now no-longer pulses can reach to controller.
  9. Crystal used in this project is 11.0592.
  10. The counter/ timer can be attached to computer (PC) with RS-232 interface.
  11. The counter/ timer send result after each cycle (counting time ) to PC via serial port at Baud rate of 9600.
  12. Hyper terminal can be used to view to save the incoming results on PC.

Main sub routines of the program written in keil C51 are as follows.

unsigned char digit,buffer[6],sec100,flag1,delay,nt;
unsigned char valu[6],sendtopc[18],msec,rmsec,tsec,rtsec,hhh;
char key;
unsigned char convert[10] = {0x28,0xee,0x49,0x4a,0x8e,0x1a,0x18,0x6e,0x08,0x0a};//afgb.dec
bit setting,held,sendnow;
sbit counts = P3^2;
void pause(int);
void scanLED();
void converter();
void freq();
void timer1 (void);
void extrint (void);
void seril(void);
void slect(void);
void timedisplay(void);
void startcounts(void);
void stopcounts(void);
void resetcounts(void);
void keyexe();
void keydelay();
void main(void)

{
sendtopc[0] = 0x54;//T
sendtopc[1] = 0x3d; //=
sendtopc[2] = 49; //1
sendtopc[3] = 50; //2
sendtopc[4] = 48; //0
sendtopc[5] = 0x2e; //.
sendtopc[6] = 48; //0
sendtopc[7] = 0x20; //SP
sendtopc[8] = 0x43; //C
sendtopc[9] = 0x3d; //=
sendtopc[10]= 0x54;
sendtopc[11]= 0x54;
sendtopc[12]= 0x54;
sendtopc[13]= 0x54;
sendtopc[14]= 0x54;
sendtopc[15]= 0x54;
sendtopc[16]= 0x0d;
sendtopc[17]= 0x0a;
setting = 1;
sec100 = 0;
rmsec = 120;
rtsec = 10;
msec = 0;
tsec = 0;
EA = 1;
TH1 = 0xfd; //(At 11.0592MHz) 0xf4 for 2400 and fd for 9600
TMOD = 0x21;
IT1 = 1;
EX1 = 1;
ET0 = 1;
TR1 = 1;
TR0 = 1;
hhh = 0;
held = 0;
sendnow = 0;
nt = 0;
counts = 1;
ES = 1;
SCON = 0x52;

while(1)
{
if(setting)
{
if(msec>=rmsec)
{
msec=0;
tsec ++;

if(tsec>=rtsec)
{
tsec=0;
counts=0;
held=1;
sendnow=1;
}
}

converter();

if(sendnow)seril();

if(held)
{
msec=0;tsec=0;sec100=0;
if(hhh>=254)
{
held=0;hhh=0;
valu[0]=0;valu[1]=0;
valu[2]=0;valu[3]=0;
valu[4]=0;valu[5]=0;
}
}
}
// else timedisplay();
scanLED();
keyexe();
keydelay();


}
}
void freq ()
{
if(held){hhh++; counts=0;}
else {sec100++;counts=1;}
if (sec100 >= 10) // 100 * 10 ms = 1 s //
{
msec++;
sec100 = 0;
}
}

void converter ()
{
unsigned char l;
for( l = 0; l <>

{ buffer[l]= convert [valu[l]]; } }

External Interuppt EX1, Timer T0 and T1 with serial Interruppt are used in this project.


Mobile Phone Prices

↑ Grab this Headline Animator

Labels: , , , , ,

posted by Dr.Rana @ 8:19:00 PM   2 comments
The On Demand Global Workforce - oDesk

Previous Post
Archives
data acquisition and control system, what is DAQ, what is DA&C system, what are the components of DA&C system, how to interface a pressure sensor to micro-controller, data acquisition and control system, how measure pressure with 8051 microcontroller, ENCODERS used in Speed measurements, what is the difference in two terms transducer and sensor, what are the basics of transducers and sensor, Timing And Pulsing, More on Alphanumeric Character Addresses, compect transducer used for presure measurements, SCANNING KEYPADS, Software Design, Scan Decimal Subroutine, Using Keypad And LCD With PIC Microcontroller, Debounce,Function Keys, Serial In, Parallel Out, Shift Register 74HC164,Parallel In, Serial Out Shift Register - 74HC165,Fill Display With Blanks Display "HELLO", LCD Initialization, Character Addresses, , Display 16 Characters, Serial In, Parallel Out, Shift Register 74HC595, what are the advancments in pressure sensors?, which are easy and compect transducer used for presure measurements, RFID Based Bus Station Monitoring System, information of heart beat monitor (8051 BASED), need circuit pbx using 8051, MIC-89C51 MONITORING SYSTEM, wave 8051, circuit design of interfacing of ADC0808 with at89c51 in PROTEUS software, print printer to microcontroller interface, furnace system, Micro-controller project builder and free lancer, free lance job of micro-controller, electronics jobs free lance, hire me for design and development of microcontroller automation inductry projects, analog and digital project free lancer, hire a coder for data loging and control, hire a coder for 8051 data acquisition projects

  • Name: Dr.Rana
  • Home:
  • About Me: FreeLancer, work for other , help to students to develop their degree projects, Researcher and learner
  • See my complete profile
Links
  • How to manage it
  • Home
  • PIC microcontroller
  • Electronics course
  • Mobile Prices
  • Network
  • Example programs in Keil C51

    SENSORs and TRANSDUCERs

    interfaces with MICROCONTROLLERs

    LCDs Interface with Microcontroller

    C++ Programs for computer INTERFACE

    PROGRAMMERS

    Powered by Blogger

    Subscribe to
    Posts [Atom]

    Add to Google Reader or Homepage

    About Blog
    This website is formed to help the students and designers to develop their projects with microcontroller. Electronics projects using 8051 family Microcontrollers. RS 232,RS 485,LM35,LM335,LM331, Frequency meter,ADC 0804,ADC0809,DAC08, KEY BOARD,DAQ matrix interface,I2C EEPROM 24c08,ADC12130,DCF77,LCD 2lines, 4 lines 80 characters etc codes and circuit diagrams. Copmuter Interface using serial port, printer or parallel port and USB port.
    Title
    SERIAL port,printer port, parallel port,PLC, Programable logic control, microcontroller, ATMEl, INTEL, 8051 family, At89s51, At89c51, At89c2051, clock, example program in c language,make your own projects with microcontroller, Home made project, student degree projects, keil c51, Stepper motor code,software, hardware, PID logic and algorithm, motion control, Industry requirment, Transducer, sensor, pressure, temperature, humidity, Hight voltages, CT scan,MRI, AT89S51, AT90S8535, ATmega128, Atmel ATmega, Atmel AVR, ATtiny12, CPLD, FPGA, Microchip PIC,PWM Using A Filter With Unity Gain Follower,PWM Using Software, MR0 And Interrupts ,8-Bit Serial D/A Converter - MAX522,Arithmetic Addition, Subtraction, Multiplication,Double Precision , Addition,Subtraction,Multiplication, 3-digit decimal to 8-bit binary, 16-bit binary to 5-digit BCD conversion, Displaying temperature via a LCD, Clock oscillator options, parallel port programmer, serial programmer, USB programmer of microcontroller
    Templates by
    Free Blogger Templates

    Diagnostic X-Ray Machine,PET,CT scanner

    ↑ Grab this Headline Animator