I am using three temperature sensors wired to three different pins (portB.5 - portB.6 and portB.7)
Now I am using three different sub-routine to read the sensors value, but since all the routine have the same code, I would like to have one single routine for all the three sensors, just changing the alias reference within the sub-routine. In other words, something like this:
Read_Sensors:
If index = 0 then return
If index > 3 then return
If index = 1 then use_pin = portB.5
If index = 2 then use_pin = portB.6
If index = 3 then use_pin = portB.7
Read sensor using "use_pin"
Load variable[index]
Return
The above code could it work?
If the answer is yes, how do I declare the alias "use_pin"? (Byte or Word)
Alberto
Bookmarks