Microcontroller Learning Notes (II) - Simple Applet

Publisher:TranquilSilenceLatest update time:2024-08-19 Source: cnblogsKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Today I got a few simple programs for the microcontroller:


Delay program:

void Delay(unsigned int xx) //Input xx: ms

{

while(xx--)

{

Delay1ms();

}

}


void Delay1ms() //@11.0592MHz 1ms

{

unsigned char i, j;


_nop_();

_nop_();

_nop_();

i = 11;

j = 190;

do

{

while (--j);

} while (--i);

}


Flowing lights program:

#include


int main()

{

p1 = 0xfe;

while(1)

{

p1 = _crol_(p1, 1);

Delay(500);

}

return 0;

}

Buzzer program:

void BEEP_ON() //Buzzer on, duration: 500ms,

{

sbit beep = p2 ^ 3;

beep = 0; //Buzzer on

Delay(500); //Delay

beep = 1; //Buzzer off

}


Keywords:MCU Reference address:Microcontroller Learning Notes (II) - Simple Applet

Previous article:Microcontroller Study Notes (I)
Next article:51 Development Environment Construction--KeilC51 Installation and Project Creation

Recommended ReadingLatest update time:2024-11-22 21:53

How to use Keil5 to develop 51 series microcontrollers
Usually, we use keil5 to develop 32 and keil4 to develop 51. But it is too cumbersome to switch versions. Here is a method to make keil5 compatible with 51 programs. Only for the keil5 series that have been xx! 1. Download C51 related dependency packages Download from the official website (Or use the link provide
[Microcontroller]
How to use Keil5 to develop 51 series microcontrollers
【Hardware】PIC32 microcontroller programmer and line sequence description
1. PIC32 microcontroller programmer, use Pckit3 to program. As shown below 2. The line sequence of the emulator end is as follows: Note: LVP is connected to GND on the board and VSS 3. On-board connector As shown below, the MCU schematic diagram is attached 4. Burning steps: 1) Import 2) Programmer-select to
[Microcontroller]
【Hardware】PIC32 microcontroller programmer and line sequence description
PIC15C5X Basic 8-bit MCU
PIC15C5X basic 8-bit microcontroller Typical chips (1) PIC16C52 microcontroller This is an 18-pin microcontroller chip. Except for the following points, it is the same as the PIC16C54 chip. . 348X12-bit EPROM prog
[Microcontroller]
PIC15C5X Basic 8-bit MCU
Design of 16x64 dot matrix LED display screen based on single chip microcomputer
0 Introduction LED dot matrix display is a simple Chinese character display, which is cheap, easy to control, and has a long service life. It can be widely used in various public places, such as stations, docks, banks, schools, trains, buses, etc. This article introduces the design process of a low-co
[Microcontroller]
Design of 16x64 dot matrix LED display screen based on single chip microcomputer
54-Home fire and burglar alarm system based on 51 single chip microcomputer GSM module
Specific implementation functions The system consists of DS18B20 temperature sensor + MQ-2 smoke sensor + HC-SR501 human infrared module + SIM800C GSM module + LCD1602 display. (1) It can detect ambient temperature, smoke, fog and human body signals and display them on the display screen; (2) The alarm value can b
[Microcontroller]
54-Home fire and burglar alarm system based on 51 single chip microcomputer GSM module
Design and application of time-triggered multi-task scheduler based on AVR microcontroller
1 Introduction In recent years, embedded systems have developed rapidly, and the event-triggered programming method using the 51 single-chip microcomputer dead loop has gradually failed to meet the requirements of enterprises for product stability and security. At present, embedded system software includes VxWork, Lin
[Microcontroller]
Design and application of time-triggered multi-task scheduler based on AVR microcontroller
MCU Second Assignment
Homework: Enlarge A tenfold (the value of A is small and does not overflow)   . There are many methods for this problem. According to the materials, there are three methods. They are listed one by one below. (Since this problem is so complicated, please give it a good review! ) Of course, it is still necessary
[Microcontroller]
MCU Second Assignment
Realization of gas frequency conversion transmission and distribution and accurate measurement based on PSoC microcontroller
In the frequency conversion transmission and metering of gas, the gas metering instrument with a large flow range composed of ordinary single-board computer/single-chip computer and the one-device multi-control automatic frequency conversion speed regulation transmission and distribution system realized by industria
[Microcontroller]
Realization of gas frequency conversion transmission and distribution and accurate measurement based on PSoC microcontroller
Latest Microcontroller Articles
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号