AVR microcontroller proteus simulation lesson 3: single digital tube

Publisher:天涯拾遗Latest update time:2017-01-11 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Select 7SEG-MPX1-CC for the digital tube, a common cathode digital tube. That is, low level selection (rightmost pin), the 8 pins on the left side of the digital tube, from left to right, from low to high, are connected to PC0---PC7 respectively.

 

The c program is as follows:

#include
#include

#define int8u unsigned char
#define int16u unsigned int

const int8u seg_code[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};

int main()
{
int8u i=0;
DDRC=0xff;
while(1)
{
PORTC=seg_code[i];
i=(i+1)%10; //When i increases to 10, reset to 0
_delay_ms(200);


}


}


Reference address:AVR microcontroller proteus simulation lesson 3: single digital tube

Previous article:AVR microcontroller proteus simulation lesson 4: control relay
Next article:AVR Proteus simulation lesson 1: installation and setting of AVR Studio and WinAVR

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号