lonely boy
Newbie level 6
How can I write program for more servo motor
Hi
I want to write program with Bascom or codvision for 20 servos but I have lots of if that its harmful
servo: SG5010 or s03t
microcontroller:avr
compiler:bascom or codvison
I wrote this program with ovf0(over flow 0)
but it's not good for more motors
I wrote program like this:
Hi
I want to write program with Bascom or codvision for 20 servos but I have lots of if that its harmful
servo: SG5010 or s03t
microcontroller:avr
compiler:bascom or codvison
I wrote this program with ovf0(over flow 0)
but it's not good for more motors
I wrote program like this:
Code:
$regfile = "m8def.dat"
$crystal = 8000000
Config Portd = Output
Config Timer0 = Timer , Prescale = 1
Dim R As Byte , G As Byte , B As Byte
Dim Pm As Byte
'----------------------------------------
Enable Interrupts
Enable Ovf0
On Ovf0 Makepwm
Stop Timer0
Start Timer0
R = 200 : B = 100 : G = 50
'-------------------------------------
Do
Loop
End
'-----------------------------------
Makepwm:
If Pm = 255 Then Pm = 0
If Pm = R Then Set Portd.7
If Pm < R Then Reset Portd.7
If Pm = G Then Set Portd.6
If Pm < G Then Reset Portd.6
If Pm = B Then Set Portd.5
If Pm < B Then Reset Portd.5
Incr Pm
Return
Last edited: