Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

SEARCH feature is gone? Scrolling on an 8 x 8 matrix

Status
Not open for further replies.
So this is kind of fun. It's easy to scroll from right to left or left to right. Just change the scan order of the columns. Depending on what your scrolling, you don't even need to change the row data. The video shows 3 arrows scrolling from right to left, and then from left to right which was accomplished just by scanning the columns in the opposite order. If you did this with characters, they would be mirrored. The data is shown after the video.

(Click the picture to see the video)
th_IMG_2356_zps974401e6.jpg

I seem to recall MrDEB did something like this for bicycle blinkers....apparently by copy&paste(tm) programming, since this project has been such a mystery to him.

image.jpg
 
Last edited:
I already got my scrolling letters done about 6 days ago with a lot less code that I have yet to post here. AND YES I wrote the whole thing myself from what I have learned from looking at different codes and research how and why a particular command statement is used.
What gets me is in post #91 I COMPLEMENTED you about the fine article and I get bashed about it.
After I edit my code and add a better scrolling speed routine I will post a video.
 
This article is interesting reading. Have seen similar.
I have used the portb.bits(x) and yes it can get confusing but it is a valuable coding tool..
So far I give Jon a B+ for this informational article.
To add more confusion but helpful sometimes is portb(x),bits(y)


Uh huh. You sir are a piece of work. If indeed you "have seen similar" it's both a pity and a crime that you didn't actually read and understand them. If you had read and understood them, the hundred posts here, a dozen on Brad's forum and enough to nearly get you banned from the Swordfish forum would not have been necessary.

You are a victim of the Dunning-Kruger effect or perhaps an Internet troll baiting people to see how much they'll put up with.

Even the comedy of questions like "How do I change the name and value of a constant?" and replying with the version number of the PICkit GUI when told your compiler is obsolete is no longer enough to put up with this chr$(115) chr$(104) chr$(105) chr$(116).
 
Last edited:
There are a couple more topics to cover in As a Stomach Turns.... even if MrDEB has moved on to massacre.... I mean conquer... other projects. Call this the appendix.

What happens if we want to add a second or even third matrix so we can display more information instead of scrolling it across the matrix a character at a time? If we expand the current scheme, we'll need another port to drive the columns on each additional matrix - the rows are connected in parallel, so the single port can support many digits when multiplexing. Four ports (32 port pins) to drive a three-matrix display isn't very practical.

One method to expand our display would be to replace the ULN2803 with a serial/parallel shift register such as the TI TPIC6A596 Power Logic 8-bit Shift Register for each matrix. A single high bit is shifted out activating each row in turn. The shift registers cascade, the output of one feeding into the next. We'll need only three port pins to control any number of cascaded shift registers: clock, data and output enable.

The procedure is very similar to what we did previously:
1. Disable the shift register outputs.
2. Shift a single high bit into the register.
3. Set PortB to the data for the first column.
4. Enable the shift register outputs.
5. Wait a short period while column is displayed.
6. Disable the outputs.
7. Send one clock pulse to shift the single high bit.
8. Set PortB for the column output.
9. Enable the shift register outputs.
.... and so on.

There's a limitation to how many matrices we can support this way. In order to have a flick-free display, each additional display requires a faster scan rate and each column is activated for a shorter percentage of the time. Three matrices might be as many as are practical with this method. Each output of these shift registers can handle 350 mA so they have plenty of sink capacity. They cost less than two bucks.

There's an on-line simulator for '595 shift registers so you can see how they work. Remember, we want only one output sinking current at a time - one active column.
 
To put the finishing touches on this, I went the final step of scrolling out a message. Please excuse the missing row of the defective matrix.

(Click to see video)
th_IMG_2368_zpsc7a26f58.jpg

This uses the same program loop shown before. The program I created is geared towards displaying a fixed message rather than a variable message, so the character data is hard-coded. Two subroutines are used to load 5-pixel wide data (the font characters) and 8-pixel wide data (special symbols).

image.jpg


The data is loaded character by character; in between each character is a single-pixel "LetterSpace" and in between each word is a 3-pixel "WordSpace".

image.jpg


I found the font included in this package: LED Scrolling Dot Matrix Font & Graphics Generator. A little effort is needed to convert the data to Swordfish format (changing the hex prefix from 0x to $), which is quickly done using search and replace.
 
Really great stuff!! I know I am alone but I am not a big fan of those displays, they never seem to be even in colour or brightness, maybe its the cheap junk ones I buy. or maybe I just like soldering 64 Leds at a time. I dunno
I have been busy, Radio is on hold because dad cant help yet. And I am studying a different chip from pics. Really good stuff Jon but should be an article, shame to have it lost amongst the normal background noise
 
I agree LG....they are a few applications where these matrices do the job better than anything else, but in general, they are a pain to work with. Despite my bad luck in having two of these modules with defects, the dots actually appear uniform over the entire module – there is some unevenness in the video that isn't apparent to the eye.

I do have several 24x16 modules (3 arrays x 2 arrays) from Sure Electronics that include a controller chip. I think this is the way to go...and relieve the PIC from the busy work of doing the muxing. I guess I have an excuse to dig them out and see what I can do with them.


Not bad MrDEB. You need to position the letters closer together to make a readable sentence....

What current are you supplying to the LEDs? With "no extra hardware" how can you handle the current of potentially 8 LEDs into a single port pin? The absolute maximum current any port pin can sink is 25 mA. Surely you're driving the LEDs with more current than 3 mA each? I think the Absolute Maximum ratings shown below are for the PIC you're planning on using although all of the PIC 18f-series has similar limits.



image.jpg
 
Thanks for the complement

One main reason I am not using any shift registers or drivers is this is soldered to a 30mm x 30mm PCB so no room.
Am using 270 ohm resistors with 3v on the power supply. The final is a coin cell battery. Having issues with the soldering paste. Seems very dry but it works.
Current and battery life was another consideration for only going with 4 x 5 letters so I am sinking only a max of 50ma on any one port. I was experimenting with letter size etc. that's why the first few letters are far apart and the last letters are very close together.
Had an issue with scrolling speed working with the delayms() sections. I found that using DELAYUS(100) after portc is cleared worked very well compared to DELAYMS.
Need to clean up letters both upper case and lower case. Made a module with letters but have yet to see if I can incorporate into an INCLUDE statement. Not really needed but might be interesting to experiment. As I call my methods W-H-W ( What, How, Why)
Look at other codes and experiment with sections to see What it does, How it works and Why it does what it does.
I realize it may look willie nillie or putting the cart before the horse but its not.
 
You realize sinking 50 mA on one port pin exceeds the Absolute Maximum of the chip by a factor of two? There is no leeway in the Absolute Maximum ratings of a chip. Exceed those limits and there are no guarantees whether the chip will operate properly or even survive. If you're building these for somebody else, you may quickly look foolish when they die in an hour or two.

You don't need a delay after clearing the column before setting up the rows for the next column.
 
THANKS JON. YOU PUT ALOT OF EFFORT IN!

Please please dont do it again, as much as I learn from it and as good as the instruction is, I dont think anyone should be treated like!
Mr Deb call it what you want, but it isnt a method or experiment. Plain fact is you had information from everywhere, and you have managed to take a few bits and get it kind of working.
Without Jon you would still be blinking a led on the matrix. you owe him a dbt or at least a worthwhile acknowledgment for his time and effort. My words will ring true on the next project ;). I might be being harsh, you genuinely not realize just how much work jon put into this for you. Maybe you think he types at a pace faster than light, Its really sad to see someone profess to be christian and a church goer, not show the slightest sign of humility! The last few lines say's it all for me. You sound like your being cocky and think you got it working by using what you call your method. Read that Bible some more because there seems to be a few skipped pages!
Jon please dont post this amount of work again, it is genuinely upsetting to see someone put that amount of efffort in and get that kind of response throughout. I wont be reading these threads anymore, I have a feeling of what is behind the lack of decency and that makes it worse, I live with prejudice every day of my life. One other small fact about me, because I am different it makes me nervous, I dont mind pictures but I wont speak on video or skype (unless I know you well) why? Because I have at time a very BAD stutter.
Give the help where its appreciated jon, I will go read those threads. And no Mr Deb no point now coming back with some kind of excuse etc, bad manners are just that.
 
Thanks LG. Somehow I never seem to learn my lesson on helping MrDEB, but I'm going to work at ignoring that reply button.

I should probably drop the subject, but you're exactly right about the design/development process. I can give you an example. While MrDEB was busy copying&pasting(tm), post #17 was my first venture into "do it yourself" multiplexing and LED matrix displays. I had used 4-digit 7-segment displays before this, but always with a driver chip like a MAX7219 to handle all the busy work of driving the display. So post #17 was the result of thinking about what had to be done to drive the display. And the As A Stomach Turns.... was the first time I had fired up the hardware. So yep, you're exactly right. Do the homework to understand how to do a task, think about how to accomplish the task, and finally, start on the code.

In the As A Stomach Turns.... series, you see how I approached the process. Start at the low level of the hardware, making sure you have everything hooked up right and you have the concept of how things work correct, then proceed in small steps. Light up single dots, multiplex a simple pattern, scroll that simple pattern and then add more, a step at a time. So MrDEB and I reached the same point (more or less); I followed a logical process from start to finish. MrDEB spent far more time copying&pasting(tm) and asking dozens of questions showing his lack of homework and logical thought in at least 3 forums. I didn't know everything I needed off the top of my head. The Swordfish documentation and Google got a workout on some of the details and sometimes, you just roll up your sleeves and test until you get the syntax of a command right.
 
Last edited:
I appreciate the info Jon has posted and complemented his work on several occasions As far as humility, I have yet to condemn anyone's work and even defended Jon from getting banned a second time from this forum. I admit I know a lot less than most people on this forum but I like taking a hands on approach. The code I posted WORKS and was my own work, not copy n pasted. Lots of research into the help file and Swordfish reference file as well as looking at what other people have done similar.
Now on the sinking of current, I failed in the information I presented. I am scanning the cathodes as suggested thus preventing excessive current to any one pin. I am pushing the limit and should go with a higher value resistor. No I am not selling these to any one.
 
MrDEB, I don't think you understand how your circuit works. Yes, it's true you only turn on one cathode at a time. But that single cathode is connected to 8 anodes – current from EVERY LED in a column goes through one port pin. If you are operating the LEDs at more than 3 mA, you're exceeding the limits of the PIC.

Here's the picture from post 87 again so perhaps you can understand.

image.jpg
 
I understand what your saying that's why I am only using 20 leds out of 64 available. I got this idea from Brad who has several projects done similar. If I was using more LEDs then yes a driver chip such as the uln2008. In my bike turn signal I used a TD62783AFG to drive the matrix and a TLC5917 to sink the current. The TLC5917 allowed fewer resistors and equal brightness. Now I just need to build a Bi Colored matrix as the samples I have just are not bright enough and use a diffused lens. Purchased some 1000mcd water clear LEDs
You mentioned bad LED matrix's, I tested the ones I got on flea bay and 50% of them have a bad cathode connection inside. I should have tested before installing the first one. My Bad.
using this code seemed to work very well. Similar to your example.
Code:
DEVICE = 18F2420

CLOCK = 8
INCLUDE "convert.bas"
INCLUDE "InternalOscillator.bas"
INCLUDE "Utils.bas"       // Include this file when we compile so that we can use keywords like 'setalldigital'
DIM led(7) AS BYTE                     
// variable declaration                              
DIM x AS BYTE
DIM y AS BYTE
DIM index AS BYTE

CONST Anodes_data(8)AS BYTE = (%00000001,%00000010,%00000100,%00001000,%00010000,%00100000,%01000000,%10000000)             

CONST Cathodes_Data(8) AS BYTE = (%11111110,%11111101,%11111011,%11110111,%11101111,%11011111,%10111111,%01111111)

// Start Of Program
SetAllDigital                       // Make all Pins digital I/O's
TRISC = %00000000                   // Make PORTC all outputs
TRISB = %00000000                   // Make PORTB all outputs

// Main Loop
WHILE True()
FOR x = 0 TO 7
   FOR y = 0 TO 7
   portc=Anodes_data(y)
   portb=Cathodes_Data(x)
   
   DELAYMS(200)
   portc = %00000000
   DELAYMS(200)
   NEXT
NEXT
WEND
 
I think it is you who do not understand but my limit for explaining has been exceeded.

Glad you managed to do this all on your own, and with such fine understanding along the way. I guess I struggle with things like this and explain them just to clarify in my own mind. Perhaps someday I'll share your enlightenment, free of any burdens and inconveniences resulting from physics.
 
I didn't mean to sound ungratful, as I have learned a-lot from your explanations. I realize I am pushing the limits of the port pins .
One small detail that might be my saving grace is the forward voltage of the leds. I got to thinking about this when you mentioned 3ma. I couldn't figure out where you got 3ma but now I know, I forgot forward voltage of the leds.
And NO I havn't done this on my own. With your imput as well as others I am getting the hang of this.
 
Port pin can handle 25 mA. You have up to 8 LEDs on at a time (trust me on this – it's true),

25 mA / 8 LEDs = 3 mA per LED max. I don't know what current you're actually operating your LEDs at, since you're given up all pretense of posting any schematics for your "projects."
 
I should have posted a schematic sooner, sorry. Hopefully I get this schematic posted right. The Anodes have the resistors on on portC
Off topic question, when I heard about the helicopter crash in Seattle, I immediately though about you in Seattle and that your ok?
 

Attachments

  • 8 x 8 matrix.jpg
    8 x 8 matrix.jpg
    353.7 KB · Views: 230
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top