ATmega8535L Marquee Program (ICC Compiler)

Publisher:真诚友爱Latest update time:2017-12-13 Source: eefocusKeywords:ATmega8535L Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

ATmega8535L Marquee Program

//*********************ICCAVR V6.30 compilation**********************// 

#include //Header file, register definition of AT90S8535 microcontroller

#define uchar unsigned char //Data type description 
#define uint unsigned int //Data type descriptionvoid 

DelayMs(uint i) //Ms level delay function, parameter i: delay time 
{uint j; 
 for(;i!=0;i--) 
  {for(j=8000;j!=0;j--) ;} 


void Horse(uchar i) //Marquee program, light up the corresponding LED through step judgment 
{switch(i) //High level lights up the LED 
 {case 1:PORTA=0x01;break; //0000 0001B lights up LED1 
  case 2:PORTA=0x03;break; //0000 0011B lights up LED1~LED2 
  case 3:PORTA=0x07;break; //0000 0111B lights up LED1~LED3 
  case 4:PORTA=0x0f;break; //0000 1111B Light up LED1~LED4 
  case 5:PORTA=0x1f;break; //0001 1111B Light up LED1~LED5 
  case 6:PORTA=0x3f;break; //0011 1111B Light up LED1~LED6 
  case 7:PORTA=0x7f;break; //0111 1111B Light up LED1~LED7 
  case 8:PORTA=0xff;break; //1111 1111B Light up LED1~LED8 
  default:break;} 


void main(void)                
{uchar i; 
 DDRA=0xff; //Port setting: PA port is set to push-pull 1 output 
 PORTA=0xff; 
 PORTA=0x00; //PORTA initial value is 0, turn off all LEDs       
 DelayMs(1000); 
 while(1) //Program is executed unconditionally 
  { for(i=0;i<9;i++) //Light up LED1~LED8 in sequence 
      {Horse(i); 
       DelayMs(1000);} //Lighting time is about 1 second 
    for(i=7;i!=0;i--) //Turn off LED8~LED1 in sequence 
      {Horse(i); 
       DelayMs(1000);} //Turn off time is about 1 second 
  } 


Keywords:ATmega8535L Reference address:ATmega8535L Marquee Program (ICC Compiler)

Previous article:AVR MCU bus voice announcement system program
Next article:ATmega8535L Eeprom Example Program

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号