Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Good idea but it doesn't work. I assumed you'd enable the portB pullups.what Pommie has posted, one bit at a time.
PortB wpu's are enabled and portC are cycled LOW (portC.bits(x)= 0) All portC ports are HIGH then scanned LOW.
How about just wiring things correctly? That'll work too. That way you won't have to swap port direction to turn on the led.On the above matrix diagram - swap the ports
I assume you're still using the schematic shown in mexi-trainmatrix.jpg from post #71.PortC.(x) = LOW, pressing switch PortB.(x) goes LOW
That might be overly optimistic, Mike. I'm figuring 20-30 pages just to get the switches scanned. Then, lighting the leds will take...It's all doable but not until 30 pages of posts and no conclusion
You are typing far too fast JonAs a fun exeecise and as part of your quest for knowledge, can you wxplain how to read a switch matrix?
[
WHILE true
FOR x = 0 TO 4 //SET ALL PORTB BITS TO LOW and portC to high due to the bias on the diodes
portc.bits(x) = 1
portb.0 = 0 //first 5 switches
IF portb.0 = 1
THEN
Player(x) = 1 //When portC makes a switch on port B high this designates
END IF // the player that depressed their button only first 5 switches 0 to 4
NEXT
FOR Y = 0 TO 4 //SET ALL PORTB BITS TO LOW and portC to high due to the nias on the diodes
portc.bits(x) = 1
portb.1 = 0 // next set of 5 switches
IF portb.1 = 1
THEN
Player(x) = 1 //When portC makes a switch on port B high this designates
END IF // the player that depressed their button. only second 5 switches 5 - 9
NEXT
WEND
/QUOTE]
I was joking about writing to the input pins. Please don't write to portB. Remove the diodes.
Hi Burt,"If portb.0 = 1" Guess he still don't no that's saying it's a 1
== 1 is a test for 1 the = 1 your'll get a 1 even if it's a 0
It's a freaking input pin. You CAN'T write to it (well you CAN but it's not doing what you think it is).I put the portB.0 =1 to be sure it IS HIGH
nothing wrong with guaranteeing it is the desired logic level that you want?
It's a freaking input pin. You CAN'T write to it (well you CAN but it's not doing what you think it is).
If you want to ensure it's high then arrange your hardware to assert it high.