SwingeyP
Member
I would normally struggle with assembler to do thsi but having found pic basic i though i'd struggle with that instead ;-)
A couple of questions :
First off what's wrong with this please
Symbol outpin = PORTB.0
Const uplimit = 200 'Set upper limit - max. 255, each step is 10uS
Const downlimit = 100 'Set lower limit - min. 0
Dim pulse As Byte
TRISB = 0xff
pulse = 128 'Set initial value to middle
For pulseup = pulse To uplimit 'move from middle to upper limit'
ServoOut outpin, pulseup
delayms 18
Next pulseup
loop:
For pulsedown = uplimit To downlimit
ServoOut outpin, pulsedown
delayms 18
Next pulsedown
For pulseup = downlimit To uplimit 'move from lower to upper limit'
ServoOut outpin, pulseup
delayms 18
Next pulseup
Goto loop
Secondly has anyone written a plugin for the OSHON simulator to show servo control?
Many thanks - Paul
A couple of questions :
First off what's wrong with this please
Symbol outpin = PORTB.0
Const uplimit = 200 'Set upper limit - max. 255, each step is 10uS
Const downlimit = 100 'Set lower limit - min. 0
Dim pulse As Byte
TRISB = 0xff
pulse = 128 'Set initial value to middle
For pulseup = pulse To uplimit 'move from middle to upper limit'
ServoOut outpin, pulseup
delayms 18
Next pulseup
loop:
For pulsedown = uplimit To downlimit
ServoOut outpin, pulsedown
delayms 18
Next pulsedown
For pulseup = downlimit To uplimit 'move from lower to upper limit'
ServoOut outpin, pulseup
delayms 18
Next pulseup
Goto loop
Secondly has anyone written a plugin for the OSHON simulator to show servo control?
Many thanks - Paul