frugmonkey
New Member
hi all.
its my first attempt at programming a picaxe chip. i bought a 28x1 chip and an experimenter board.
i'm trying to make a program to control an alcohol/water injection pump to go on my car. the idea is that the higher the boost from the turbo is, the faster the pump will run, the pressure is read from the map sensor in the intercooler which gives a 0-5 volt signal, i'm planning to have pots on two of the analogue inputs and the map sensor on another, so i can set a starting pressure of say 3psi (15% duty) up to 16 psi (100% duty)
ive written some of the program, but i'm getting a syntax error when i test the program, i'll paste it in below
i'm trying to get a range for the pump to operate across by subtracting the setting for the start boost from the maximum boost and then dividing it up so i can have 18 steps with a different pwm output for each step
the error appears under the 'w' in pwmout in the 6th line of curve 1?
main:
symbol test_button=pin0
symbol curve_1=pin1
symbol curve_2=pin2
symbol curve_3=pin3
symbol curve_4=pin4
symbol test_led=0
symbol fault_led=1
symbol led_20=2
symbol led_40=3
symbol led_60=4
symbol led_80=5
symbol led_100=6
symbol map_signal=b0
symbol min_boost=b1
symbol max_boost=b2
symbol range=b3
symbol rng_seg=b4
readadc 0, map_signal
readadc 1, min_boost
readadc 2, max_boost
if test_button=1 then gosub test
if curve_1=1 then gosub curve1
curve1:
readadc 0, map_signal
readadc 1, min_boost
readadc 2, max_boost
let range=max_boost-min_boost
let rng_seg=range/18
if map_signal=rng_seg <(2*rng_seg) pwmout 1 , 199,120
if map_signal=(2*rng_seg)<(3*rng_seg) pwmout 1 , 199, 160
led_20 high
if map_signal=(3*rng_seg)<(4*rng_seg) pwmout 1 , 199, 200
if map_signal=(3*rng_seg)<(5*rng_seg) pwmout 1 , 199, 240
if anyone can shed a little light on this it would be really useful to me as i'm a bit stumped, and being new to it i'm not really sure what i'm doing!
thanks in advance to anyone who might be able to help a little
jonathan
its my first attempt at programming a picaxe chip. i bought a 28x1 chip and an experimenter board.
i'm trying to make a program to control an alcohol/water injection pump to go on my car. the idea is that the higher the boost from the turbo is, the faster the pump will run, the pressure is read from the map sensor in the intercooler which gives a 0-5 volt signal, i'm planning to have pots on two of the analogue inputs and the map sensor on another, so i can set a starting pressure of say 3psi (15% duty) up to 16 psi (100% duty)
ive written some of the program, but i'm getting a syntax error when i test the program, i'll paste it in below
i'm trying to get a range for the pump to operate across by subtracting the setting for the start boost from the maximum boost and then dividing it up so i can have 18 steps with a different pwm output for each step
the error appears under the 'w' in pwmout in the 6th line of curve 1?
main:
symbol test_button=pin0
symbol curve_1=pin1
symbol curve_2=pin2
symbol curve_3=pin3
symbol curve_4=pin4
symbol test_led=0
symbol fault_led=1
symbol led_20=2
symbol led_40=3
symbol led_60=4
symbol led_80=5
symbol led_100=6
symbol map_signal=b0
symbol min_boost=b1
symbol max_boost=b2
symbol range=b3
symbol rng_seg=b4
readadc 0, map_signal
readadc 1, min_boost
readadc 2, max_boost
if test_button=1 then gosub test
if curve_1=1 then gosub curve1
curve1:
readadc 0, map_signal
readadc 1, min_boost
readadc 2, max_boost
let range=max_boost-min_boost
let rng_seg=range/18
if map_signal=rng_seg <(2*rng_seg) pwmout 1 , 199,120
if map_signal=(2*rng_seg)<(3*rng_seg) pwmout 1 , 199, 160
led_20 high
if map_signal=(3*rng_seg)<(4*rng_seg) pwmout 1 , 199, 200
if map_signal=(3*rng_seg)<(5*rng_seg) pwmout 1 , 199, 240
if anyone can shed a little light on this it would be really useful to me as i'm a bit stumped, and being new to it i'm not really sure what i'm doing!
thanks in advance to anyone who might be able to help a little
jonathan