Simulation Design of AVR Single Chip Microcomputer Marquee

Publisher:SereneDreamerLatest update time:2019-11-11 Source: 51heiKeywords:AVR Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Simple marquee design.

The simulation schematic based on AVR microcontroller is as follows:

The microcontroller source program is as follows:

/********************************************************************

                            Huicheng Technology

*************************************************************************/

#include

/******************************************************************************

                                  Function data type description                                                                   

**************************************************************************/

#define uchar unsigned char 

#define uint unsigned int

/******************************************************************************

                                  MS level delay function program, parameter i delay time                                                                           

**************************************************************************/

void DelayMS(uint i)

{

uint j;

for(;i!=0;i--)

{

for(j=8000;j!=0;j--);

}

}

/******************************************************************************

                                  The marquee program lights up the corresponding LEDs based on the number of steps run.

                                  Low level turns on LED                                                                           

**************************************************************************/

void horse(uchar i)

{switch (i)

{

case 0:PORTA=0X00;break;//0000 0000B turns on LED1~LED8

case 1:PORTA=0X01;break;//0000 0001B turns on LED2~LED8

case 2:PORTA=0X03;break;//0000 0011B turns on LED3~LED8

case 3:PORTA=0X07;break;//0000 0111B turns on LED4~LED8

case 4:PORTA=0X0f;break;//0000 1111B turns on LED5~LED8

case 5:PORTA=0X1f;break;//0001 1111B turns on LED6~LED8

case 6:PORTA=0X3f;break;//0011 1111B turns on LED7~LED8

case 7:PORTA=0X7f;break;//0111 1111B turns on LED8

case 8:PORTA=0Xff;break;//1111 1111B all off

default:break;

}

}

/******************************************************************************

                                   Main function                                                           

**************************************************************************/

void main(void)

{

uchar i;

DDRA=0XFF; //Port setting, PA port is set to push-pull 1 output

PORTA=0XFF;

PORTA=0XFF; //PORTA is initialized to 1, turn off all LEDs

DelayMS(10);

while(1) //Program executes unconditionally

{

for(i=0;i<9;i++)

{

horse(i);

DelayMS(10); //Delay time is about 10MS

}

……………………



Keywords:AVR Reference address:Simulation Design of AVR Single Chip Microcomputer Marquee

Previous article:Let the 12864 LCD module display smaller text 5*8 dot matrix
Next article:AVR microcontroller infrared remote control key value decoding experiment

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

MCU binary code comparison
Binary coding In computers, binary numbers are used. Therefore, the numbers, letters, and symbols to be represented in the computer are represented by binary codes, which is binary coding. 1. Binary-coded decimal numbers: BCD code (Binary-Coded Decimal) Encoding of letters and characters Letters and various characters
[Microcontroller]
The basic framework of C language programming for PIC microcontroller
Introduction: The basic framework of C language programming for PIC microcontrollers The basic method of writing PIC microcontroller programs based on the PICC compilation environment is similar to that of standard C programs. The program generally consists of the following main parts: 1. Use the #include preproce
[Microcontroller]
A must-read for beginners (STC89C52) A simple implementation of a single-chip Bluetooth four-wheeled car that can track and avoid obstacles
1. Material selection            1. L289 drive motor x2 2.1.5V battery (you can buy rechargeable batteries, I have used dozens of batteries!!!) I use 8 1.5v batteries to form a 12v battery to power 4 motors separately, and another 3 1.5v batteries to power the microcontroller. 4.5v is similar to 5v. 3. Base plate plus
[Microcontroller]
STC12C5A60S2 MCU simple implementation of DHT11 source program
There are many programs on the Internet that implement DHT11, but most of them are about 89c52. There are very few about stc12c5a60s2. I am a novice. When I was writing about stc12 serial port receiving dht11 data, I found that all the received data were 0. Why is this? After searching a lot of information online, I
[Microcontroller]
Multi-point temperature and humidity measurement and control system of tobacco flue-curing room based on single chip microcomputer
0 Introduction Whether the temperature and humidity of tobacco leaf baking process can be accurately measured and controlled determines the quality of tobacco leaves. Traditionally, the dozens of hours of tobacco leaf baking process are generally completely monitored manually, using wet-bulb glass thermometers t
[Microcontroller]
Multi-point temperature and humidity measurement and control system of tobacco flue-curing room based on single chip microcomputer
A collection of typical MCU essay competition questions (Part 2)
Microcontroller Paper III Practical Low Frequency Power Amplifier   1. Mission   Design and manufacture a low-frequency power amplifier with weak signal amplification capability. The schematic diagram is as follows:   II. Requirements   1. Basic requirements   (1) When the sinusoidal signal input voltage
[Analog Electronics]
A collection of typical MCU essay competition questions (Part 2)
SN 8-bit MCU SN8P2743 Application Practice (3)
Immediately following (2) initial test of the comparator of SN8P2743: Next, test the comparator 1 which can be used with one pin. The CM1M register that selects the internal reference through software is as follows: 09DH Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 CM1M CM1EN CM1OEN CM1OUT CM1SF CM1G CM1RS2 C
[Microcontroller]
SN 8-bit MCU SN8P2743 Application Practice (3)
Interface between microcontroller and MMC card
The media card MMC (MultiMedia Card) is a multifunctional memory card jointly developed and launched by SanDisk of the United States and Simens of Germany in 1997. It has a built-in control circuit and can be used in a variety of digital devices such as mobile phones, digital cameras, MP3, PDA, etc. It can record re
[Microcontroller]
Interface between microcontroller and MMC card
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号