Discuss What is the best signal interface for PC ? in the UK Electrical Forum area at ElectriciansForums.net
So do you select in software one LED at a time by setting one of the line bits and one of the column bits? And then send this data to the MCP23017? Thus to illuminate say all 35 LEDs you have to sequence through 35 pairs of line and column bits (Column, Line). Each data transfer to the MCP23017 has a cycle time Tc - I have yet to find out what this time is. Thus to refresh completely the 35 LEDs will take a time of 35 x Tc - this is the time necessary to send 35 pairs of (Line, Column) messages. This is a slow way to control the 7 x5 display. You could use the 16 bits data outputs in the format ( C1, C2, C3, C4, C5, X, X, X, L1, L2, L3, L4, L5, L6, L7, X) to illuminate a combination of 7 LEDs in one column using one data transfer, and thus the whole display in 5 data transfers - a considerable reduction in data transfer time from 35 Tc to 5 Tc. (The X means not used).
To do this you would have to add some simple hardware to the 7 x 5 display - some transistors and resistors to interpret the 16 bit data word into switches to control the application of 5V and 0V to the LED array. The scanning has to be done column by column to take advantage of the common cathode arrangement inside the array.
Exactly.So do you select in software one LED at a time by setting one of the line bits and one of the column bits? And then send this data to the MCP23017?
#include "Arduino.h" //core library that contains all of the Arduino’s built-in functions (from 2022)
#include <Adafruit_MCP23X17.h> //this is Adafruit-MCP23017-Arduino-Library version 2.1.0
Adafruit_MCP23X17 mcp1; //Instantiate mcp1 object
void setup()
{
Serial.begin(19200);
mcp1.begin_I2C(0x20);
for(int i = 0; i <= 15; i++)
{
mcp1.pinMode(i, INPUT);
}
for(int i = 0; i <=15; i++)
{
mcp1.digitalWrite(i, LOW);
}
//LED MATRIX DISPLAY - Single LED - one by one
/* LOGIC:
//Columns----------------------------------------
// mcp1.digitalWrite(1, LOW); //A1=1=column A
// mcp1.digitalWrite(10, LOW);//B1=10=column B
// mcp1.digitalWrite(3, LOW); //A3=3=column C middle
// mcp1.digitalWrite(11, LOW);//B2=11=column C middle
// mcp1.digitalWrite(4, LOW); //A4=4=column D
// mcp1.digitalWrite(13, LOW);//B6=13=column E
//Lines----------------------------------------
// mcp1.digitalWrite(5, HIGH);//Line1
// mcp1.digitalWrite(0, HIGH);//Line2
// mcp1.digitalWrite(6, HIGH);//Line3
// mcp1.digitalWrite(2, HIGH);//Line4
// mcp1.digitalWrite(12, HIGH);//Line4
// mcp1.digitalWrite(8, HIGH);//Line5
// mcp1.digitalWrite(14, HIGH);//Line6
// mcp1.digitalWrite(9, HIGH);//Line7
*/
}
void Reset()
{
for(int i = 0; i <=15; i++)
{
mcp1.pinMode(i, INPUT);
mcp1.digitalWrite(i, LOW);
}
}
int dly = 1;
void chr_A()
{
//line1
mcp1.pinMode(5, OUTPUT); //line
mcp1.digitalWrite(5, HIGH);
mcp1.pinMode(10, OUTPUT); //column
mcp1.digitalWrite(10, LOW);
mcp1.pinMode(3, OUTPUT); //column
mcp1.digitalWrite(3, LOW);
mcp1.pinMode(4, OUTPUT); //column
mcp1.digitalWrite(4, LOW);
delay(dly);
Reset();
//line2
mcp1.pinMode(0, OUTPUT); //line
mcp1.digitalWrite(0, HIGH);
mcp1.pinMode(1, OUTPUT); //column
mcp1.digitalWrite(1, LOW);
mcp1.pinMode(13, OUTPUT); //column
mcp1.digitalWrite(13, LOW);
delay(dly);
Reset();
//line3
mcp1.pinMode(6, OUTPUT); //line
mcp1.digitalWrite(6, HIGH);
mcp1.pinMode(1, OUTPUT); //column
mcp1.digitalWrite(1, LOW);
mcp1.pinMode(13, OUTPUT); //column
mcp1.digitalWrite(13, LOW);
delay(dly);
Reset();
//line4-midle
mcp1.pinMode(2, OUTPUT); //line
mcp1.digitalWrite(2, HIGH);
mcp1.pinMode(1, OUTPUT); //column
mcp1.digitalWrite(1, LOW);
mcp1.pinMode(10, OUTPUT); //column
mcp1.digitalWrite(10, LOW);
mcp1.pinMode(3, OUTPUT); //column
mcp1.digitalWrite(3, LOW);
mcp1.pinMode(4, OUTPUT); //column
mcp1.digitalWrite(4, LOW);
mcp1.pinMode(13, OUTPUT); //column
mcp1.digitalWrite(13, LOW);
delay(dly);
Reset();
//line5
mcp1.pinMode(8, OUTPUT); //line
mcp1.digitalWrite(8, HIGH);
mcp1.pinMode(1, OUTPUT); //column
mcp1.digitalWrite(1, LOW);
mcp1.pinMode(13, OUTPUT); //column
mcp1.digitalWrite(13, LOW);
delay(dly);
Reset();
//line6
mcp1.pinMode(14, OUTPUT); //line
mcp1.digitalWrite(14, HIGH);
mcp1.pinMode(1, OUTPUT); //column
mcp1.digitalWrite(1, LOW);
mcp1.pinMode(13, OUTPUT); //column
mcp1.digitalWrite(13, LOW);
delay(dly);
Reset();
//line7
mcp1.pinMode(9, OUTPUT); //line
mcp1.digitalWrite(9, HIGH);
mcp1.pinMode(1, OUTPUT); //column
mcp1.digitalWrite(1, LOW);
mcp1.pinMode(13, OUTPUT); //column
mcp1.digitalWrite(13, LOW);
delay(dly);
Reset();
}
void loop()
{
chr_A();
}
Reply to What is the best signal interface for PC ? in the UK Electrical Forum area at ElectriciansForums.net
We get it, advertisements are annoying!
Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.