40X2 and pinsB

mildenhall

New Member
I have a student using a 40X2 to control an LED cube (http://www.youtube.com/watch?v=6mXM-oGggrM). He is using the whole of port B as outputs.

If he writes
Code:
dirsB = %00000000
pinsB = %10101010

the relevant bits of port B do not go high, however if he does....
Code:
low B.0
high B.1
low B.2
high B.3 etc

everything works fine.

Does anyone have any idea why this is happening please?

Thanks
 
See the manual page 137

When working with this statement it is conventional to use binary notation. With
binary notation pin 7 is on the left and pin 0 is on the right. If the bit is set to 0
the pin will be an input, if the bit is set to 1 the pin will be an output.

Example:
let dirsB = %00000011 ‘ switch pins 0 and 1 to outputs
 
Additonal to the information provided by srnet, note that the HIGh and LOW commands automatically configure the IO pin as an output where the pin can operate as an input or output.
 
srnet:186718 said:
I hope you teach students how to research problems for themselves ?[/QUOTE

I did initially think of a rather sarcastic answer for you. I have 43 A Level students to teach, and on occasion, the odd one does slip through!
 
Back
Top