Shop OBEX P1 Docs P2 Docs Learn Events
reverse polarity to a Max 7219 — Parallax Forums

reverse polarity to a Max 7219

youngbillyoungbill Posts: 54
edited 2010-10-17 00:10 in BASIC Stamp
Does anyone know if reverse polarity will damage a max 7219?
Any suggestions on how to test it?
Is there a replacement for the 7219? Last time was 4 years ago when i built my project, the 7219 was going out of production then i believe.

My hookup is the same as on page 136 of programming and customizing the basic stamp by scott edwards,, Debug seems to show the code is counting,yet no segments light. Any one have a extremely simple code,,just for testing the max.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-10-03 15:28
    Unless the datasheet says that the part is designed to withstand reverse polarity (true for some voltage regulators), you can be sure that reverse polarity will destroy the part very very quickly.

    Maxim's website says that it's still in production.

    Please do not post duplicate messages. That's against forum rules.
  • youngbillyoungbill Posts: 54
    edited 2010-10-07 20:41
    here was the code,,That was running a counter style clock. with a max 7219It does not seem to work, and I need help to trouble shoot the code or hardware.
    Where do I modify the code to make it go into test mode ,,,( ie light all digits ) I tried changing init,,

    ,FOR index = 1 TO 8
    LOOKUP index, [Scan, 7, Brite, 14, Decode, $FF, ShutDn, 1], d7219

    in the lookup index,,the last address,and data shutDn,from 1 to zero,,,and i tryed to add test,1 but nothing lights the segments.

    and any suggestions on how and where to use DEBUG to find the problem.
    Many thanks,,,to chris,,and metron9 who helped me in 2006 on the origional design.
    jonw
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2010-10-08 05:25
    I ordered some free sample of the MAX7219CNG+ to try this my self
    and let you know what happens
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-10-08 08:38
    The code as you have it listed will not work. By using an index relative to 1 instead of 0 you miss the first element in the data array you're referencing.

    Instead of FOR index = 1 TO 8 it should read FOR index = 0 TO 7
  • youngbillyoungbill Posts: 54
    edited 2010-10-08 13:18
    Yes,,I see there is two indexs..( or one used for two purposes).
    The one for initialization needs 0 to 7 , and the index for digits needs to start at one.
    I do not understand two things about initialization,
    #1 we declare index to be a byte ( size ) as such as maximum 255,How can lookup index hold 8 pairs (address,and data to init the max) I assume its reserved more space than 256,,oh,,i think I see it now,,,,256 different address's but with the value in the address being as much as 65535,,( where does this 65535 number come from?)
    And #2,,,I am still confused on initializing the max 7219,,,,we have index 0 to 7,,,,,,to send a series of reg addresses paired with their desired values.

    ie,,,,scan =3
    bright =10
    decode =%1111
    shutdn - 1

    thats four address and 4 values,,,,,ahh maybe thats why I can not get the max to go into test mode,,,,I may need set index 0 to 9,,,and add TEST 1
    Will try this,
    My posted code does not work,,( I lost my origional working code )..but I would like to learn how to use debug to learn how to trouble shoot my code.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-10-08 14:49
    Bill,

    The data are one byte each. The routine is reading pairs of data only in the sense that the first byte is the command and the next is the data. But it is still a single byte being read one at a time, therefore only 8-bits max per read and sent to the MAX7219.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2010-10-08 17:06
    Please try this code and see if you can get all digits to light
    I do not have a MAX7219 chip right now to test this code

    Please let me know what this dose when you try it

    Look at this Table in the Data Sheet you will see that you have send all the data in one line

    I could wrong about this how ever I wrote some code for a Max1497 ADC 3.5 Digit Meter Chip
    and had to learn how to read and write to this chip be able get the data out of this chip
    Table 1. Serial-Data Format (16 Bits)

    SHIFTOUT DataIn, Clock, MSBFIRST, [%0000111111111111]

    You may have to put this in a DO LOOP


    ' REGISTER D15–D12 D11 D10 D9 D8 HEX CODE
    '
    ' Decode Mode X 1 0 0 1 xX9
    ' Display Test X 1 1 1 1 0xXF
    '
    '
    ' Shutdown Register Format (Address (Hex)
    '
    ' MODE D7 D6 D5 D4 D3 D2 D1 D0 Address CODE(HEX)
    '
    'Shutdown X X X X X X X 0 0xXC
    'Normal Operation X X X X X X X 1
    '

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    CS PIN 0
    Clock PIN 1
    DataIn PIN 2


    start:
    LOW CS
    SHIFTOUT DataIn, Clock, MSBFIRST, [%0000111111111111]
    high cs
    END
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-10-08 21:18
    At one point I posted a small segment of code that just activates the test mode on the MAX7219...now where in this plethora of messages could that be?
  • youngbillyoungbill Posts: 54
    edited 2010-10-09 02:03
    sam 2 I think your code will need to initialized the max first, Here is a code i
    found called AppKit from the parallax site.
    I tried it ,but nothing,then i must have found,a short on the display board,,because I reset test mode to $0f01 and i had 6 digits lit..( I don't know why 6 digits...i have wired it according to scott edwards book ,,programming the stamp.
    BUT,,,when i changed back to normal mode $0f00,,,I have nothing lit again.
    Yet i see its counting in debug.

    One thing i find funny about this code,,is the end of the subroutine,,,shiftout msb first,,,then alot of code id executed,,,flags and z...and then they shiftout the data,,,,,,will that work,,,,or will data be lost.

    So now wat,,,any suggestions

    The paper says,,this is a 5 digit display,,,up to 65535,,,yet my debug is only going to 9 then looping?
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2010-10-09 05:47
    Can you post the link where you found this write up and code can be found thanks
  • hover1hover1 Posts: 1,929
    edited 2010-10-09 05:57
    Was it one of these?

    http://www.parallax.com/SearchResults/tabid/37/Default.aspx?Search=MAX7219

    (Parallax home page > Search > Site > MAX 7219)

    Jim
  • youngbillyoungbill Posts: 54
    edited 2010-10-09 10:40
    Sam 3 , It was years ago I saw it sorry, But I finally got my old "clock" counter to work this morning,,,The problem WAS in the initialization all along.
    I added For index 0 to 9,,,so I could use all segments ON test mode, It is a computer generated clock,,,ie not a real time clock,,,but what I want to do is follow the max app notes (# 1196 ,,,using the max to drive higher voltage or current),,, and drive a larger display,,here is a working code,,Thanks for your reply
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2010-10-10 11:17
    Thanks for sharing your code

    I want to do this with a DS1302 time chip and Maybe a MAX186


    Chris Savage

    At one point I posted a small segment of code that just activates the test mode on the MAX7219...now where in this plethora of messages could that be?


    Chris see if you can find that code that you wrote a small segment of code that just activates the test mode on the MAX7219
    Thanks for any thing that you can post
  • youngbillyoungbill Posts: 54
    edited 2010-10-10 14:03
    sam ,the max comes shipped in shutdn mode,Thats why you need to initialize it .
    Most of the code you see posted says index 0 to 7....and that gives max enough info to be usable, I found that making the index 0 to 9,,,I can include the test mode
    By sending $0F01 ( $0F00 to restore normal operation )to address 15 or address 0x0C,,,see the data sheet
    or in other words you need to sst the LSB of register 0x0C to 1 for test

    Decode CON $09 ' BCD Decode Register
    Brite CON $0A ' Intensity Register
    Scan CON $0B ' Scan Limit Register
    ShutDn CON $0C ' Shutdown Register (1 = On)
    Test CON $0F ' Display Test Mode
    Blank CON %1111 ' Blank A Digit
    No CON 0

    -[ Initialization ]

    Init:
    FOR index = 0 TO 9
    LOOKUP index, [Scan, 7, Brite, 14, Decode, $FF,shutdn,1, test,$0f00 ], d7219
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-10-11 10:17
    Bill,

    In your example (which is similar to what is in the Digital Alarm Clock code) for test mode, you do not need to send $0F00. The $0F is all that is sent and the $00 is not accessed but does use an extra byte of EEPROM.

    Since the least significant bit is all that needs to be sent, you can also just send a one (1). See code from Digital Alarm Clock project below. This example turns on all segments for two seconds prior to the display init routine shown. the significance of this is that the TEST mode works before the SHUTDOWN mode has been disabled and the brightness setting has been set.
    Display_Test:
      index = Test                          ' Select Display Test Register
      ioByte = 1                            ' Set Display Test Mode
      GOSUB Max_Out                         ' Send To Display
      PAUSE 2000                            ' Wait For 2 Seconds
      index = Test                          ' Select Display Test Register
      ioByte = 0                            ' Clear Display Test Mode
      GOSUB Max_Out                         ' Send To Display
      RETURN
    Max_Out:
      SHIFTOUT DataIO, Clock, MSBFIRST, [index, ioByte]
      PULSOUT MAX7219, 5                    ' Latch Data
      RETURN
    
  • youngbillyoungbill Posts: 54
    edited 2010-10-11 17:19
    Can anyone help me out here...I built the circuit as shown in maxim application notes,,using the max to drive higher voltages.
    My load is 30 Ma @12v....segment led.
    Q1 is a pn2222
    Q2 is IRF 9540 P mosfet
    Q3 is a pn2222
    the problem is my led display is not full on,( its Dim)
    I have a multimeter and 2 channel scope for testing.
    Q1 seems to be saturated,,with 1.2volts across V c-e
    BUT Q3 has 5.2 volts across it,,,so it is possibly not on enough to turn on the mosfet.( I believe this is where the problem is,,,how do I check a mosfet is on )
    Now the questions
    How can I read segment current with my test equipment,( either segment current or digit current) AT this higher frequency? Would it help to put the max 7219 into test mode ( I think it will still be scanning and mutiplexing )...would it be better to use a muti meter set for AC? with hi freq.

    Also with regard to the segment circuit,,,,I believe the common base transistor circuit is used (Q3) because of the higher frequency,,,,BUT will the mosfet not work directly from the max?,,,OR can anyone show me how to check if this mosfet is possibly the wrong choice IRF9540.
    FROM THE APP NOTES,,,,,SEE ATTACHMENT,,,,MY V CASCODE IS 5 VOLT
    V DRIVER IS 12V
    The circuit of Figure 2 includes a level shifter to allow a higher supply voltage than 5V to be used to drive the
    LEDs. Q3 operates as a common-base current switch, and sinks a collector current set by resistor R2 (about 5mA
    using Vcascode = 5V) when the digit drive output is low. This current in turn develops about 5V across the 1kW of
    R3 to provide a consistent gate drive to logic level PFET Q2, independent of the fluctuations of the supply Vdriver.
    Note, though, that the collector of Q3 can go no lower than VCE(sat)Q3 above it's emitter, which is at VBE below
    Vcascode.
    Figure 2. Current boosting the digit drive using an LED supply 10V or higher.
    As R3 is dropping 5V, this places the lower limit for the supply Vdriver at about 10V if Vcascode is set to 5V. 5V
    was picked as a convenient voltage for Vcascode because it's likely to be the supply for the MAX7219/7221.
    However Vcascode can be set to a lower voltage, such as 2V, by simply dropping the 5V supply through a zener
    diode (Figure 3). Only one zener diode is needed to serve all the digit drivers.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2010-10-11 20:41
    The MAX7219/7221 segment drive outputs are current sources, which drive a constant current set by resistor
    RSET connected to the ISET pin of the MAX7219/7221. The maximum segment current is 40mA. To drive a higher
    segment current, external transistors and segment current limiting resistors are needed (Figure 4).
    Figure 4. Current boosting the segment drive.
    By setting the MAX7219/7221 segment drive current source correctly, a base current limiting resistor is not
    required for the segment drive switch Q1. The segment drive current can be set to be an appropriate value using
    RSET to turn Q1 on hard. Resistor R4 is needed to ensure Q1 turns off reasonably fast at the end of each digit's
    multiplex cycle. An RSET value around 150kW is a good starting point.

    Are you using this setup
  • youngbillyoungbill Posts: 54
    edited 2010-10-11 22:25
    Sam,,yes I am,,I think I see the problem now,,,I picked a mosfet,,,that needs a negative voltage....and with the setup shown,,,I will never get negative gate,,,,so I believe I need a D mosfet,( is there such a thing?),,or just a JFET,,,where a zero voltage will cause drain current.
    Also any thoughts if another transistor would be ok in place of the mosfet?
    ,,,Or any help in how to find the correct..mosfet,,thanks
    I am using the setup you asked about ,, but when i changed the Iseg "R",
    from 150k ohms to 39 k ohms,,,it did not seem to saturate Q1 any more,,,so at 1.2 volts across Q1,,( in both cases),I assumed its saturated with either Iseg "R",,,but I still would like to be able to measure it,,,,either that or digit current.
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2010-10-12 09:45
    youngbill

    "I think I see the problem now,,,I picked a mosfet,,,that needs a negative voltage" - it's a P-mos transistor, the notation for P-mos transistors use negative numbers, where as an N-mos transistor uses the notation of positive numbers.

    I'm not sure what a D-mos would do

    A JFET is functionally the opposite of a Mosfet transistor. A Gate voltage causes it to turn 'Off' rather than turn 'On', but that's not what you want here.
    JFET's are only to be used in low current applications because their Rds'On' is very high compared to a Mosfet.

    The circuit you are using appears to be correct, but I suspect that the Rds 'On' of the p-mos might not be enough to keep up with your current demand. Do you know how much current your application needs to switch through the p-mos?
  • youngbillyoungbill Posts: 54
    edited 2010-10-12 11:09
    I need 25 to 30 Ma for each segment,,,my load is the string style of leds.
    they are six leds per segment with a resistor (aprox 150 ohms ) per each group of 3 leds,,,(in series) then the next group are parallel to this one.
    The ribbon comes in 15 foot lengths,,and you cut what you want.
    they run on 12 volt.
    Can I ask one thing,,to clear up my understanding.
    The gate of the mosfet will never go negative,correct? but as long as we gate it with LESS voltage than the source,,,,IS THAT CONSIDERED NEGATIVE?
    ie, is it a absolute value,,,where positive 4 volts is actually negative 8 compared to +12
  • youngbillyoungbill Posts: 54
    edited 2010-10-12 12:00
    Ahhh,,,i think I must have had it miss wired...I have 11.5 volts now on my leds,,,Oh and just checked its 27 Ma with a multi meter,,,so seems ok now.
    The leds are the string type leds,,they have groups of 3 leds in series,,with 150 ohm. It comes in a 16 foot long roll,,,and you cut to suit,,,i use 6 leds per segment,,,many thanks for all the replys.....well see post below...NOW back to not working,,possibly too tired
  • youngbillyoungbill Posts: 54
    edited 2010-10-12 17:20
    I need to switch or run 30 Ma. I have 3.5 volts across the mosfet,,,thats ( I believe) why the leds are dim.
    The R ds,,,data sheet is test conditions for 10 volt V-gs..( where I have aprox6volt,,,..(toggleing between 12 to 4...switching it off/on).... the test current is 10 amp....on the data sheet,,,mine is running 30 Ma...so possibly too little current?.

    upon further investigation,,,it seems like if I increase I seg current to saturate the segment transistor,,,the 4 volts appears on the mosfet,,and if i lower I seg..( by going to the recommened 150 K ohms ) the extra voltage appears on the unsaturated Q1 segment transistor. I really think its a poor design,,,and either a pnp could work ( in place of the mosfet ),,rather than a mosfet...or a different cct driving the mosfet,,
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2010-10-12 19:09
    This is some thing where you may have to try different Mosfet until you find the right one I would find one where it work pretty good with this set up that I had posted before then change the resister value Just an :idea:

    The leds are the string type leds,,they have groups of 3 leds in series,,with 150 ohm

    This maybe part of your problem as well you may need change this resister to a higher value Just an :idea: as well
    Digit Drive Sink Current V+ = 5V, VOUT = 0.65 VIDIGIT 320 mA

    This is where the Problem may be why you are not getting more current out of the Mosfet Just an :idea: as well


    That would be some thing that I would try if I where doing this project

    For me I do not like data sheet just show what type of part to use but no part #

    I hopr this helps
  • youngbillyoungbill Posts: 54
    edited 2010-10-13 12:12
    Does any one have experience with the max app note I posted it as attachment ,(1196).
    Figure2 shows a Q3 transistor but the base has 5 volt and the collector has 12v,,,,seems this is stopping the base from being fwd bias.( at least hard)
    also the app notes states 5 volt will drop across the 1K resistor ( R3 ),,with 5 ma flow....I measure 1 volt drop and 2 ma flow....Any suggestions...possibly a completely different digit drive cct..Thanks
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-10-14 11:13
    I haven't looked at that AppNote in a couple of years, but something you said caught my attention...if Q3 is a transistor, current is what you should be looking at, not voltage so much. the amount of current drawn by the base will be proportional to the current across the Emitter-Collector junction. This will be determined by the gain of the transistor. So if the transistor isn't driving the display at the proper brightness (current) then you may need to adjust the base resistor (lower it some). I would re-check everything to make sure you have the proper resistor values.
  • youngbillyoungbill Posts: 54
    edited 2010-10-15 13:58
    I measure 7 Ma emitter current,,,and 3 Ma base current,,there is totally no base resister,,,the base is connected directly to 5 volt,,,and when max pin goes low,,thats attached to emitter which fwd bias the trans Q3,
    Because its multiplexed and digits are turned on at different times,,,then also segments are pulsed at different times,,( to display the needed number)..I find it very difficult to just say what current and voltages are at any instant in time.I have a two channel scope,,,but I still seem to feel the display is running too low a voltage,
    I have a LTS 3401 LE two digit display with 330 ohm resistors in series with each segment..( later I was going to use the ribbion style leds to make my own segments...which DO run on 12 volts,,,thats why i need 12 volt,,,also the 3401 display should have been fried at 12 volts...(30 Ma should have burnt that display out...so I know the max is not putting out 12 volts)...both displays the ribbon and 3401 are reading aprox 6 volts..
    I adjusted scan to 1...which did increase the brightness....is the max brite only 15 on the initialization..Thanks for any help
  • youngbillyoungbill Posts: 54
    edited 2010-10-15 22:50
    I think I have the full 12 volt brightness now...the problem was in the choice of the transistor,,Q1,, The tip 122 was not good... when I was checking from collector to ground...ie when the max7219 pin sourced out current...the tip 122 transistors collector was .5 volts above ground..( ie saturated but I think it has a higher sat voltage,,Vce max in data sheet )...and the pn2222,,,was very close to ground.( so only a half volt diff).
    Any how,,many thanks to all...also,

    Upon redrawing the circuit,i can see now, only Q1,the display.and the mosfet.are in series,,,with the 12 volts.

    I would have not noticed that small difference,,,except i had experience with the ribbion style led string,,,and i noticed it was not at normal brightness...I know i would have not noticed that small difference on a 7 seg display...or a regular led.
    One question,,,remains...I get the maximum Rated current on the 3401 - 7 segment display at around 6 volts,,( 25 ma),and /but with the max 7219 at 12 volts...I can only get 12 ma assume its because the voltage is pulsed so fast,,,but any way it appears good now,,,What causes the brightness voltage or current,,,,or I think its a false amperage reading on the DMM because of the frequency...
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2010-10-16 11:58
    youngbill

    What part # for the transistor and mosfet

    Thanks for your time

    I just got the free sample in the mail this week I would like to try this my self could you post a working tet code for me to play with
  • youngbillyoungbill Posts: 54
    edited 2010-10-17 00:10
    I use a pn2222 for Q1,,,a p channel mosfet..IRF 9540,,,and for Q3,,either a pn2222 or a tip 122 will work, I have mine running a 6 lamp led string,,,3.3 volt per led,,,any way its 30ma per segment,,,finally it seems to be fine,,,,One thought,,,anyone know how 120v ac could be used in place..of the 12 volt driver,,,to drive a really large display. That last code i posted was a simple counter,,,but upon understanding it more fully,,,I removed over half the code ..and it works fine,,,( I did not know what I was doing,,,but with the help of a lot of great guys here,,,I some how managed to get it to work to look like a clock...basicly a counter....here is a counter attached,,,down load the 7219 data sheets,,,also stamp has a application note about the 7219...some,,,where,,,i used 139 k ohms for I seg,," R"....and the display is 12 volts,,,,Oh run the display off another supply,,,I think stamp will power it if you have the BOE board of education model...AND be sure ALL your different boards,power supplies,,etc,,,have a common ground...keep me posted,,,good luck,,,I worked for days on it
Sign In or Register to comment.