How can I write program for more servo

Status
Not open for further replies.

lonely boy

Newbie level 6
Joined
May 18, 2012
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
IRAN
Activity points
1,358
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:

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:

Re: How can I write program for more servo motor

nobody help me!!!!!:shock:
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…