HIGH BITX 28x2

Janne

Senior Member
Hello,

While working with my latest project, i noticed that the command HIGH BIT0 doesn't work. The program works, if i replace the statement by let bit0 = 1.
However, i remember using the high bit0 command on an earlier project with picaxe 20M.. Though i'm not sure if it worked, because i didn't finish it =).. The reason why high / low bitx might be useful, is that it seems to use less program space that way.

So, does that command even work, or does the PE accept the command by mistake?

edit. I'm using PE 5.2.6
 

hippy

Ex-Staff (retired)
The command is using the contents of the bit variable ( which will have a value of 0 or 1 ) to indicate the pin, so correspondingly setting pin 0 or 1 high. It's the equivalent of ...

If bit0 = 0 Then
High 0
Else
High 1
End If
 

Janne

Senior Member
Thanks for the reply. Now i'm thinking, why i didn't figure it out myself, as it is so obvious.
 

tiscando

Senior Member
I also nearly used 'high bitx' in my code, but then I replaced them with let bitx=1 before I programmed the picaxe. I think this issue should be clarified in the manual.
 

BeanieBots

Moderator
How would you suggest it is made any clearer?
Current wording:-
HIGH pin {,pin,pin...}
- Pin is a variable/constant (0-7) which specifies the i/o pin to use.
 

hippy

Ex-Staff (retired)
I also nearly used 'high bitx' in my code, but then I replaced them with let bitx=1 before I programmed the picaxe. I think this issue should be clarified in the manual.
I'm not sure what needs clarifying; the two commands do very different things. In the first you are setting a pin high and indicating which pin that should be by using a variable, in the second you are assigning a variable a value.

The two commands are in no way alternatives to each other and beyond stating, "use the correct commands to achieve what you want to do", which is implicit in all programming, I cannot see what clarification is needed or would help.

Added : Accepting the proposition that those close to a product or familiar with it see things in a different way to how others may, I can see a possible assumption, misinterpretation, misunderstanding or imagining that a HIGH command sets something high, be that something a pin or a bit variable, however the HIGH command description in the manual is explicit in that it affects an output pin.

Maybe an explicit "HIGH <variable> cannot be used to set a bit variable high (1)", and the equivalent, for LOW, TOGGLE etc, is the clarification you are seeking. I don't know what merit there is in that, how common such misunderstandings are to make it worthwhile, but I will pass that on for consideration.
 
Last edited:

BeanieBots

Moderator
Maybe an explicit "HIGH <variable> cannot be used to set a bit variable high (1)", and the equivalent, for LOW, TOGGLE etc, is the clarification you are seeking. I don't know what merit there is in that, how common such misunderstandings are to make it worthwhile, but I will pass that on for consideration.
A similar issue arose with lines such as "high pin3" which would set the output of either OP 0 or OP 1 depending on the input condition of IP 3.
This has since been locked out and can no longer be used. However, IMHO, it reduces functionality and requires a workaround should such a function ever actually be required.

Just my opinion. Would be interested in others.
 

hippy

Ex-Staff (retired)
For "HIGH pinX" & Co it was felt the misunderstandings over use were frequent enough to merit disabling it as beneficial overall. It reduced functionality but the cases where the construct needed to be used were few and far between and there is a fairly easy workround so it was not considered as detrimental.
 
Top