|
цифры горят, но остается как бы послесвечение. Тогда я решил выводить цифры в прерывании от таймера каждые 4мсек, теперь всегда горит только 4-я цифра :))
#define Xtal 8000000L
#define prescaler0 256
#define Fck0 (Xtal/prescaler0)
#define delay0 0.004/* Port interfaced to display unit */
#define DISPLAY_PORT PORTC/* ... */
SIGNAL(SIG_OUTPUT_COMPARE0)
{
PORTB = _BV(SEG_D2);
DISPLAY_PORT = DigitTable[0];
PORTB = _BV(SEG_D4);
DISPLAY_PORT = DigitTable[1];
}int main(void)
{
TCCR0 = 0x00;
TCNT0 = 0x00;
TCCR0 = _BV(CS02) | _BV(WGM01);
OCR0 = (unsigned int)(delay0 * Fck0);
TIMSK = _BV(OCIE0);sei();
DDRB = (_BV(SEG_D2) | _BV(SEG_D4));
/* Set all PORTC pins as outputs */
DDRC = 0xFF;// endless loop
while (1)
{}
return 1;
}
E-mail: info@telesys.ru