Discuss What is the best signal interface for PC ? in the UK Electrical Forum area at ElectriciansForums.net

Exactly.
Here is the actual program for 'letter A' that I made and presented in the movie.
You may not understand everything but read the entire program anyway and you will get something out of it. I've also put notes what is line and what is column.
(it was imperative to switch to Input everything after each step, with my custom Reset(); method, otherwise it was liting up the entire next line or column)
Remember a line is HIGH because is +5V and a column is LOW because is 0V. So we lit a single line putting +5V on line01(for ex) and 0v on each desired column.
Code:
#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();
}
I counted 7 one millisecond delays, one after the other in this sub-routine. I suppose for now that from the start to end of this sub-routine takes of the order 7mS. I cannot quickly work out if 7mS is to generate a single column of 7 LEDs, a single line of 5 LEDs or all 35 LEDs. Please check my analysis because I am pretty sure I have not completely understood your code. You understand how you have written the code so ought to be able to arrive at figure of about 30Hz or lower which you mentioned earlier.

If 7mS is for all 35 LEDs then the refresh rate is 1/0.007 = 140Hz.
If 7mS is for a column of 7 LEDs, and there are 5 columns the refresh rate is 140/5 = 28Hz.
If 7mS is for a line of 5 LEDs and their are 7 lines the refresh rate is 140/7 = 20Hz

Why do have delay command at all in this sub routine?
 
Last edited:
My progress so far. The eeprom addressed by sequential logic to find the five 7 bit data words to form the font for N. Refresh rate is about 200Hz ie A complete N two hundred times every second. Clock is 1kHz and 1000/5 = 200Hz where 5 is number of columns. And letter B too. 😀
 

Attachments

  • A3583F2E-C0FB-4A9A-BD08-0A5449771EC4.jpeg
    566.9 KB · Views: 11
  • D665625C-DA1F-480C-A5C3-A5E7357386BD.jpeg
    523.5 KB · Views: 10
Last edited:
Congratulations mister @marconi
Now put a movie with it and your comments !
I managed to optimize my code and now is less flicker that original. Its still a vibration but really almost not visible at all. I also installed a second mcp23017 library and all last night and until now today, I stay on it, but it has some very-very weird logic inside that I could only partially descypher. So no complete descypher at the moment of this second library that is promising greater potential, since is more close to a PIC program and also closer to our simplified schematic diagram. I literally hammer it last night, im very tired from it. But I learned some interesting stuff doing it, very technical and very in the programming domain. Just putting on the table what I did.
 
Good morning mister @marconi ,
Here is something interesting... Im not sure how much may have been influenced my program testing so far, I will have to make a more extensive research on this particular detail, but in time. For the momment, with the programs I run already, I didnt really observed much of a difference to be honest. But it crossed my mind that this little bugger might be important in some special cases, special programs. Time will tell.
So here it is - full view:
20220823_010134.jpg

The blue lines represent the Ground or 0V. I marked with a square the 0V marking next to the metalic pad from which the wire is going beneath the cardboard to that long track on which, each negative pin for all the LEDs are connected. So what I have there is a pull down connection through each 12k resistor put in series to each LED to ground.
Screenshot_1.jpg

This problem I realize it yesterday, when I was programming and was meditating to the fact those pins from the IC are not really floating or inAir. I then realized they are actually pulled to ground through each led. And today, I mounted that little switch only between this rail for all the leds and 0V. I tested a couple of normal programs but no visible difference. Ill have to test some in depth programs that I have 'somewhere' that really needs some floating pins. I really hope it will be a difference this time. If not, then, daaaaeeem.
 
q12x. You asked for a video. The letters A to O represent the 16 states of the 4 bit Gray code. The 4 white leds top right are the 4 bit Gray Code. The two 7 segments are numbered representation for the first 12 states of the Gray Code - last 4 states are not decoded because I ran out of space on my home made ROM on the brown veroboard. The eeprom is on the bottom right board on the far right. Enjoy 😊
 

Attachments

  • FullSizeRender 26.mp4
    25.7 MB
May I suggest a way ahead? It is a seven step approach.

1. Design a way to repetitively scan the 7 x 5 column by column. I showed this in my first video.

2. Now introduce a way to display one pattern of column data say 1010101 which scrolls from left to write on the 7 x 5.

3. Now form a 7 x 5 data table in software.

4. Now write a sub routine to read the data table column by column . Load the data into a 7 bit register.

5. Now add some code to indicate the column number and write this into a register.

6. In hardware make a circuit as I showed you earlier which takes as its input the data in the column and column number at paras 4 and 5.

7. Now load table with chequerboard pattern of bits and check 7 x 5 displays it correctly.

You now have way of displaying anything you write into data table. And this table can change over time if you wish.
 
Good morning mister @marconi ,
Here is something interesting... Im not sure how much may have been influenced my program testing so far, I will have to make a more extensive research on this particular detail, but in time. For the momment, with the programs I run already, I didnt really observed much of a difference to be honest. But it crossed my mind that this little bugger might be important in some special cases, special programs. Time will tell.
So here it is - full view:
View attachment 100791
The blue lines represent the Ground or 0V. I marked with a square the 0V marking next to the metalic pad from which the wire is going beneath the cardboard to that long track on which, each negative pin for all the LEDs are connected. So what I have there is a pull down connection through each 12k resistor put in series to each LED to ground.
View attachment 100792
This problem I realize it yesterday, when I was programming and was meditating to the fact those pins from the IC are not really floating or inAir. I then realized they are actually pulled to ground through each led. And today, I mounted that little switch only between this rail for all the leds and 0V. I tested a couple of normal programs but no visible difference. Ill have to test some in depth programs that I have 'somewhere' that really needs some floating pins. I really hope it will be a difference this time. If not, then, daaaaeeem.
I do not immediately see the connection between the potential of the outputs and its impact on your time problem.
 
I do not immediately see the connection between the potential of the outputs and its impact on your time problem.
First off all, congratulation on the movie and showing the full working project. Very fascinating !!!
I still have to try it your way someday, in the future.
-to your question now: - Well, when a pin of the IC is floating , it is not 0V nor 5V. Right? But by having all those leds and resistors to 0V, I efectively put to 0V every IO pin of the chip. THus, not leaving anything really floating. This is important in code, when I am switching from Outputs to Inputs. By switching to Inputs is the programming way of 'floating' the Output. By inversing it. Its a trick learned when I was programming PIC's MCU's. But... having all these pins to 0V ---anyway--- , it doesnt matter if I was switching to Input or to Output in code, because the state was 0V anyway. So the speed was not affected but the entire logic of the code was affected, which is more important and more drastic. I hope is more clear now what I did there.
 
New posts

Reply to What is the best signal interface for PC ? in the UK Electrical Forum area at ElectriciansForums.net

Similar Threads

Hello ! I am building for some time a cct to drive a 3digit multiplexed LCD. (from aliexpress) From the sellers on aliexpress I managed to find...
Replies
7
Views
1K
Hi there, I'm currently working on a project where I'd like to slowly fade the brightness of a series of high brightness RGBW LEDs. Basically...
Replies
3
Views
945
My view on life, in any field, is not to produce more but to consume less. Everybody told me this is a very eccentric weird mentality. Perhaps...
Replies
12
Views
2K
Hello there! To start, I have to say that I'm a very beginner with electrical stuff, I'm working in IT and today I face a challenge that I can...
Replies
2
Views
4K
I hear many views of people who believe that DPF's and CDPF's fitted to their vehicles are a problem and many people resort to removing them, or...
Replies
0
Views
8K

OFFICIAL SPONSORS

Electrical Goods - Electrical Tools - Brand Names Electrician Courses Green Electrical Goods PCB Way Electrical Goods - Electrical Tools - Brand Names Pushfit Wire Connectors Electric Underfloor Heating Electrician Courses
These Official Forum Sponsors May Provide Discounts to Regular Forum Members - If you would like to sponsor us then CLICK HERE and post a thread with who you are, and we'll send you some stats etc

YOUR Unread Posts

This website was designed, optimised and is hosted by untold.media Operating under the name Untold Media since 2001.
Back
Top
AdBlock Detected

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.

I've Disabled AdBlock