Trying to get my engine going in different speeds
Sonite
Posts: 2
Hi all!
I have trouble.... I don´t know why my engine won´t behave as I want it to.
Can anyone of you see, any direct faulty entries in my code that might do that this does´nt work??
(the engine starts but dies after going with a 1.1ms for a while)
All help is apprecihated.
' {$STAMP BS2sx}
'
' Program Description
'
' Make RC Engine go forward
'
temp1 VAR Word
temp2 VAR Word
temp3 VAR Word
temp4 VAR Word
pwms VAR Word
timer VAR Word
msTime CON 1250·· ' to 1 milliseconds for 0.8 us per unit
·
· DEBUG CLS, HOME ' show debug window, clear and start at the beginning
Setup:
· INPUT 6 ' make listen on Port6
· LOW 6·· ' set listen-signal off
· LOW 5·· ' set power supply relay off
· LOW 4·· ' make Port4 low (PWM off)
Beginning:
· timer = 0
· PAUSE 2000 ' two second delay
· DEBUG CLS, HOME
· DEBUG "Standby mode, timer countdown ", DEC timer
Pause_check:
· PAUSE 1000
· timer = (timer + 1)
· DEBUG DEC timer
· IF (timer >= 10) THEN Check_for_start_signal
· IF (IN6 = 0) THEN Pause_check
Check_for_start_signal:
· DEBUG CLS, HOME
· DEBUG "Awaiting start signal...", CR
Hold:
· IF (IN6 = 1) THEN Start ' if Port6 is High, start engine
· GOTO Hold
Start:
· LOW 6· ' turn signal off
· HIGH 5 ' turn power supply relay on
· DEBUG CLS, HOME
· DEBUG "Preset the servo controller, Engine on hold", CR
· FOR temp1 = 1 TO 2500 ' do loop 5 seconds
· pwms = msTime
· PULSOUT 4,pwms ' pulse out on Port4, High 1ms
· PAUSE 1······· ' Port4 low 1ms
· NEXT
·
· DEBUG "Engine going 10% duty (1.1ms pwm)", CR
· FOR temp2 = 1 TO 2500 ' do loop 5.25 seconds
· pwms = (msTime + 125)
· PULSOUT 4,pwms ' pulse out on Port4, High 1.1ms
· PAUSE 1······· ' Port4 low 1ms
· NEXT
·
· DEBUG "Engine going 10% duty (1.2ms pwm)", CR
· FOR temp3 = 1 TO 2500 ' do loop 5.5 seconds
· pwms = (msTime + 250)
· PULSOUT 4,pwms ' pulse out on Port4, High 1.2ms
· PAUSE 1······· ' Port4 low 1ms
· NEXT
·
· FOR pwms = pwms TO (msTime + 625) ' do until 1.2ms become 1.5ms
· PULSOUT 4,pwms
· PAUSE 100 ' 100ms delay
· DEBUG "Engine speed up to 50% duty ", DEC pwms, HOME
· NEXT
·
· FOR temp4 = 1 TO 2500 ' do loop 6.25 seconds (Engine 50% duty)
· PULSOUT 4, pwms ' pulse out on Port4, High 1.5ms
· PAUSE 1········ ' Port4 low 1ms
· NEXT
·
· FOR pwms = pwms TO (msTime + 125) ' do until 1.5ms become 1.1ms
· PULSOUT 4,pwms
· PAUSE 100 ' 100ms delay
· DEBUG "Engine slow down to 10% duty", DEC pwms, HOME
· NEXT
··pwms = msTime
· PULSOUT 4,pwms ' Engine off
· LOW 5········· 'turn power supply relay off
· DEBUG CLS, HOME
· DEBUG "Engine halted, going into standby..."
· PAUSE 2000 ' 2s delay
· GOTO Beginning
END
I have trouble.... I don´t know why my engine won´t behave as I want it to.
Can anyone of you see, any direct faulty entries in my code that might do that this does´nt work??
(the engine starts but dies after going with a 1.1ms for a while)
All help is apprecihated.
' {$STAMP BS2sx}
'
' Program Description
'
' Make RC Engine go forward
'
temp1 VAR Word
temp2 VAR Word
temp3 VAR Word
temp4 VAR Word
pwms VAR Word
timer VAR Word
msTime CON 1250·· ' to 1 milliseconds for 0.8 us per unit
·
· DEBUG CLS, HOME ' show debug window, clear and start at the beginning
Setup:
· INPUT 6 ' make listen on Port6
· LOW 6·· ' set listen-signal off
· LOW 5·· ' set power supply relay off
· LOW 4·· ' make Port4 low (PWM off)
Beginning:
· timer = 0
· PAUSE 2000 ' two second delay
· DEBUG CLS, HOME
· DEBUG "Standby mode, timer countdown ", DEC timer
Pause_check:
· PAUSE 1000
· timer = (timer + 1)
· DEBUG DEC timer
· IF (timer >= 10) THEN Check_for_start_signal
· IF (IN6 = 0) THEN Pause_check
Check_for_start_signal:
· DEBUG CLS, HOME
· DEBUG "Awaiting start signal...", CR
Hold:
· IF (IN6 = 1) THEN Start ' if Port6 is High, start engine
· GOTO Hold
Start:
· LOW 6· ' turn signal off
· HIGH 5 ' turn power supply relay on
· DEBUG CLS, HOME
· DEBUG "Preset the servo controller, Engine on hold", CR
· FOR temp1 = 1 TO 2500 ' do loop 5 seconds
· pwms = msTime
· PULSOUT 4,pwms ' pulse out on Port4, High 1ms
· PAUSE 1······· ' Port4 low 1ms
· NEXT
·
· DEBUG "Engine going 10% duty (1.1ms pwm)", CR
· FOR temp2 = 1 TO 2500 ' do loop 5.25 seconds
· pwms = (msTime + 125)
· PULSOUT 4,pwms ' pulse out on Port4, High 1.1ms
· PAUSE 1······· ' Port4 low 1ms
· NEXT
·
· DEBUG "Engine going 10% duty (1.2ms pwm)", CR
· FOR temp3 = 1 TO 2500 ' do loop 5.5 seconds
· pwms = (msTime + 250)
· PULSOUT 4,pwms ' pulse out on Port4, High 1.2ms
· PAUSE 1······· ' Port4 low 1ms
· NEXT
·
· FOR pwms = pwms TO (msTime + 625) ' do until 1.2ms become 1.5ms
· PULSOUT 4,pwms
· PAUSE 100 ' 100ms delay
· DEBUG "Engine speed up to 50% duty ", DEC pwms, HOME
· NEXT
·
· FOR temp4 = 1 TO 2500 ' do loop 6.25 seconds (Engine 50% duty)
· PULSOUT 4, pwms ' pulse out on Port4, High 1.5ms
· PAUSE 1········ ' Port4 low 1ms
· NEXT
·
· FOR pwms = pwms TO (msTime + 125) ' do until 1.5ms become 1.1ms
· PULSOUT 4,pwms
· PAUSE 100 ' 100ms delay
· DEBUG "Engine slow down to 10% duty", DEC pwms, HOME
· NEXT
··pwms = msTime
· PULSOUT 4,pwms ' Engine off
· LOW 5········· 'turn power supply relay off
· DEBUG CLS, HOME
· DEBUG "Engine halted, going into standby..."
· PAUSE 2000 ' 2s delay
· GOTO Beginning
END
Comments
I am not the best guy at programing but maybe I can help if I understand your problem better.
The second is, if it starts at 1.1ms it goes for a while and then stopps when going to 1.2ms. And Sometimes it works as expected.
Im wondering if this is the case because of my ESC.... it have the original program values. One of them is Auto Throtthle.
http://www.suppomodel.com/ESC/100A.html
http://www.hobbycity.com/hobbycity/store/uh_viewItem.asp?idProduct=4937&Product_Name=KB45-08XL_1600kv_Brushless_Inrunner