برنامه زیر برای atmega8 با بیسیک است کی میتونه اینو به زبان c با نرم افزار کد ویژن بنویسه؟
$regfile = "M8DEF.DAT"
$crystal = 4000000
Config Timer2 = Pwm , Prescale = 64 , Pwm = On , Compare Pwm = Clear Up
Config Pind.0 = Input : Speed_up Alias Pind.0
Config Pind.1 = Input : Speed_down Alias Pind.1
Config Pind.2 = Input : Left_to_right Alias Pind.2
Config Pind.3 = Input : Right_to_left Alias Pind.3
Config Pind.4 = Input : Play_pause Alias Pind.4
Config Pinb.0 = Output
Config Pinb.1 = Output
Config Pinb.3 = Output
Dim Speed As Byte , Play As Bit , Left_or_right As Bit
Speed = 50 : Play = 0 : Left_or_right = 0
'-----------------------------------------------------------------------------------------------------------------------
Do
If Left_to_right = 1 Then
Left_or_right = 0 : Reset Portb.0 : Set Portb.1
Bitwait Left_to_right , Reset : End If
If Right_to_left = 1 Then
Left_or_right = 1 : Set Portb.0 : Reset Portb.1
Bitwait Right_to_left , Reset : End If
If Play_pause = 1 Then
Play = Not Play
If Play = 0 Then
If Left_or_right = 1 Then
Set Portb.0 : Reset Portb.1 : End If
If Left_or_right = 0 Then
Reset Portb.0 : Set Portb.1 : End If
End If
If Play = 1 Then
Reset Portb.0 : Reset Portb.1 : End If
Bitwait Play_pause , Reset : End If
If Speed_up = 1 Then
Waitms 50
If Speed < 255 Then Speed = Speed + 5
End If
If Speed_down = 1 Then
Waitms 50
If Speed > 0 Then Speed = Speed - 5
End If
Ocr2 = Speed
Loop
$regfile = "M8DEF.DAT"
$crystal = 4000000
Config Timer2 = Pwm , Prescale = 64 , Pwm = On , Compare Pwm = Clear Up
Config Pind.0 = Input : Speed_up Alias Pind.0
Config Pind.1 = Input : Speed_down Alias Pind.1
Config Pind.2 = Input : Left_to_right Alias Pind.2
Config Pind.3 = Input : Right_to_left Alias Pind.3
Config Pind.4 = Input : Play_pause Alias Pind.4
Config Pinb.0 = Output
Config Pinb.1 = Output
Config Pinb.3 = Output
Dim Speed As Byte , Play As Bit , Left_or_right As Bit
Speed = 50 : Play = 0 : Left_or_right = 0
'-----------------------------------------------------------------------------------------------------------------------
Do
If Left_to_right = 1 Then
Left_or_right = 0 : Reset Portb.0 : Set Portb.1
Bitwait Left_to_right , Reset : End If
If Right_to_left = 1 Then
Left_or_right = 1 : Set Portb.0 : Reset Portb.1
Bitwait Right_to_left , Reset : End If
If Play_pause = 1 Then
Play = Not Play
If Play = 0 Then
If Left_or_right = 1 Then
Set Portb.0 : Reset Portb.1 : End If
If Left_or_right = 0 Then
Reset Portb.0 : Set Portb.1 : End If
End If
If Play = 1 Then
Reset Portb.0 : Reset Portb.1 : End If
Bitwait Play_pause , Reset : End If
If Speed_up = 1 Then
Waitms 50
If Speed < 255 Then Speed = Speed + 5
End If
If Speed_down = 1 Then
Waitms 50
If Speed > 0 Then Speed = Speed - 5
End If
Ocr2 = Speed
Loop