symbol pwmmin = 30
symbol pwmmax = 215
symbol pwmdif = pwmmax - pwmmin
symbol pressure = w0
symbol startpot = w1
symbol maxpot = w2
symbol DC = w3
main:
pause 30
low 0
READADC10 0, pressure
READADC 1, startpot
READADC 2, maxpot
if w0 < 200 then goto set_zero 'this section rescales w0 to 0-255
w0 = w0 - 200
goto continue1
set_zero:
w0 = 0
continue1:
w0 = 65 * w0
w0 = w0 / 220 'adjust this down to raise max of w0 to 248
w0 = w0 + 5 'adjust this to set low end of w0
w1 = 65 * w1
w1 = w1 / 125
IF pin6 = 1 THEN usemaxpwm
rem IF pressure >= maxpot THEN usemaxpwm
IF pressure <= startpot THEN turnpwmoff
IF pressure <= 20 THEN turnpwmoff
IF maxpot <= startpot THEN turnpwmoff
DC = maxpot - startpot 'math section for DC calculation
DC = pressure - startpot * pwmdif / DC
If DC >= pwmdif THEN usemaxpwm
DC = DC + pwmmin
GOTO setpwm
usemaxpwm:
DC = pwmmax
goto setpwm
turnpwmoff:
DC = 0
goto setpwm
setpwm:
pwmout 3,62,DC
GOTO main
Answer me this please.......the above symbols pwmmin and pwmmax are defined as numbers. These numbers are used in a math section of the main program. I need to change pwmmax depending on an input. (such as)
IF pin7 = 1 THEN pwmmax150
PWMMAX150:
pwmmax = 150
goto main
I tried jumping the program to a subroutine to change pwmmax, but I get an "mistake in this line" message.
How can you change a SYMBOL's value from within the main program loop? Are the numbers defined by the symbols variables or constants? If constants- how to change into vars w/o messing up the rest?
symbol pwmmax = 215
symbol pwmdif = pwmmax - pwmmin
symbol pressure = w0
symbol startpot = w1
symbol maxpot = w2
symbol DC = w3
main:
pause 30
low 0
READADC10 0, pressure
READADC 1, startpot
READADC 2, maxpot
if w0 < 200 then goto set_zero 'this section rescales w0 to 0-255
w0 = w0 - 200
goto continue1
set_zero:
w0 = 0
continue1:
w0 = 65 * w0
w0 = w0 / 220 'adjust this down to raise max of w0 to 248
w0 = w0 + 5 'adjust this to set low end of w0
w1 = 65 * w1
w1 = w1 / 125
IF pin6 = 1 THEN usemaxpwm
rem IF pressure >= maxpot THEN usemaxpwm
IF pressure <= startpot THEN turnpwmoff
IF pressure <= 20 THEN turnpwmoff
IF maxpot <= startpot THEN turnpwmoff
DC = maxpot - startpot 'math section for DC calculation
DC = pressure - startpot * pwmdif / DC
If DC >= pwmdif THEN usemaxpwm
DC = DC + pwmmin
GOTO setpwm
usemaxpwm:
DC = pwmmax
goto setpwm
turnpwmoff:
DC = 0
goto setpwm
setpwm:
pwmout 3,62,DC
GOTO main
Answer me this please.......the above symbols pwmmin and pwmmax are defined as numbers. These numbers are used in a math section of the main program. I need to change pwmmax depending on an input. (such as)
IF pin7 = 1 THEN pwmmax150
PWMMAX150:
pwmmax = 150
goto main
I tried jumping the program to a subroutine to change pwmmax, but I get an "mistake in this line" message.
How can you change a SYMBOL's value from within the main program loop? Are the numbers defined by the symbols variables or constants? If constants- how to change into vars w/o messing up the rest?