当前位置:网站首页>Blue Bridge Cup SCM module code (timer) (code + comments)
Blue Bridge Cup SCM module code (timer) (code + comments)
2022-06-25 06:44:00 【tuygre】
/* The explanation in the previous chapter will not be repeated */
#include "STC15F2K60S2.H"
typedef unsigned char u8;
typedef unsigned int u16;
u8 count,led;
void close()
{
P0=0XFF;
P2=P2&0X1F|0X80;
P2=P2&0X1F;
P0=0;
P2=P2&0X1F|0XA0;
P2=P2&0X1F;
}
void open()
{
ET0=1;
EA=1;
}
/* Allow timer to interrupt */
void lighten(u8 led)
{
P0=~led;
P2=P2&0X1F|0X80;
P2=P2&0X1F;
}
void Timer0Init(void)
{
AUXR &= 0x7F;
/* register AUXR The first 7 Location 0, Indicates a timer 0 take 12 Frequency division mode */
TMOD &= 0xF0;
/* register TMOD low 4 Location 0, Said the use of 16 Bit auto reload mode , Used as a timer , Not subject to INTO Pin control */
TL0 = 0x00;
TH0 = 0x4C;
/* Set the initial value */
TF0 = 0;
/* Overflow sign TF0 Zero clearing */
TR0 = 1;
/* Timer 0 Turn on */
}
/* System frequency 11.0592MHZ Hour timing 50ms, Can pass STC-ISP Automatic generation , Here is a brief explanation , Please refer to the user manual for details 7.1 Other parts , Do not repeat */
void main()
{
close();
open();
Timer0Init();
while(1)
{
lighten(led);
}
}
void stop1() interrupt 1
{
count++;
if(count==20)
{
led++;
count=0;
}
}
/* Every time 1S Parameters led Add one to the value of , Corresponding lighten Within the function LED Light on / off change */Official schematic diagram , The download address of the user manual is as follows :
link :https://pan.baidu.com/s/1y8lRYHxLKojL4_r0PZPYRw
Extraction code :19so
Note cannot insert picture , Relevant information readers themselves look for in the folder .
Study notes for undergraduate students of Nanjing University of Information Engineering , For your reference .
If there is a mistake , contact QQ3182097183.
边栏推荐
- Uncaught typeerror cannot set properties of undefined (setting 'classname') reported by binding onclick event in jsfor loop
- Which of the top ten securities companies has the lowest Commission and is the most safe and reliable? Do you know anything
- Why did Yanjing Beer come here?
- TCP BBR as rate based
- Learn the first routine of FPGA
- keil debug查看变量提示not in scope
- The "&" character will destroy the data stored in the web The "&" character breaks passwords that are stored in the web config
- Ht81293 built in adaptive dynamic boost 20W mono class D power amplifier IC solution
- Report on development status and investment strategy recommendations of global and Chinese graphite polystyrene board industry 2022-2028
- JS to determine whether an element exists in the array (four methods)
猜你喜欢

Single lithium battery 3.7V power supply 2x12w stereo boost audio power amplifier IC combination solution

keil debug查看变量提示not in scope

3dmax软件的制作木桶过程:三步流程

原子Alpha开发板--SD卡和emmc烧录工具

Cs8683 (120W mono class D power amplifier IC)

了解zbrush雕刻软件,以及游戏建模的分析

Message queue table structure for storing message data

Uncaught TypeError: Cannot read properties of undefined (reading ‘prototype‘)

TCP BBR as rate based

The process of making wooden barrels with 3DMAX software: a three-step process
随机推荐
The "&" character will destroy the data stored in the web The "&" character breaks passwords that are stored in the web config
Derivation of sin (a-b) =sina*cosb-sinb*cosa
How do I check swift if two arrays contain the same elements, regardless of the order in which they appear?
ACWING/2004. 錯字
cos(a-b)=cosa*cosb+sina*sinb的推导过程
Direct select sort and quick sort
Hongmeng learning notes: creating layouts using XML
アルマ / alchemy girl
Keil debug view variable prompt not in scope
使用OpenGL绘制shp文件
Uncaught TypeError: Cannot read properties of undefined (reading ‘prototype‘)
ASP. Net core - Safety of asynclocal in asp NET Core
How to realize hierarchical management of application and hardware in embedded projects
ACWING/2004. 错字
Analysis on the output, market scale and development status of China's children's furniture industry in 2020 and the competition pattern of children's furniture enterprises [figure]
燕京啤酒何以至此?
Is it safe to open a stock account on the Internet in Beijing?
Query JSON data in MySQL table
[ros2] Why use ros2? Introduction to ros2 system characteristics
Cs4344/ht5010 stereo d/a digital to analog converter