sending data to Maxim 7219
solder_fumes
Posts: 18
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
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
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.
Regards,
John