Задание№3-1 — различия между версиями
EdGull (обсуждение | вклад) |
EdGull (обсуждение | вклад) |
||
Строка 1: | Строка 1: | ||
<source lang="vb"> | <source lang="vb"> | ||
− | $prog &HFF , &HE4 , &HD9 , &H00 ' | + | $prog &HFF , &HE4 , &HD9 , &H00 'óêàçûâàåì êàêèå ôóñèáèòû íàäî ïðîøèòü |
− | $regfile = "m32def.dat" ' | + | $regfile = "m32def.dat" ' ôàéë ñïåöèôèêàöèè Ìåãè32 |
− | $crystal = 8000000 ' | + | $crystal = 8000000 ' óêàçûâàåì íà êàêîé ÷àñòîòå áóäåì ðàáîòàòü |
'---------------------------------------------------------------------------- | '---------------------------------------------------------------------------- | ||
Config Timer1 = Pwm , Pwm = 8 , Prescale = 1 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down | Config Timer1 = Pwm , Pwm = 8 , Prescale = 1 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down | ||
− | Config Pinc.2 = Output : Drl Alias Portc.2 ' | + | Config Pinc.2 = Output : Drl Alias Portc.2 'íîãó ñêîíôèãóðèðîâàëè êàê âûõîä è îáîçâàëè Drl |
− | Config Pinc.3 = Output : Drr Alias Portc.3 ' | + | Config Pinc.3 = Output : Drr Alias Portc.3 'íîãó ñêîíôèãóðèðîâàëè êàê âûõîä è îáîçâàëè Drr |
− | Config Pind.4 = Output ' | + | Config Pind.4 = Output 'íîãó ØÈÌà ëåâîãî äâèæêà ñêîíôèãóðèðîâàëè êàê âûõîä |
− | Config Pind.5 = Output ' | + | Config Pind.5 = Output 'íîãó ØÈÌà ïðàâîãî äâèæêà ñêîíôèãóðèðîâàëè êàê âûõîä |
Config Pinb.0 = Output | Config Pinb.0 = Output | ||
'---------------------------------------------------------------------------- | '---------------------------------------------------------------------------- | ||
Строка 17: | Строка 17: | ||
Call Povorot(30) | Call Povorot(30) | ||
Loop | Loop | ||
+ | |||
Sub Povorot(byval Gradus As Byte) | Sub Povorot(byval Gradus As Byte) | ||
Local A As Byte | Local A As Byte | ||
+ | Local Temp As Word | ||
+ | Temp = Gradus / 10 | ||
Portb.0 = 1 | Portb.0 = 1 | ||
− | For A = 1 To | + | Waitus 500 |
− | Waitus | + | For A = 1 To Temp |
+ | Waitus 111 | ||
Next | Next | ||
portb.0=1 | portb.0=1 | ||
Waitus 18000 | Waitus 18000 | ||
End Sub | End Sub | ||
+ | |||
</source> | </source> |
Версия 11:18, 7 июня 2008
<source lang="vb"> $prog &HFF , &HE4 , &HD9 , &H00 'óêàçûâàåì êàêèå ôóñèáèòû íàäî ïðîøèòü $regfile = "m32def.dat" ' ôàéë ñïåöèôèêàöèè Ìåãè32 $crystal = 8000000 ' óêàçûâàåì íà êàêîé ÷àñòîòå áóäåì ðàáîòàòü
'---------------------------------------------------------------------------- Config Timer1 = Pwm , Pwm = 8 , Prescale = 1 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down Config Pinc.2 = Output : Drl Alias Portc.2 'íîãó ñêîíôèãóðèðîâàëè êàê âûõîä è îáîçâàëè Drl Config Pinc.3 = Output : Drr Alias Portc.3 'íîãó ñêîíôèãóðèðîâàëè êàê âûõîä è îáîçâàëè Drr Config Pind.4 = Output 'íîãó ØÈÌà ëåâîãî äâèæêà ñêîíôèãóðèðîâàëè êàê âûõîä Config Pind.5 = Output 'íîãó ØÈÌà ïðàâîãî äâèæêà ñêîíôèãóðèðîâàëè êàê âûõîä Config Pinb.0 = Output '---------------------------------------------------------------------------- Declare Sub Povorot(byval Gradus As Byte)
Do
Call Povorot(30)
Loop
Sub Povorot(byval Gradus As Byte)
Local A As Byte
Local Temp As Word
Temp = Gradus / 10 Portb.0 = 1 Waitus 500 For A = 1 To Temp Waitus 111 Next portb.0=1 Waitus 18000
End Sub
</source>