Motor speed measurement control program based on 8051 single chip microcomputer

Publisher:HaifeengLatest update time:2012-09-25 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

With the single-chip microcomputer 8031 ​​as the core, the 8279 chip is used to realize key input and the digital tube is used to display the measured speed. The input voltage analog quantity is converted into digital quantity by ADC0809 (the relevant interface has been connected inside the experimental box) to control the motor speed. Then, the sensor on the motor is connected to the CKMOT interface of DA0832 to connect the pulse signal to INT0 of 8031. The speed is measured by external interrupt. One external interrupt will automatically increase the speed counter by one. The timer is used to generate a one-second timing. The value of the speed counter within one second can be obtained to get the speed of the motor. In addition, the timing counter generates a timer interrupt every 250MS, and the interrupt is used to detect whether there is a new control signal input to achieve the purpose of real-time speed control.

ORG 0000h
ajmp main
ORG 0003h ;External interrupt 0
AJMP ZS
ORG 000BH ;Timer counter 0 interrupt
AJMP JS
ORG 0100H
main: mov sp,#60h
CLR PSW.5 ;Clear flag bit
SETB P1.0 ;Set detection bit
setb et0
SETB IT0 ;External interrupt 0 falling edge valid
SETB EX0 ;Enable T0 interrupt
mov DPTR,#5FFFH ;8279 initialization
MOV A,#0DCH
MOVX @DPTR,A
WAIT: MOVX A,@DPTR
JB ACC.7,WAIT
MOV A,#00H
MOVX @DPTR,A
MOV A,#34H
MOVX @DPTR,A

MOV R0,#30H ; Clear the used value buffer
CL: MOV A,#00H
MOV @R0,A
INC R0
CJNE R0,#36H,CL
MOV 36H,#200
MOV 37H,#20
ACALL DIR
TIME: MOV TMOD,#02H ; One second timer
MOV TH0,#6
MOV TL0,#6
SETB TR0 ; Enable T0 interrupt
SETB EA

LOP2: JNB PSW.5,LOP3
CLR PSW.5
ACALL DIR ;Display the speed in one second
JMP LOP2
LOP3: MOV DPTR,#9FF4H ;Start a/d
MOVX @DPTR,A
;ACALL DELAY1
JB P1.0, $
MOVX A,@DPTR
MOV DPTR,#7FFFH ;Start d/a
MOVX @DPTR,A A
JMP LOP2

JS: PUSH ACC;T0 interrupt subroutine
DJNZ 36H,OUT
DJNZ 37H,next
ajmp next1
next: MOV 36H,#200
ajmp out
next1:SETB PSW.5
MOV 33H,30H
MOV 34H,31H
MOV 35H,32H
MOV 30H,# 0
MOV 31H,#0
MOV 32H,#0
MOV 36H,#200
MOV 37H,#20
OUT: POP ACC
RETI

ZS: PUSH ACC;External interrupt subroutine
CLR EX0
MOV A,30H
ADD A,#1
DA A
MOV 30H,A
CJNE A,#99H,OUT1
MOV 30H,#0
MOV A,31H
ADD A,#1
DA A
MOV 31H,A
CJNE A,#99H,OUT1
MOV 31H,#0
MOV A,32H
ADD A,#1
DA A
MOV 32H,A
OUT1: SETB EX0
POP ACC

RETI

DIR: MOV R0,#33H
MOV DPTR,#5FFFH
MOV A,#92H
MOVX @DPTR,A
MOV R2,#03H
LED: MOV A,@R0
ANL A,#0FH
MOV DPTR,#LEDTAB
MOVC A,@A+DPTR
MOV DPTR,#5EFFH
MOVX @DPTR,A
MOV A,@R0
SWAP A
ANL A,#0FH
MOV DPTR,#LEDTAB
MOVC A,@A+DPTR
MOV DPTR,#5EFFH
MOVX @DPTR,A
INC R0
DJNZ R2,LED
RET

LEDTAB:DB 0c0H,0f9H,0a4H,0b0H,99H,92H,82H,0f8H,80H,90H

DELAY1: MOV R6,#5
DELAY2: MOV R7,#200
DJNZ R7,$
DJNZ R6,DELAY2
RET

END

Reference address:Motor speed measurement control program based on 8051 single chip microcomputer

Previous article:Design and simulation of LED Chinese character display screen based on AT89C51 single chip microcomputer
Next article:Summary of the design and production of electronic temperature alarm based on single chip microcomputer

Recommended ReadingLatest update time:2024-11-16 17:37

Automatic Upgrade of FLASH Program of C8051FXXX MCU
introduction: The C8051FXXX series of high-speed SOC microcontrollers are fully integrated mixed-signal system-level chips developed by Cygnal Corporation of the United States. They have a microprocessor core compatible with 8051, an internal integrated FLASH program memory, and the ability to reprogram in
[Microcontroller]
Automatic Upgrade of FLASH Program of C8051FXXX MCU
Spinning Tension Monitoring System Based on LabVIEW and C8051F350
0 Introduction Yarn tension is an important parameter that affects product quality and processing efficiency during spinning, false twisting and other processing processes. The greater the fluctuation of yarn tension, the worse the product quality, and it will affect the appearance and comfort of the subsequent
[Test Measurement]
Spinning Tension Monitoring System Based on LabVIEW and C8051F350
Design of automobile test system based on C8051F and Zigbee wireless network
Abstract: With C8051F020 as the core processor, a wireless sensor network data acquisition system is designed. The system uses SZ05-ADV wireless communication module to build a Zigbee wireless network, and combines the software and hardware technology of the embedded system to complete the data acquisition of 8-channel
[Microcontroller]
Design of automobile test system based on C8051F and Zigbee wireless network
What kind of structure does the memory organization of 8051 microcontroller use?
Question: What kind of structure does the memory organization of the 8051 microcontroller adopt? How is the memory address space divided and what is its capacity? How is it used and what are its capacity? What are its characteristics in use? Answer: (1) Structural characteristics of the 80C51 The 80C51 adopts a struc
[Microcontroller]
Constant temperature box temperature control system based on C8051F
Introduction Thermostatic chambers can be divided into low-temperature (below room temperature) thermostatic chambers and high-temperature (above room temperature) thermostatic chambers according to the control temperature . The heating control thermostatic chamber is a type of high-temperature thermostatic chamber,
[Microcontroller]
Constant temperature box temperature control system based on C8051F
8051 microcontroller interrupt system structure and interrupt control principle
When several interrupt sources request interrupts from the CPU at the same time, they are queued according to the priority of the real-time events that occur, and the interrupt requests for the most urgent events are processed first, so the microcontroller specifies the priority level of each interrupt source. When
[Microcontroller]
Traffic light program for 8051
A simple traffic light experiment   #include reg52.h #define uchar unsigned char  #define uint unsigned int #define MAX 30 //The time when the red light is on #define YELLOW 6 //The time when the yellow light is onuchar code num ={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; //Segment selection code of
[Microcontroller]
C8051F330 Flash Access Unit
Introduction: A small program I wrote recently, contributing to your reference. C8051F330 Flash access unit. You can make the header file yourself, I won’t post it here. Remember to erase it first when writing Flash. code show as below /* 02 =======================================================================
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号