Shop OBEX P1 Docs P2 Docs Learn Events
sending data to Maxim 7219 — Parallax Forums

sending data to Maxim 7219

solder_fumessolder_fumes Posts: 18
edited 2013-02-27 19:41 in BASIC Stamp
I'm trying to send temperature and humidity data to a 7219. I'm using the code below to receive that data, which works fine...I end up with two variables "T" and "H" that give me two digits of temperature and two digits of humidity.

The problem is that the 7219 wants a 'string' of data so it can pull out each digit and send it to the appropriate display.'

How can I combine the two digits of "T" and the two digits of "H" to send as four digits to the 7219?

Thanks,

John

main:
LOW 9 ' T/R Line
DO
LOW 8
SERIN 8, 16468, [WAIT("!"), T.HIGHBYTE, T.LOWBYTE,WAIT("@"), WAIT("^"), H.HIGHBYTE, H.LOWBYTE,WAIT("&")]
IF (T < 100)AND (H < 100) THEN


DEBUG ? T
DEBUG ? H

ELSEIF (T => 100 AND H => 100) THEN
GOTO main
ENDIF
GOSUB MaxDisplay
dispVal = result


LOOP

Comments

  • Tracy AllenTracy Allen Posts: 6,662
    edited 2013-02-24 10:06
    You'll send data to that chip using the SHIFTOUT command, with 16 bits that contain both the value to display and where to display it. For example,
    snippet:
      LOW load7219
      SHIFTOUT din7219, clk7219, msbfirst, [(2<<8) + (T dig 0) \ 16]
      HIGH load7219
    

    That is only to send the least significant digit of temperature to the second digit position on the display. The function (Tdig 0) picks off the least significant digit of temperature, and 2<<8 is the command that says to put the value into the second digit on the display. The \16 tells to SHIFTOUT command to send 16 bits. The HIGH load7219 actually loads the data. You will of course write that as a subroutine to select an arbitrary digit in your variable and arbitrary position on the display.

    That is not all there is to it. You have the data sheet, right? There are several command registers that may have to be set. For example the "decode mode" register determines whether the value you send is decoded as a digit, or simply as 8 values to turn on individual LEDs.
  • solder_fumessolder_fumes Posts: 18
    edited 2013-02-27 19:41
    Great Tracy, thanks for the help...it's working as desired.

    Regards,

    John
Sign In or Register to comment.