/****************************************
* MDA-MULTI MICOM AVR
* MCU : AVR
* COMPILER : IAR
* FILE NAME : WATCH.C
****************************************/
/*****************************************
< Jumpering >
PA0 ~ PA7 ==> [7-SEGMENT] A ~ P
PB4 ~ PB7 ==> [7-SEGMENT] Q0 ~ Q3
******************************************/
/* This header file declares the internal
register addresses for Atmega 8535 */
#include "io8535.h"
// P L E H
__flash unsigned char SEG[8] = {0x8c,0xef,0xc7,0xdf,0x86,0xbf,0x89,0x7f};
#pragma location=0x60
__no_init char SRAM[2];
// Main
void main(void)
{
unsigned char point;
// Definde directions for port pins
DDRB = 0xff;
DDRA = 0xff;
PORTA = 0xff;
PORTB = 0xff;
asm ("WDR"); // Reset watchdog
WDTCR = 0x18;
point = SRAM[0];
if (point != 1){
SRAM[0] = 1;
SRAM[1] = 0;
}
point = SRAM[1];
if (point == 8) SRAM[1] = 0;
point = SRAM[1];
PORTA = SEG[point];
point++;
PORTB = SEG[point];
point++;
if (point == 8) point=0;
SRAM[1] = point;
while(1);
}