Changes for page Front I/O

Last modified by Kevin Wiki on 2024/07/07 22:48

From version 8.1
edited by Kevin Wiki
on 2024/07/05 12:23
Change comment: There is no comment for this version
To version 8.7
edited by Kevin Wiki
on 2024/07/07 22:21
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -265,7 +265,200 @@
265 265  {{/code}}
266 266  
267 267  
268 +Controlling middle IO strip
269 +
270 +0 = 0000
271 +1 (green) = 0001
272 +2 = 0010
273 +1 + 2 = 0011
274 +3 = 0100
275 +
276 +
277 +There are 4 words, each containing 7 data bits. They do not
278 +
279 +
280 += Controlling center LED columns =
281 +
282 +There are a total of 4 banks of addressable LED's 12 each of the total 48.
283 +
284 +
285 +|**Address Range (Binary)**|**Address Range (hex)**|**Size**|**Description**
286 +|0-7|00-07|1 byte|Ethernet indicator and LEDs bank-1
287 +|8-15|08-0F|1 byte|LEDs bank-2
288 +|16-23|10-17|1 byte|LEDs bank-3
289 +|24-31|18-1F|1 byte|LEDs bank-4
290 +
291 +[[attach:Address Ranges-Table 1.csv||target="_blank"]]
292 +
293 +|=**Address Banks**|=**LEDs Controlled**|=**Count**|=**Address Range (hex)**|=**Description**
294 +|=**Bank-1**|1 2 4 6 8 10 12|7|00-07|LED 1 ethernet indicator, even bottom half
295 +|=**Bank-2**|3 5 7 9 11 13|6|08-0F|Odd LED top half
296 +|=**Bank-3**|14 16 18 20 22 23 24|7|10-17|Even LED bottom half
297 +|=**Bank-4**|15 17 19 21|4|18-1F|Odd LED top half
298 +
299 +[[attach:LEDs per bank-Table 1.csv||target="_blank"]]
300 +
301 +
302 +|=Register Banks|=LEDs|=Count
303 +|=Bank 1|1 2 4 6 8 10 12|7
304 +|=Bank 2|3 5 7 9 11 13|6
305 +|=Bank 3|14 16 18 20 22 23 24|7
306 +|=Bank 4|15 17 19 21|4
307 +
308 +Script for writing all permutations to display:
309 +
310 +{{code language="c++"}}
311 +#include "Wire.h" // enable I2C bus
312 +
313 +byte saa1064 = 0x3B; // define the I2C bus address for our SAA1064 (pin 1 to GND) ****
314 +
315 +void setup()
316 +{
317 + Wire.begin(); // start up I2C bus
318 +}
319 +
320 +void write(int value) {
321 + Wire.beginTransmission(saa1064);
322 + Wire.write(1);
323 +
324 + Wire.write(value);
325 + Wire.write(value);
326 + Wire.write(value);
327 + Wire.write(value);
328 +
329 + Wire.endTransmission();
330 +}
331 +
332 +void loop() {
333 + for (int value = 0; value < 127; value++) {
334 + write(value);
335 + delay(300);
336 + }
337 +}
338 +{{/code}}
339 +
340 +Since LED positions don't map sequentially with LED number we can't address them in 10-base form, but we can define each LED in binary and use OR operator to display LEDs we want.
341 +
342 +{{code language="c++"}}
343 +#include "Wire.h" // enable I2C bus
344 +
345 +#define TCAADDR 0x70
346 +byte saa1064 = 0x3B; // define the I2C bus address for our SAA1064
347 +
348 +byte bank1;
349 +byte bank2;
350 +byte bank3;
351 +byte bank4;
352 +
353 +byte activityLED = 0b00000001;
354 +byte leds[23][4] = {
355 + {0b00000010, 0b00000000, 0b00000000, 0b00000000}, // 1
356 + {0b00000000, 0b00000010, 0b00000000, 0b00000000}, // 2
357 + {0b00000100, 0b00000000, 0b00000000, 0b00000000}, // 3
358 + {0b00000000, 0b00000100, 0b00000000, 0b00000000}, // 4
359 + {0b00001000, 0b00000000, 0b00000000, 0b00000000}, // 5
360 + {0b00000000, 0b00001000, 0b00000000, 0b00000000}, // 6
361 + {0b00010000, 0b00000000, 0b00000000, 0b00000000}, // 7
362 + {0b00000000, 0b00010000, 0b00000000, 0b00000000}, // 8
363 + {0b00100000, 0b00000000, 0b00000000, 0b00000000}, // 9
364 + {0b00000000, 0b00100000, 0b00000000, 0b00000000}, // 10
365 + {0b01000000, 0b00000000, 0b00000000, 0b00000000}, // 11
366 + {0b00000000, 0b01000000, 0b00000000, 0b00000000}, // 12
367 + {0b00000000, 0b00000000, 0b00000001, 0b00000000}, // 13
368 + {0b00000000, 0b00000000, 0b00000000, 0b00000001}, // 14
369 + {0b00000000, 0b00000000, 0b00000010, 0b00000000}, // 15
370 + {0b00000000, 0b00000000, 0b00000000, 0b00000010}, // 16
371 + {0b00000000, 0b00000000, 0b00000100, 0b00000000}, // 17
372 + {0b00000000, 0b00000000, 0b00000000, 0b00000100}, // 18
373 + {0b00000000, 0b00000000, 0b00001000, 0b00000000}, // 19
374 + {0b00000000, 0b00000000, 0b00000000, 0b00001000}, // 20
375 + {0b00000000, 0b00000000, 0b00010000, 0b00000000}, // 21
376 + {0b00000000, 0b00000000, 0b00100000, 0b00000000}, // 22
377 + {0b00000000, 0b00000000, 0b01000000, 0b00000000} // 23
378 +};
379 +
380 +void setup()
381 +{
382 + Serial.begin(9600);
383 + Wire.begin(); // start up I2C bus
384 +
385 + Serial.println("setting up ports");
386 +}
387 +
388 +void tcaselect(uint8_t i) {
389 + if (i > 7) return;
268 268  
391 + Wire.beginTransmission(TCAADDR);
392 + Wire.write(1 << i);
393 + Wire.endTransmission();
394 +}
395 +
396 +void selectLeft() { tcaselect(2); }
397 +void selectRight() { tcaselect(1); }
398 +
399 +void write() {
400 + Wire.beginTransmission(saa1064);
401 + Wire.write(1);
402 +
403 + Wire.write(bank1);
404 + Wire.write(bank2);
405 + Wire.write(bank3);
406 + Wire.write(bank4);
407 +
408 + Wire.endTransmission();
409 +}
410 +
411 +void resetBanks() {
412 + bank1 = 0;
413 + bank2 = 0;
414 + bank3 = 0;
415 + bank4 = 0;
416 +}
417 +
418 +void displayNumber(int number) {
419 + bank1 = leds[number - 1][0];
420 + bank2 = leds[number - 1][1];
421 + bank3 = leds[number - 1][2];
422 + bank4 = leds[number - 1][3];
423 +}
424 +
425 +void displayUpToNumber(int number) {
426 + for (int i = 0; i < number; i++) {
427 + bank1 = bank1 | leds[i][0];
428 + bank2 = bank2 | leds[i][1];
429 + bank3 = bank3 | leds[i][2];
430 + bank4 = bank4 | leds[i][3];
431 + }
432 +}
433 +
434 +void computeEthernetActivity() {
435 + bank1 = bank1 | activityLED;
436 +}
437 +
438 +void loop() {
439 + resetBanks();
440 + delay(10);
441 +
442 + displayUpToNumber(15);
443 + computeEthernetActivity();
444 +
445 + selectLeft();
446 + write();
447 + delay(2);
448 +
449 + selectRight();
450 + write();
451 + delay(1000);
452 +}
453 +{{/code}}
454 +
455 +
456 += Missing pieces, TODO =
457 +
458 +* how to control compute LED in top IO row
459 +* control warning button LED
460 +
461 +
269 269  )))
270 270  
271 271  
Address Ranges-Table 1.csv
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.kevin
Size
... ... @@ -1,0 +1,1 @@
1 +209 bytes
Content
... ... @@ -1,0 +1,6 @@
1 +Address Range (Binary);Address Range (hex);Size;Description
2 +0-7;00-07;1 byte;Ethernet indicator and LEDs bank-1
3 +8-15;08-0F;1 byte;LEDs bank-2
4 +16-23;10-17;1 byte;LEDs bank-3
5 +24-31;18-1F;1 byte;LEDs bank-4
6 +
LEDs per bank-Table 1.csv
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.kevin
Size
... ... @@ -1,0 +1,1 @@
1 +294 bytes
Content
... ... @@ -1,0 +1,6 @@
1 +Address Banks;LEDs Controlled;Count;Address Range (hex);Description
2 +Bank-1;1 2 4 6 8 10 12;7;00-07;LED 1 ethernet indicator, even bottom half
3 +Bank-2;3 5 7 9 11 13;6;08-0F;Odd LED top half
4 +Bank-3;14 16 18 20 22 23 24;7;10-17;Even LED bottom half
5 +Bank-4;15 17 19 21;4;18-1F;Odd LED top half
6 +