Shop OBEX P1 Docs P2 Docs Learn Events
Max7219 and a DS1620 — Parallax Forums

Max7219 and a DS1620

Nick WaldvogelNick Waldvogel Posts: 71
edited 2006-06-04 04:32 in BASIC Stamp
How can I get the max7219 to display the temp on a 3 digit display? I am using a DS1620 as a temp prob and I have it sending out on a Pink but for some reason I can't seem to figure out how to properly display it this way! Thanks for your time!! I love learning this stuff!! burger.gif

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-06-01 03:31
    Nick,

    ·· Here is a project that uses the DS1620 and the MAX7219...Between the two you should be able to come up with enough examples to do what you want.

    http://forums.parallax.com/showthread.php?p=552892

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Nick WaldvogelNick Waldvogel Posts: 71
    edited 2006-06-03 23:13
    Thank you so very much for your info, Chris!! It has gotten me much closer to where I want to be. As of right now I have the display showing info but it's in binary.... A little more info about this is that I have 5 segments and the last two are set up to display the temp symbol. I know it's got to be so simple but I can't seem to be able to figure it out and have been beating my head for several days over it!! LOL Thanks for the info! hop.gif

    ' Hardware interface with the 7219:
    DATA_n  CON  7  ' Bits are shifted out this pin # to 7219.
    CLK     CON  5  ' Data valid on rising edge of this clock pin.
    Load    CON  6  ' Tells 7219 to transfer data to LEDs.
    
    decode   CON  9                         ' Decode register; a 1 turns on BCD decoding.
    brite    CON  10                          ' "       "   " intensity register.
    scan     CON  11                           ' "       "   " scan-limit register.
    switch   CON  12                         ' "       "   " on/off register.
    Test     CON  15                        ' Display Test Mode
    
    
    XX    VAR Byte                          'General purpose variable, byte.
    DegF  VAR Byte                          'Variable for Deg F.
    DegC  VAR Byte                          'Variable for Deg C
    max_dat  VAR  Word                      ' Word to be sent to MAX7219.
    index   VAR  Nib                        ' Index into setup table.
    temp  VAR  Nib                          ' Temporary variable used in outputting digits.
    nonZ  VAR  Bit                          ' Flag used in blanking leading zeros.
    d7219           VAR     Word            ' Data For MAX7219
    DegF0 VAR    DegF.BIT0
    DegF1 VAR    DegF.BIT1
    DegF2 VAR    DegF.BIT2
    
    odd  VAR  index.BIT0                    ' Lsb of index.
    
    
    'Note: DS1620 has to be preprogramed for mode 2.
    
    FOR index = 0 TO 7                      ' Retrieve 8 items from table.
      LOOKUP index,[noparse][[/noparse]scan,4,brite,1,decode,$1F,switch,1],max_dat
      SHIFTOUT DATA_n,CLK,MSBFIRST,[noparse][[/noparse]max_dat]
      IF odd = 0  THEN noLoad               ' If odd is 1, pulse Load line.
      PULSOUT Load,1
    NoLoad:                                 ' Else, don't pulse.
    NEXT                                    ' Get next item from table.
    
    HIGH 13                                 'Select the DS1620.
    SHIFTOUT 15, 14, LSBFIRST, [noparse][[/noparse]238]        'Send the "Start Conversions" command.
    LOW 13                                  'Do the command.
    
    '------- Main---------
    
    DO                                      'Going to display every 1 sec.
    
      HIGH 13                               'Select the DS1620
      SHIFTOUT 15, 14, LSBFIRST, [noparse][[/noparse]170]      'Send the "Get Data" command.
      SHIFTIN 15,14,LSBPRE, [noparse][[/noparse]xx]             'Get the data.
      LOW 13                                'End the command.
    
      DegC = xx / 2
    
      DegF = DegC * 9 / 5 + 32              'Convert data.
    
      DEBUG HOME
       DEBUG "The Temp is ",DEC DegF,32,"Degrees", CR
    
      GOSUB Show_Temp
    
    LOOP
    
    
    
    
    
    Show_Temp:
    
      index = 1
      d7219 = 8
      GOSUB Show_Max_Temp
    
      index = 2
      d7219 = 8
      GOSUB Show_Max_Temp
    
      index = 3
      d7219 = DegF0
      GOSUB Show_Max_Temp
    
      index = 4
      d7219 = DegF1
      GOSUB Show_Max_Temp
    
      index = 5
      d7219 = DegF2
      GOSUB Show_Max_Temp
    
    
      RETURN
    
    Show_Max_Temp:
      SHIFTOUT DATA_n,CLK, MSBFIRST, [noparse][[/noparse]index, d7219]
      PULSOUT Load,5                    ' Latch Data
      RETURN
    
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-06-04 04:16
    You can use the DIG operator to extract individual digits from the variable with the Temperature (DegF?).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Nick WaldvogelNick Waldvogel Posts: 71
    edited 2006-06-04 04:32
    Thanks again Chris!!! After reading the text about DIG, it makes sense. I will give it a try in the morning. It's 11:30 here and the lady friend wants to go to bed..... rolleyes.gif
Sign In or Register to comment.