Shop OBEX P1 Docs P2 Docs Learn Events
Some questions about MAXIM ICM7212 — Parallax Forums

Some questions about MAXIM ICM7212

jordan2003jordan2003 Posts: 6
edited 2011-08-01 19:27 in Propeller 1
Ok,
I have been working with the propeller for a few weeks now and have started to get a grip on the spin language. I have interfaced the 4X4 Membrane Keypad, lit a billion leds up with patterns, created tables, calculations, timed events, timers, a servo interface, and a bunch of other. etc. etc.. etc...

I wanted to try interfacing to an IC so I looked through the MAXIM free samples and ordered a few different types of chips from led drivers to 4 digit 7 segment decoders. I looked at all the specs on all the chips and decided the 7212AM would be a good starting point as it is microprocessor controlled and didn't require a lot of wiring.

My questions is about how data is moved into the data inputs and how the timing of the CS1 and CS2 pins.

Looking at the datasheet and the specs, I thought that maybe I understood how it worked but after hooking it up and writing some code, i realized what i was doing was just shot in the dark.

I am so new I'm embarrassed to even show my code but basically i used 4 pins for the B0 thru B3 and connected them to P16 thru P19. These pins were set to the digit i wanted to display and then had two pins on the propeller control DS1 and DS2 for the digit select. I had two more pins on the propeller hooked up to CS1 and CS2 and would set both low(I thought that would load the pin data from the 6 pins. and then pulsed CS1 or CS2 high to display the digit number on a single 7 segment display. I only hooked up b1, b2, b3, b4,b5,b6,b7 so as to keep the wires to a minimum.

Do i go straight from propeller pins to the ICM7212 pins?
If so, do i set them high and low to set what the B0-3 and DS1/DS2 data bits should be?
Do I take CS1/CS2 low to load the Data/DigitSelect and then pulse CS1 or CS2 high(whichever is required via the datasheet truth table)?
If so, does pulsing CS1 for 200 MicroSeconds verses 1 MilliSec make a difference?

Am i close or are you sitting back laughing your butt off? :-)... lol....

Anyways, I think I may be doing this totally wrong and any help would be greatly appreciated.

I hope that understanding this one will help me in the future with more complicated chips.

Thanks,


A VERY INTERESTED NEWBIE!

Jordan

Comments

  • Cluso99Cluso99 Posts: 18,069
    edited 2011-07-31 02:35
    Jordan: Firstly, welcome to the propeller forum. Don't worry - we all started somewhere!

    Yes, you can go straight to from the prop pins to the ICM7212 pins. You can operate the ICM7212 from 3V3 (same as the prop) or 5V.

    Set the 8 prop pins to outputs. Set the 4 data bits to whatever you require ($5 is a good test value) and set the digit pins both 00 to get the first digit. Now ensure CS1 & CS2 are high and then pulse them both low (both are required to go low at the same time to latch the data/digits) and back high again. 200us is fine as is anything longer than this.

    Try to get a digit working first.

    BTW Have you set the brightness pin as suggested in the ICM7212 manual?

    Posting your code would help us to see what may be wrong. Goto the "Go Advanced" section and use the post code tags to keep the formatting of your program correct, or attach the program as a zip file (use the prop tool to save all the code).
  • StefanL38StefanL38 Posts: 2,292
    edited 2011-07-31 05:26
    Hi Jordan,

    first of all welcome to the propeller-forum.
    You have posted a well written posting. You wrote what your actual understanding of sending data into the MAX7212-chip is.

    And in most things you are right. There is still room to improve your posting style. If you attach the datasheet as a PDF or add a link from where the datasheet is directly downloadable
    you make it comfortable for others to take a look into the datasheet.

    I took the effort to search for the datasheet myself.

    Now no direct answers but guiding questions:

    which figure in the datasheet shows the trueth-table for the subtype 7212AM?

    on which signal and logic voltage level will the data be stored into the 7212AM?

    To find out how it works, as data I would use the 8 that lights up every segment and then
    check the voltages of every of the 4 digits. This makes sure that any chosen segment A-F will
    change the voltage and you only have to check four outputs f.e. A1, A2, A3, A4 to see which digit
    got the data.

    Another thing: if somebody would laugh about your assumptions he would have a big GAP
    in his personal development or to say it positive a big potential of characterical improvement.

    In this forum there is only a very small number of "login-IDs" that - in seldom cases tend to laugh or joke
    about postings. 99.8% is polite and patient.

    So take a look into the datasheet and come back with new questions.

    Even if your code would look like a mess this is good information, because I would like to make suggestions on how code can be written to be easy to understand and easy to maintain.

    keep the questions coming
    best regards

    Stefan
  • jordan2003jordan2003 Posts: 6
    edited 2011-07-31 21:54
    Ok, here is the DataSheet:

    http://datasheets.maxim-ic.com/en/ds/ICM7211-ICM7212.pdf


    And here is my code. >>>>>>>>>>>>>>>>>>>>>>>>>
    
    CON
    '***************************************
    '  Hardware related settings
    '***************************************
      _clkmode = xtal1 + pll16x        '
      _xinfreq = 5_000_000             ' XTAL IS 5Mhz. X 16 = 80Mhz
                   
    pub main
    
    
       dira[10..23]~~                ' - SET DS1, DS2, CS1, CS2, B0, B1, B2.B3, TO OUTPUTS 
       outa[14] := 1                 ' Set pin 14 high for troubleshooting --- LED
       waitcnt(160_000_000 + cnt)     ' Pause for a couple of seconds
       outa[14] := 0                  'turn off P14
      
    
                                    '_________
        outa[20] := 1                '         |
        outa[21] := 0                '         |
        outa[22] := 0                '         |- setup data B0-B3 for digit 8
        outa[23] := 0         '_________|
            
        outa[16] := 0        'digit select 1      DS1 is LOW
        outa[17] := 1        'digit select 2      DS2 is HIGH
        outa[18] := 0        'chip select 1       --Both CS lines low
        outa[19] := 1        'chip select 2           
        PauseMS(1)
    
        outa[19] := 0         ' Take P19 low to latch data and digit select.  pins b0-b3, and DS1/DS2 
        
        OUTA[18..19] := 1     ' Take CS1 and CS2 to high for 1 millisecond to transfer
        PauseMS(1)               'Pause for 1 MS
        OUTA[18..19] := 0
    
    
            outa[13] := 1               'Set pin 14 high for troubleshooting --- LED
            waitcnt(10_000_000 + cnt)
            outa[13] := 0
            outa[14] := 1                'Set pin 14 high for troubleshooting --- LED
            waitcnt(10_000_000 + cnt)
            outa[14] := 0
                                                                
    
               
               
    PUB PauseMS(Duration)
    
              'PAUSE IN MS
              'DURATION OF DELAY IN MILLSEC
              
      waitcnt((clkfreq / 1_000) + cnt)
    
    
    
    
    
    


    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    I have included a picture of my hookups. I have two leds that comes on almost every time I power up and my hand running across wires does crazy things to the leds. they light up and go out randomly. I literally can touch the wires on the plastic and that led will turn off and when i run the spin file, it will kick on every time it's supposed to transfer data. then i have to touch the wires and those leds that lit will go out. If at least the right leds turned on every time i would have something to work with and maybe figure out whats going on. I even took all 8 DS, CS and B0-23 wires off and just had ground, brightness input, and 3V hooked up and leds still come on. If i reload the spin file it does kick leds on for a blink but like i said, a few leds just stay on.



    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    I have included a picture of my hookups. I have two leds that comes on almost every time I power up and my hand running across wires does crazy things to the leds. they light up and go out randomly. I literally can touch the wires on the plastic and that led will turn off and when i run the spin file, it will kick on every time it's supposed to transfer data. then i have to touch the wires and those leds that lit will go out. If at least the right leds turned on every time i would have something to work with and maybe figure out whats going on. I even took all 8 DS, CS and B0-23 wires off and just had ground, brightness input, and 3V hooked up and leds still come on. If i reload the spin file it does kick leds on for a blink but like i said, a few leds just stay on.


    P1010019.jpg


    Anyways, thanks for the help already.


    Jordan
    1024 x 768 - 125K
  • jordan2003jordan2003 Posts: 6
    edited 2011-07-31 22:49
    just reread what you posted and i have some code totally backwards..I have CS1/2 low and should be high from what you said.
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-07-31 23:10
    Yes, CS1 & CS2 are active low. That means they latch while low going high, so they should rest at high.

    Next, You do not have the second set of prop power and ground connected. This is a receipe for killing your PLL in the prop. All power and ground pins MUST be connected (you are missing the pair between the xtal). You should have some bypass capacitors as well. Best to bring the 3v3 and gnd to one set of rails on your patchboard as you can then place some caps on it. For your experiments, a 10uF tantalum placed at the top edge where the power comes in from the other pcb/source, and then at least one 100nF (0.1uF) per IC will surfice.

    When you post your code, you need to place it between code tags {code} ..... {/code} (replacing "{" and "}" with square brackets, or used the advanced reply. This preserves the indentation of your code. Otherwise we may miss something.
  • StefanL38StefanL38 Posts: 2,292
    edited 2011-08-01 00:28
    just to make it sure.
    the PCB next to the bredboard is a basic-stamp. basic-stamps work with 5V.
    So my question is do you supply the propeller with 5V or with 3.3V???

    The propeller is a 3.3V device. The propeller is quite robust but as Chip Gracey mentioned in the "how to safely interface a 5Vdevice".
    The CMOS-material with wich the propeller is manufactured is rated for a maximum voltage of 3.6V.

    keep the questions coming
    best regards

    Stefan
  • jordan2003jordan2003 Posts: 6
    edited 2011-08-01 10:33
    I used a 1/4 watt resistor and LED to drop the voltage to 3.1V and then used that as a connecting point and used the led to visually see the current draw and to provide some sort of current limiting. Probably wrong but i haven't had any issues with the prop chip. It's been running fine. Not to say this is the proper way to supply power though. I am looking at trying an I2C 7-segment display instead. The maxim seems to be very sensitive and i'm not having much luck with it. I'm sure it's just me needing to get better with hardware and software though. Anyways, thanks for all your help and I will be trying again but prob not until I understand the setup better.


    Jordan
  • StefanL38StefanL38 Posts: 2,292
    edited 2011-08-01 11:50
    Now if the inputs are very sensitive this can easily be solved with pull-up-resistors +3.3V
    10kOhm---x---Inputpin
    or pull-down-resistors GND
    10kOhm---x---Inputpin

    at "x" you connect the output-pin of the propeller-chip. If the input is left free flowing even a 1 inch cable acts as an antenna and the all over EMV-noise is enough to trigger the input
    because the input-resistance is very high 1 MOhm or more.

    The pull-up/pull-down-resistor reduces the input-resistance and the +3.3V o the 0.0V are "stronger" than the EMV-noise. Through the resistor the voltage is kept on 3.3V or 0.0V.

    With a pullup-resistor If the Prop-output goes down to 0.0V the input goes down too (all the 3.3V drop across the 10kOhm.
    With a pull-down-resistor if the prop-output goes high to 3.3V the input goes high too ((all the 3.3V drop across the 10kOhm but on the "x"-side there is still 3.3V

    As long as you drive low currents 1-20mA the LED-resistor thing will be working somehow. For bigger currents it is not suitable. As you have several LEDs in the circuit they might already need too much current.
    I recomend using a fixed voltage-regulator (VR) of 3.3V
    or an adjustable voltage-regulator like the LM317 1A -if you have on of these handy.
    If you happen to have an OP-Amp like the LM358, LM324, LM339 or something similar
    this could act as a low-power-voltage-regulator too (20 mA) (voltage-follower) with a voltagedivider at the input.
    Best thing is a fixed VR with 3.3V

    Disconnect the propeller-chip.
    Then to learn about the behaviour of circuits you could simply measure voltage and current of the LED-resistor while drawing different currents through different load-resistors.

    If you want to learn about the basics of electronic I would recomend a website like http://openbookproject.net//electricCircuits/DC/index.html

    keep the questions coming
    best regards

    Stefan
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-08-01 18:01
    3 series 1n4001 (or 1n4004) 1A diodes in series with 5V will drop to approx 3V. (not 1n914 or 1n4148)
  • StefanL38StefanL38 Posts: 2,292
    edited 2011-08-01 19:27
    3 series 1n4001 (or 1n4004) 1A diodes in series with 5V will drop to approx 3V. (not 1n914 or 1n4148)
    good idea,

    I have used diodes as (almost) constant-voltage-droppers for discharging accumulators but the idea didn't come up to my mind in this case

    best regards

    Stefan
Sign In or Register to comment.