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.

Half way done and wish I had made a PCboard

Status
Not open for further replies.
I'm sorry. It was my mistake in being unclear. I forget that you still don't understand that a port consists of eight bits. Silly me – expecting you to understand the common vocabulary.
 
Looked at the data sheet and several websites using the Max7219. Boy that chip is really useful. Looking to use on my bike project I have on the back shelf. Looks like it might work out better??
Now to look on Ebay for a good price just for the chip or a kit but just chips might be better way to go.
 
No.

This chart shows the Vf of the matrices you have for your little blinker project. It can be as high as 5 volts.

image.jpg


The graph below shows the current drive vs Vf of the MAX7219. It falls to nothing before Vf gets to 5v.

image.jpg

Yes, you can design to the "typical" specification, but that runs the risk that the circuit won't work with parts that are within spec.

This problem was debated ad nauseam in the pages and pages of discussion on this project in the past. I will not be participating in any further debate.

One solution is presented here: High Voltage LED Driver....
 
No.

This chart shows the Vf of the matrices you have for your little blinker project. It can be as high as 5 volts.

View attachment 87484

JonSea,

Where did that table come from?

Those Vf numbers are about twice what my experience with LEDs has been. Is that table for a special LED? Maybe one that has two series chips in one package?
 
I think Jon is referring to my 5 x 7 matrix I had planed to use.

The matrix that I had planed to use has two chips per color but am redesigning the matrix display since the one I was using had 650-700MCD diffused lens leds. Kingbright TBC40-12SURKCGKWA.
My new design is a scratch built 5 x 7 bi color matrix with 2000mcd water clear leds. Just have too many items on my plate until Sept 1st. to do any more with that project. Am using a constant sink chip on the cathodes and maybe the max7219 might be a better choice but will look at options after Sept 1st.
I can see where the Vf would go to zero using two chips in series. Another reason for different LEDs in my scratch matrix.
 
Chris,

The chart is for a large **broken link removed** MrDEB said he wanted to use. Each dot has two LEDs in series.
 
That's correct but the display in broad daylite was hard to see so experimenting with 2000mcd leds w/ water clear lens. That water clear lens makes a big difference.
Contemplated going with the 1 to 3 watt leds but they draw way to much current for a battery powered device.
 
Received the MAX7219 kits from Ebay so the 74HC595 board is put off for another time. I got the display to come on but getting the results to be what I want is another day.
In the meantime I assembled one MAX7219 kit and the matrix display comes on but needs work. I figured the KISS approach is the better route. Well here is the code I am working with but feel I am missing something??
Code:
{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 7/21/2014                                                      *
*  Version : 1.0                                                            *
*  Notes   :  Using the MAX7219 kit from Ebay and Tap 28 w/ crystal                                                              *
*          :                                                                *
*****************************************************************************
}

DEVICE = 18F2420
CLOCK = 20

INCLUDE "shift.bas"
INCLUDE "utils.bas"
INCLUDE "convert.bas"
   ' INCLUDE "DS18B20.bas"
INCLUDE "Utils.bas"


DIM Loadpin  AS PORTC.3   // LATCH
DIM Datapin AS PORTC.4  // DATA
DIM Clockpin AS PORTC.3  // CLOCK
DIM count AS BYTE
DIM X AS BYTE  
DIM index AS BYTE


CONST Anodes(32)AS BYTE = (%00000001, %00000010, %00000100, %00001000, %00010000,%00000001, %00000010, %00000100,
                          %00001000, %00010000, %00100000, %01000000, %10000000,%00100000, %01000000, %10000000,
                          %00000001, %00000010, %00000100, %00001000, %00010000,%00000001, %00000010, %00000100,
                          %00001000, %00010000, %00100000, %01000000, %10000000,%00100000, %01000000, %10000000)  
                        
                          
CONST Cathodes(2) AS BYTE = (%11111111, %00000000)
                           
                             
                            
SUB RIGHT()
    DIM index AS BYTE
    DIM X AS BYTE
    
    FOR index = 0 TO BOUND (Anodes)
      Loadpin = 0
       ' DELAYuS(100)//10 500us for constant on
        X = Anodes(index)
        Shift.Out(MSB_FIRST, X ,8) 
     
        DELAYUS(20) //20 us
    
    NEXT
END SUB
// start of main
SetAllDigital
Shift.SetOutput(DataPin)   // data out pin  (RC4)
Shift.SetClock(ClockPin)   // shift reg clock (RC5)
loadpin = 0             // make output and set low


TRISB = %00000000       // make PORTB outputs
TRISC = %00000000       // make PORTC as outputs

OUTPUT(loadpin)
WHILE true
RIGHT()

WEND
END
 
...Well here is the code I am working with but feel I am missing something??...

Well, to be brutally blunt, you are missing virtually EVERYTHING.

The MAX7219 is not a '595 shift register chip and operates totally differently.

To start with, you must send data to several registers just to get the chip set up. Table 7 from the AS1106 (identical to the MAX7219 with a couple additional features) lists the registers of the chip. You have to set up registers 9, 10, 11 & 12 before you can make the chip do anything.

image.jpg


You need to set the decode register (9) to no-decode (%00000000) since you're using a matrix and not 7-segment displays.

You need to set the scan limit register (11) to scan all 8 columns (%00000111).

You need to set the shutdown register (12) to (%00000001) to turn the display on.

You'll want to figure out the intensity control resister too.

After that, the rest is easy. Send the data for column 1 to register 1, column 2 to register 2 and so on.

Read the data sheet. The AS1106 sheet is somewhat easier to understand. The only way you can make this chip work is to understand the data sheet. These chips are quite easy to use.

image.jpg
 
Here are some of the routines I use to write to the MAX7219.

The WriteLED subroutine writes the data specified in LED_Data to the register specified by LED_Reg.

InitLED sets up the registers I mentioned above to my needs. You may need different values but it shows you how to do it.

ClearLED blanks all the elements.

TestMode illuminates all the segments when true and goes into normal mode when false.

Lets say you want every other dot on in column 1:

Code:
LED_Data = %10101010

LED_Reg = 1

WriteLED

You don't need to do anything regarding multiplexing. The MAX7219 handles everything.

I suggest you create a pattern to should you have control of the chip. Perhaps 1 LED illuminated in column 1, 2 in column 2, 3 in column 4, etc.

(Sorry, no copying allowed – take the time and effort to understand the following.)

image.jpg
 
One final bit of help. The listing below shows the needed includes and variable assignments. Set up the clock/data/latch pins to the MAX7219 according to your arrangement – it may be different than mine.

Also note: the "digits" in the MAX7219 data sheet correspond to columns on the matrix, and they may run from left to right or right to left depending on how the board is laid out. The 8 bits of data you write to each digit register are the dots you want illuminated in that column. LSB – MSB may go from bottom to top or top to bottom depending on how the board is laid out.

image.jpg
 
I was looking at the register set up and see where I made my error about 4:30 this morning.
Am trying to get just one led to scan from right to left.
Going to have a look at the AS1106 data sheet
Will give it a whirl after I get the registers set right. I thought the LEDs were kinda bright.
THANKS
 
If the code you posted in post #49 managed to get any output from the MAX7219, I would be astonished. The chip defaults to the shutdown state until the correct register is set.

If the code posted is what you actually used, the following error may have bombarded it with enough crap (an infinite number of monkeys typing on typewriters....)

Nowhere do you assert the load pin, which is necessary to put the data in the chip....but....in the dimension statements you've set the clock and load pins to the same port pin, so you may be strobing the latch pin with every bit transferred. Some combination of the resulting junk may have turned on the chip.

image.jpg
 
Wait...."received the MAX7219 kits from eBay"....

Are these the 4 matrix boards I mentioned, that use an HT1632C driver? Or a single matrix display with a MAX7219 driver?

You realize they require completely different code don't you? Probably not since you were shoving '595 data into a MAX7219....
 
single matrix display with the MAX7219
Deciphering the code you posted and the one you used for a 7 seg display both have the line of code with
Data_Out = 256* LED_Reg + LED_Data.
am I interrupting this as the method to input the option registers then the data desired?
And yes using the posted code I got lots of monkeys going wild.
As I mentioned, I took a fresh look at the data sheet at 4:30 this morning and your posted 7 seg code over at DDIY and realized my error of not addressing the 16 registers properly. Also studying the Arduino code for same.
**broken link removed**
Arduino Playground - Max7219
 
....Deciphering the code you posted and the one you used for a 7 seg display both have the line of code with
Data_Out = 256* LED_Reg + LED_Data.
am I interrupting this as the method to input the option registers then the data desired?....


You have to write DATA to REGISTERS to set the chip parameters AND you have to write DATA to REGISTERS to turn bits on or off. DATA to REGISTERS is DATA to REGISTERS, as I explained above. Write the necessary DATA to the setup REGISTERS and the desired DATA to the data REGISTERS by

Setting LED_reg to the REGISTER NUMBER,

Setting LED_data to the desired DATA and calling

WriteLED

just as I already explained.

Please throw all of your existing code away and start over. Almost none of it applies to the MAX7219 board.


image.jpg
 
For your program, include the subroutines above. In the InitLED routine, you want no-decode, as shown, and you want to set the scan limit to 8 to drive all 8 columns.

Then the program consists of the initial stuff above (my stuff, not yours) followed by

Code:
InitLED 'sets up the registers

While 1 = 1

LED_Reg = 1
LED_Data = %00000001
WriteLED

LED_Reg = 2
LED_Data = %00000010
WriteLED

LED_Reg = 3
LED_Data = %00000100
WriteLED

LED_Reg = 4
LED_Data = %00001000
WriteLED

LED_Reg = 5
LED_Data = %00010000
WriteLED

LED_Reg = 6
LED_Data = %00100000
WriteLED

LED_Reg = 7
LED_Data = %01000000
WriteLED

LED_Reg = 8
LED_Data = %10000000
WriteLED

DelayMS(1000)

ClearLED

DelayMS(1000)

Wend


What SHOULD this do? What DOES it do?

Again, don't add anything to my code while you try this out. No constant arrays. Make this work, FIGURE OUT WHY IT WORKS AND ONLY THEN MAKE CHANGES.
 
THANKS
I have already started over with entirely new code.
One thing that has bothered me is in this code you posted **broken link removed** I see no where the LED_Reg is defined in a DIM statement??
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top