Single chip microcomputer output matrix wave experiment

Publisher:太白山人Latest update time:2012-11-06 Source: 21ic Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
The original intention of this program is to output a matrix wave, but if you run it with a microcontroller experimental board, you will find that it seems that P1^1 (that is, the second LED tube is always glowing) is not because of a problem with the program that makes it always on, but because the frequency of the pass segment is too fast for the human eye. According to the persistence of vision, it will appear that the LED is always on. I also had this suspicion at the beginning. You can modify the program to make the frequency of the pass segment lower, and you can see that it is actually always working. The program after the comment symbol is the modified program;

#include
#define uint unsigned int
#define uchar unsigned char
sbit D1=P1^1; //uint i=0;
void main()
{
TMOD=0x01;
TH0=(65536-50000)%256;
TL0=(65536-5000)/256;
EA=1;

ET0=1;
TR0=1;
while(1)
{
while(TF0==0) //if(TF0==0) i++;
{ //if(i==10)
D1=~D1; //{ D1 =~D1; }
}
}
}
void timer0() interrupt 1
{
TH0=(65536-5000)/256;
TL0=(65536-50000)%256;
}


After the change, the program becomes: But the timer overflows ten times and the interrupt runs, that is, twenty overflows are one cycle of this matrix wave.

Keywords:MCU Reference address:Single chip microcomputer output matrix wave experiment

Previous article:Summary of Single Chip Microcomputer Circuit Design
Next article:MCU Serial Communication - Character Array

Recommended ReadingLatest update time:2024-11-16 16:26

Design of Solar LED Street Light Controller Based on STC Microcontroller
Faced with the reality of the deteriorating ecological environment and the increasing shortage of resources, governments around the world have adopted many policies and measures to vigorously support and develop energy-saving and environmental protection industries. Solar LED street lights are a comprehensive applicat
[Power Management]
Design of Solar LED Street Light Controller Based on STC Microcontroller
Design of temperature monitoring system based on single chip microcomputer and PC
    This paper introduces the design of a temperature monitoring system based on a single-chip microcomputer and a PC. The temperature sensor uses DS18B20. The lower computer uses an AT89S52 single-chip microcomputer, which can display temperature and over-limit alarm. The PC, as the host computer, sets the upper and
[Microcontroller]
Design of temperature monitoring system based on single chip microcomputer and PC
51 Single Chip Microcomputer (Twenty-Seven) - Buzzer plays music
1. Introduction to experimental principles Buzzers are commonly used sound-generating devices in circuits. We usually use buzzers to make "beep" sounds as prompts. Have you ever thought that you can also use buzzers to play music? This is obviously a very interesting thing. This article uses a buzzer to play music.
[Microcontroller]
51 Single Chip Microcomputer (Twenty-Seven) - Buzzer plays music
C51 Programming of External Interrupts of 51 MCU
I got stuck when learning about interrupts. First, I couldn't understand the two triggers, and now I can't write the right query. Maybe I'm not calm and haven't thought about why it doesn't work? I'll learn from the Internet! I'm getting lazier and lazier. The following comes from the website: http://bbs.cepark.com/fo
[Microcontroller]
51 MCU Learning Notes 3 -- Key Input Detection
1. Drawing of key schematic diagram The schematic diagram of the 51 development board is as follows Draw the circuit diagram according to the schematic diagram 2.Key input detection 1. Key software debounce Buttons generally utilize the closing and opening functions of mechanical contacts. Due to the elastic effe
[Microcontroller]
51 MCU Learning Notes 3 -- Key Input Detection
CAN and CAN FD for different automotive applications
Due to the higher bandwidth requirements in the automotive sector, the CAN (Controller Area Network) specification was extended to flexible data rate and the new iteration is called CAN FD. CAN has advantages such as cost, flexibility and robustness, all of which are very beneficial for non-automotive applications i
[Automotive Electronics]
CAN and CAN FD for different automotive applications
Application plan of low-frequency ultrasonic skin penetration promoting system based on C8051F340 microcontroller
Transdermal drug delivery systems have become an emerging and important means in the medical field. Transdermal drug delivery is a method in which drugs are absorbed through the skin and capillaries into the systemic circulation to produce drug effects. It can avoid the first-pass effect of the liver, extend the thera
[Microcontroller]
Application plan of low-frequency ultrasonic skin penetration promoting system based on C8051F340 microcontroller
Microcontroller that combines Hi-Fi, intelligence and USB multi-channel features
With the continuous integration of many technological breakthroughs and new streaming services, and the growing prosperity of the smart home and smart speaker markets, consumers' demand for audio is no longer limited to sound quality itself, but more about pursuing high-quality life experience and convenient smart i
[Embedded]
Microcontroller that combines Hi-Fi, intelligence and USB multi-channel features
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号