Перейти к содержанию
    

HNK0

Участник
  • Постов

    12
  • Зарегистрирован

  • Посещение

Репутация

0 Обычный

Информация о HNK0

  • День рождения 21.09.1956

Контакты

  • Сайт
    Array
  • ICQ
    Array
  1. Я извиняюсь, невнимательно просмотрел код. В AVR Studio симуляторе этот код правильно работает. #include <avr\io.h> #include <avr\interrupt.h> #define _200us 182 #define _12ms 10909 #define DIR_1 0 #define DIR_2 1 #define STROB PC2 #define D1 PC3 void initia(void); unsigned char answer[4]; unsigned short a; unsigned short main(void) { cli(); initia(); sei(); a = 0; while (1) { a++; } return 0; } void initia(void) { DDRC |= 1<<DDC0 | 1<<DDC1 | 1<<DDC2 | 1<<DDC3 | 1<<DDC4; PORTC |= 1<<PC3; PORTC &= ~(1<<STROB); PORTC |= 1<<D1; DDRD &= ~(1<<DDD0 | 1<<DDD3); DDRD |= 1<<DDD1 | 1<<DDD2; TIMSK1 |= 1<<OCIE1A | 1<<OCIE1B; OCR1A = _200us; OCR1B = _12ms; TCCR1B |= 1<<CS11; UBRR0 = 7; UCSR0B |= 1<<RXEN0 | 1<<RXCIE0 | 1<<TXEN0; } ISR(TIMER1_COMPB_vect) { answer[0] = TCNT1L; answer[1] = TCNT1H; PORTC &= ~(1<<STROB); PORTC |= 1<<D1; TCNT1H = 0; TCNT1L = 0; }
  2. It is important to notice that accessing 16-bit registers are atomic operations. If an interrupt occurs between the two instructions accessing the 16-bit register, and the interrupt code updates the temporary register by accessing the same or any other of the 16-bit Timer Registers, then the result of the access outside the interrupt will be corrupted. Therefore, when both the main code and the interrupt code update the temporary register, the main code must disable the interrupts during the 16-bit access.
  3. To do a 16-bit write, the high byte must be written before the low byte. For a 16-bit read, the low byte must be read before the high byte.
  4. можно. DMA прозрачно работает.
  5. Вы на этот проект посмотрите: dtmf.zip
  6. А вы зря, устройство работает великолепно. а зашита от помех это другой вопрос.
  7. тут вам все EEPROM, RS232, Выход, входы, ADC: http://www.cesko.host.sk/IgorPlugUSB_RS232...20RS232_eng.htm
  8. WinAVR: оптимизация

    a вы так: for(i=0; i<8; i++) вместо for(i=0; i<8; ++i)
  9. USBtinyISP

    посмотрите cправа на сцему, около JP5 написано "Ignore SELFPGM it doesnt work" - самопрограмирование не работает.
×
×
  • Создать...