3x5 Matrix
5ms?
Posts: 21
Hi guys,
confusion,confusion.
Please, Any ideas.
-5ms
confusion,confusion.
Start: OUTPUT RB Main: FOR idx = 0 TO 3 READ Pattern + idx, RB ' move pattern to LEDs PAUSE 100 NEXT idx FOR idx = 4 TO 1 STEP -1 READ Pattern + idx, RB PAUSE 100 NEXT idx GOTO Main ' ------------------------------------------------------------------------- Pattern: ' LED patterns DATA %00000000 DATA %00011000 DATA %00111100 DATA %01111110 DATA %11111111 ' Good Good! nice and simple, Example :) ' --------------------------------------------------------------------------------------- ' ------------------------ Then My Code ------------------------------------------------- ' -------------------------- 3x5 Matrix ------------------------------------------------ ' --------------------------------------------------------------------------------------- ' ------------------ My logic disappears up it self ----------------------------------------- line1 VAR Byte(4) ' line 1 buffer ¿Bit? line2 VAR Byte(4) ' line 2 buffer line3 VAR Byte(4) ' line 3 buffer CommOut PIN RA.0 OUTPUT CommIn PIN RA.1 Butt1 PIN RA.2 Butt2 PIN RA.3 line1 PIN RB.0 OUTPUT, RB.1 OUTPUT, RB.2 OUTPUT, RB.3 OUTPUT, RB.4 OUTPUT ' ? line2 PIN RB.5 OUTPUT, RB.6 OUTPUT, RB.7 OUTPUT, RC.0 OUTPUT, RC.1 OUTPUT ' ? line3 PIN RC.2 OUTPUT, RC.3 OUTPUT, RC.4 OUTPUT, RC.5 OUTPUT, RC.6 OUTPUT ' ? Main: FOR idx = 0 TO 15 READ Pattern + idx, line1 ' move pattern to LEDs_line1 ' ? READ Pattern - idx, line2 ' move pattern to LEDs_line2 ' ? READ Pattern + idx, line3 ' move pattern to LEDs_line3 ' ? PAUSE 100 NEXT idx GOTO Main Pattern: ' LED patterns DATA %00000 DATA %10000 DATA %11000 DATA %11100 DATA %11110 DATA %10101 DATA %01110 DATA %11010 DATA %11001 DATA %10110 DATA %00110 DATA %00001 DATA %00011 DATA %00111 DATA %01111 DATA %11111 ' --------------------------------------------------------------------------------------- ' ------------------------------ Or maybe ----------------------------------------------- ' --------------------------------------------------------------------------------------- line1 VAR Bit(4) ' line 1 buffer line2 VAR Bit(4) ' line 2 buffer line3 VAR Bit(4) ' line 3 buffer line1.0 PIN RB.0 OUTPUT line1.1 PIN RB.1 OUTPUT line1.2 PIN RB.2 OUTPUT line1.3 PIN RB.3 OUTPUT line1.4 PIN RB.4 OUTPUT line2.0 PIN RB.5 OUTPUT ' so on ........ line3.0 PIN RC.2 OUTPUT ' so on ........
Please, Any ideas.
-5ms
Comments
Second, just make RB and RC outputs in one fell swoop (e.g. lineOut PIN RB OUTPUT)
Third, you need to change the comm pins BETWEEN each read. The idea is you turn on one "bank" of LEDs (these are columns/rows in a display matrix?), then read the pattern to the output pins. Then pause a tiny bit. Then turn off that bank and turn on the next bank (column?) and read the next pattern.
Even a hand drawn schematic would also help so we can see how you actually have things wired.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
Thanks for your INPUT [noparse]:)[/noparse]
A schematic.
and this... ok?
Also I'm not sure about your patterns -- you really want to write the same 5 bits to every line each time?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
Post Edited (Zoot) : 6/17/2009 3:42:51 AM GMT
Sorry for the slow reply.
I'm new to sxb, I've been looking at your code and trying to understand it, and experimenting
More than make my code work, I what to understand it.
Looking for moor information, Please, Zoot, or Anyone
binary numbers & concatenation:
So,
Q,1: "Can You concatenate binary numbers, or did You concatenate string".
Thanks for your time [noparse]:)[/noparse]
-5ms?
If you don't understand the difference between %0000 and $0000 and "0000" then it is time to read the documentation (%number is binary, $number is hex, "" is a byte string, which can only be used/handled under certain circumstances).
Yes, the temp gets ORed onto the BLANK (i.e. = 0) Word. A Word is 16bits. I used a Word as a buffer (a place to build up the final state of the LED pins) because you have 15 pins you are controlling. The 5 bits you need for each bank are read, but then shifted over 5 bits each time so it is ORed onto the appropriate 5 bit "chunk" of pins. The best I can try to do here is add more commentary to the code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php