8x8 rows and columns

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
mblue
 
Posts: 6
Joined: Tue Aug 14, 2012 4:27 pm

8x8 rows and columns

Post by mblue »

I am using Python with an 8x8 backpack board.
I can see, from the schematic, that the "rows" are shifted by one, because the ROW0 pin is connected to the led matrix "row 1", ROW1 to matrix "row 2",,, etc, and the ROW7 pin is finally connected to matrix "row 0".
However, the way my code is working makes me think that the "columns" are also shifted by one.
For example, my code to turn on col0/row0 and col1/row1 is..

Code: Select all

# initialize bitmap buffer
for i in range(0, 16):
    dbuffer[i] = 0
dbuffer[0] = 0x01
dbuffer[14] = 0x80
smbus.write_block_data(ADDRESS, 1, dbuffer)
So to get matrix row 0 and 1, I am using list indexs 14 and 0, instead of 0 and 1.
However, I also have to use column values of 0x01 and 0x08, instead of 0x01 and 0x02.
Anyway, if any of the above makes sense, any clue to what is confusing me would be appreciated..

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: 8x8 rows and columns

Post by adafruit_support_rick »

What happens if you run our python code, ex_8x8_pixels.py?
Our driver indexes the columns as 0..7.

Which pixels light up if you do this:

Code: Select all

dbuffer[0] = 0x01
dbuffer[1] = 0x02

mblue
 
Posts: 6
Joined: Tue Aug 14, 2012 4:27 pm

Re: 8x8 rows and columns

Post by mblue »

When I set these bits..

Code: Select all

dbuffer[0] = 0x01
dbuffer[1] = 0x02
..only the LED at position row_1 (the second row) and col_1 (the second column) turns on.
I did not expect to see an LED light for the dbuffer[1] = 0x02, because I am sending a python list of 16 byte values, and I believe that only the even indexed values in the list are relevant for the 8x8 matrix, because pins ROW8 through ROW15 on the HT16K33 are not used (and that is what the odd indexed values in my list would control).
Let me know if I am wrong about the above.
I have a question about the 7-segment backpacks that is exactly related to this, but I will make a new post for it because I am starting to confuse myself..

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: 8x8 rows and columns

Post by adafruit_support_rick »

mblue wrote:I did not expect to see an LED light for the dbuffer[1] = 0x02, because I am sending a python list of 16 byte values, and I believe that only the even indexed values in the list are relevant for the 8x8 matrix,
Ohhh - you've got dbuffer typed as a byte array? No - you want to type it as an array of 16-bit integers. For each buffer element, send the low byte followed by the high byte.

That's what the arduino library does:

Code: Select all

void Adafruit_LEDBackpack::writeDisplay(void) {
  Wire.beginTransmission(i2c_addr);
  Wire.write((uint8_t)0x00); // start at address $00

  for (uint8_t i=0; i<8; i++) {
    Wire.write(displaybuffer[i] & 0xFF);    
    Wire.write(displaybuffer[i] >> 8);    
  }
  Wire.endTransmission();  
}

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”