Pass value in phsa?
lardom
Posts: 1,659
How do you pass the value of phsa to another method so that the counter is not restarted every time you call for the phsa value?
I found a solution; Copy phsa to a global variable. I had been using return which always displayed '166' which appeared to be execution overhead.The result operator displayed what I was looking for.
PUB Main
'displays elapsed clocks when pin is high
ctra[30..26] := %11010 'ctrb module to APIN=1
ctra[8..0] := 5 ' declare pin
' dira[5]~ ' input to sense pulses
frqa := 1
ifnot ina[5]
phsa := 0
return phsa
I call Start then Main thereafter to get the value. Do I need a conditional statement in front of "ctra[30..26] := %11010". There must be a better way.I found a solution; Copy phsa to a global variable. I had been using return which always displayed '166' which appeared to be execution overhead.The result operator displayed what I was looking for.
PUB run : result result := X
