[an error occurred while processing this directive]
Еще раз, с пробелами между < <
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)

миниатюрный аудио-видеорекордер mAVR

Отправлено Леонид Иванович 04 августа 2006 г. 12:22
В ответ на: Вот кусок исходника для работы с ЦАП, в нем ответы на все вопросы: отправлено Леонид Иванович 04 августа 2006 г. 12:13


;Periphery setup:

Init:

ldi temp,(1< < WGM12) | (1< < CS10)
out TCCR1B,temp ;clear on compare match, CK/1

ldi temp,(1< < COM1A1)
out TCCR1A,temp ;OC1A clear on compare

ldi temp,high(FCLK/FUPD-1)
out OCR1AH,temp
ldi temp, low(FCLK/FUPD-1)
out OCR1AL,temp

ldi temp,(1< < OCF1A)
out TIFR,temp ;clear pending timer interrupt
out TIMSK,temp ;enable output compare interrupt

ldi temp,(1< < SPE) | (1< < MSTR) | (1< < CPHA)
out SPCR,temp ;SPI enable, MSB first, master

ldi temp,(1< < SPI2X)
out SPSR,temp ;double SPI speed


DacLoad:

ldi XL,(1< < COM1A0)
out TCCR1A,XL ;OC1A toggle
ldi XL,(1< < COM1A0) | (1< < FOC1A)
out TCCR1A,XL ;set SCK (OC1A force toggle)
Port_I2SWS_0 ;clear WS
out TCCR1A,XL ;clear SCK (OC1A force toggle)

out SPDR,SinH ;---> load DAC high byte
;KURIM
out SPDR,SinL ;---> load DAC low byte
;KURIM
ldi XL,(1< < COM1A0) | (1< < FOC1A)
out TCCR1A,XL ;OC1A force toggle
out SPDR,r0 ;zero data for another DAC channel
Port_I2SWS_1 ;set WS
ldi XL,(1< < COM1A1)
out TCCR1A,XL ;OC1A clear on compare


Составить ответ  |||  Конференция  |||  Архив

Ответы


Отправка ответа
Имя (обязательно): 
Пароль: 
E-mail: 

Тема (обязательно):
Сообщение:

Ссылка на URL: 
Название ссылки: 
URL изображения: 


Rambler's Top100 Рейтинг@Mail.ru
Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание