//************************************************************
//FUNCTION : LED 8 FLASH BY PATTERN
/* Test configuration:
MCU: ATmega128
//FUNCTION : LED 8 FLASH BY PATTERN
/* Test configuration:
MCU: ATmega128
Oscillator: External Clock 07.37280 MHz
Ext. Modules: -
SW: mikroC PRO for AVR
*/
Ext. Modules: -
SW: mikroC PRO for AVR
*/
//************************************************************
// Include Files
//************************************************************
#define uchar unsigned char
#define uint unsigned int
// Include Files
//************************************************************
#define uchar unsigned char
#define uint unsigned int
#define Data_IO PORTA //8-LED DATA
#define Data_DDR DDRA //8-LED DATA DIRECTION
#define Data_DDR DDRA //8-LED DATA DIRECTION
//----------------------------------------------------------------------------------------
// Macros
//----------------------------------------------------------------------------------------
#define SETBIT(ADDRESS,BIT) (ADDRESS |= (1<<BIT))
#define CLRBIT(ADDRESS,BIT) (ADDRESS &= ~(1<<BIT))
#define CHKBIT(ADDRESS,BIT) (ADDRESS & (1<<BIT))
// Macros
//----------------------------------------------------------------------------------------
#define SETBIT(ADDRESS,BIT) (ADDRESS |= (1<<BIT))
#define CLRBIT(ADDRESS,BIT) (ADDRESS &= ~(1<<BIT))
#define CHKBIT(ADDRESS,BIT) (ADDRESS & (1<<BIT))
uchar LED_PTN[17] = {0B11111111,
0B11100111,
0B11000011,
0B10000001,
0B00000000,
0B10000001,
0B11000011,
0B11100111,
0B11111111,
0B10101010,
0B01010101,
0B10101010,
0B01010101,
0B10101010,
0B01010101,
0B10101010,
0B01010101
};
0B11100111,
0B11000011,
0B10000001,
0B00000000,
0B10000001,
0B11000011,
0B11100111,
0B11111111,
0B10101010,
0B01010101,
0B10101010,
0B01010101,
0B10101010,
0B01010101,
0B10101010,
0B01010101
};
char i;
void main() {
Data_IO=0xFF; //8-LED DATA PORT IS OUT <1=OUT , 0=IN>
Data_DDR=0xFF;
while(1)
{
for (i=0 ; i<=17 ;i++)
{
Delay_ms(125);
Data_IO = LED_PTN[i];
}
Data_IO=0x00;
Delay_ms(2000);
}
void main() {
Data_IO=0xFF; //8-LED DATA PORT IS OUT <1=OUT , 0=IN>
Data_DDR=0xFF;
while(1)
{
for (i=0 ; i<=17 ;i++)
{
Delay_ms(125);
Data_IO = LED_PTN[i];
}
Data_IO=0x00;
Delay_ms(2000);
}
}
沒有留言:
張貼留言