Ответ: Спасибо Леонид, а вот код посмотрите:
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)

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

Отправлено eedr 15 августа 2004 г. 05:31
В ответ на: Defer Register отправлено Леонид Иванович 15 августа 2004 г. 01:48

Не знаю на чем это но хотелось бы на С может кто-нибудь переведет.

'Start Hardware Configuration
'#######################################################################

$regfile = "8515def.dat"
$crystal = 8000000

Config Pind.7 = Output 'Sclk
Config Pind.6 = Output 'SData
Config Pind.5 = Output 'Fsync

Sclk Alias Portd.7
Sdata Alias Portd.6
Fsync Alias Portd.5

Set Sclk 'Set initial pin
state
Set Fsync 'Set initial pin
state


'#######################################################################
'End Hardware Configuration

Dim Fword0 As Long At &H60
Dim Low_byte0 As Byte At &H60 Overlay
Dim Low_mid_byte0 As Byte At &H61 Overlay
Dim High_mid_byte0 As Byte At &H62 Overlay
Dim High_byte0 As Byte At &H63 Overlay
Fword0 = &H346DC

Dim Setfreq As Long
Dim Freq As Single
Dim Count As Single

Setfreq = 400 'Change this
value
to the required Freq. in Hertz

Count = 536.870912 'This is count
for
1 Hz at 8 MHz MCLK input
Freq = Setfreq * Count
Fword0 = Freq


'Declare subroutines
'#######################################################################

Declare Sub Send_dds(byval Sw As Word)

'#######################################################################
'End Declare subroutines

'Start sending commands to the DDS
'#######################################################################

Call Send_dds(&Hf800) 'Resets DDS and
puts it into standby


Call Send_dds(&H3000 + Low_byte0) 'These 4 lines
sends the freq. to the DDS
Call Send_dds(&H2100 + Low_mid_byte0) 'These 4 lines
sends the freq. to the DDS
Call Send_dds(&H3200 + High_mid_byte0) 'These 4 lines
sends the freq. to the DDS
Call Send_dds(&H2300 + High_byte0) 'These 4 lines
sends the freq. to the DDS

Call Send_dds(&H8000) 'Sets SYNC and
SELSRC registers to 0
Call Send_dds(&H5000) 'Sets SELSRC
registers to 0
Call Send_dds(&Hc000) 'Brings DDS out
of
standby

'#######################################################################
'End sending commands to the DDS

Powerdown 'Put CPU in
Powerdown state for less noise
End 'End program


'########################################################################

'This is the subroutine that send the data to the DDS
'########################################################################
Sub Send_dds(byval Sw As Word)


Reset Fsync
Waitus 1
Shiftout Portd.6 , Portd.7 , Sw , 0 , 16 , 15
Set Fsync

End Sub

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

Ответы



Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru