📄 app.c
字号:
#include "avr/io.h"
//#include "util/delay.h"
//#include "avr/pgmspace.h"
/* Segment code table for Common Cathode 7-segment displays */
/*const prog_char SegCode[16]={
0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
//unsigned char DisBuffer[8];
/*void SmgScan(void)
{
unsigned char i=0;
for(i=0;i<8;i++)
{
PORTB = pgm_read_byte(&SegCode[DisBuffer[i]]);/* Output the Segment code */
/* PORTA|= (1<<PA4);
PORTA&=~(1<<PA4);
PORTB = (1<<i); /* Select one 7-segment display */
/* PORTA|= (1<<PA5);
PORTA&=~(1<<PA5);
_delay_ms(2);
}
}*/
int main(void)
{
/* Set LEDs and Smg LE pin as output , databus as output */
DDRA |=(1<<PA4)|(1<<PA5)|(1<<PA6);
DDRB = 0xFF;
/* Turn off the LEDs */
PORTB = 0xFF;
PORTA|= (1<<PA6);
//PORTA&=~(1<<PA7);
//PORTA|= (1<<PA7);
DDRD=0x00;
PORTD=0xff;
while(1)
{
PORTB=PIND;
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -