Shop OBEX P1 Docs P2 Docs Learn Events
Pass value in phsa? — Parallax Forums

Pass value in phsa?

lardomlardom Posts: 1,659
edited 2014-08-17 08:43 in Propeller 1
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?
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
Sign In or Register to comment.