Can't remember, and can't find, answer to this code problem

wapo54001

Senior Member
It has been years since I last programmed extensively, and now I'm in a new project and find I've forgotten just about everything about Picaxe programming, so I'm relearning as I go along.

Step_Direction is the symbol for C.2 -- it works fine in the first IF .. ELSE snippet, but I can't figure out how to use the Symbol when checking the status of the pin. Right now I'm using the work around pinC.2 = 1, I'd like to keep things consistent and use the "Step_Direction" and "HIGH" symbols instead.

How do I rewrite the "IF pinC.2 = 1" using the SYMBOLS "Step_Direction" and "HIGH"?

Code:
SYMBOL Step_Direction = C.2 


        IF CmdCode = "J" THEN

            HIGH Step_Direction

        ELSE

            LOW Step_Direction

        ENDIF


    IF pinC.2 = 1 THEN

        Count_Total = Count_Total + Count_Actual MAX 10000

    ELSE

        Count_Total = Count_Total - Count_Actual MIN 1

    ENDIF
 

techElder

Well-known member
You could use two different symbols:

Step_Direction_IN = pinC.2
Step_Direction_OUT = C.2

I think. :D
 

hippy

Technical Support
Staff member
'outpinC.2' would be the best option to determine what the state of the output pin is.

But I would personally have used a bit variable to set the state and then use that in an output routine to set the actual pin level and determine how it had been set.
 

wapo54001

Senior Member
hippy, I originally used a bit variable and ran into some kind of programming problem and changed my approach, but I'll revisit that and see if I can figure it out.

Thanks to techelder also for his suggestion.

Edit - tried the bit storage again, got it to work this time, very simple solution, thanks again.
 
Last edited:
Top