max 7219 and ds1620 as stand alone thermostat
aj_ax24
Posts: 16
Im a new user and ordered the kit for the ds1620 and can't really understand anything it is saying.· I get some of the routines and when i tried to download the program from the software it came with the only temp it shows is 0 f and 32 C.· Also considering if i can get the temp to work right i was wanting to display digitaly on the max7219 in real time.· I went to the web site called put your data in lights using an led display chip, and it was giving me code for the bs1 and the variables wern't written wright.
If you could give me a hint of the code for the ds1620 and then shiftout to max7219 it would really be appreciated.· i really liked doing the projects in·whats a microcontroller book and was looking into the industrial controles book but i am getting frustrated with this code thing.· I am more of a hard ware guy myself.· Well if you guys could give some feed back that would be so great.· Thanks for your time and look forword to getting this figured out.·
AJ
If you could give me a hint of the code for the ds1620 and then shiftout to max7219 it would really be appreciated.· i really liked doing the projects in·whats a microcontroller book and was looking into the industrial controles book but i am getting frustrated with this code thing.· I am more of a hard ware guy myself.· Well if you guys could give some feed back that would be so great.· Thanks for your time and look forword to getting this figured out.·
AJ
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
http://forums.parallax.com/showthread.php?p=464324
aaron
However, I am going out of town today and will not have access to email until Wednesday.
DQ CON 2 ' Pin 2 <=> DQ.
CLKT CON 1 ' Pin 1 => CLK.
RST CON 0 ' Pin 0 => RST (high = active).
DSdata VAR Word ' Word variable to hold 9-bit data.
Sign VAR DSdata.BIT8 ' Sign bit of raw temperature data.
T_sign VAR Bit ' Saved sign bit for converted temperature.
' ===================== Define DS1620 Constants ===================
' >>> Constants for configuring the DS1620
Rconfig CON $AC ' Protocol for 'Read Configuration.'
Wconfig CON $0C ' Protocol for 'Write Configuration.'
CPU CON %10 ' Config bit: serial thermometer mode.
NoCPU CON %00 ' Config bit: standalone thermostat mode.
OneShot CON %01 ' Config bit: one conversion per start request.
Cont CON %00 ' Config bit: continuous conversions after start.
' >>> Constants for serial thermometer applications.
StartC CON $EE ' Protocol for 'Start Conversion.'
StopC CON $22 ' Protocol for 'Stop Conversion.'
Rtemp CON $AA ' Protocol for 'Read Temperature.'
' >>> Constants for programming thermostat functions.
RhiT CON $A1 ' Protocol for 'Read High-Temperature Setting.'
WhiT CON $01 ' Protocol for 'Write High-Temperature Setting.'
RloT CON $A2 ' Protocol for 'Read Low-Temperature Setting.'
WloT CON $02 ' Protocol for 'Write Low-Temperature Setting.'
' ===================== Begin Program ============================
Begin:
LOW RST ' Deactivate '1620 for now.
HIGH CLK ' Put clock in starting state.
PAUSE 100 ' Let things settle down a moment.
HIGH RST ' Activate the '1620 and set it for continuous..
SHIFTOUT DQ,CLKT,LSBFIRST,[noparse][[/noparse]Wconfig,NoCPU+Cont] ' ..temp conversions.
LOW RST ' Done--deactivate.
PAUSE 50 ' Wait for the EEPROM to self-program.
HIGH RST ' Now activate it again and..
SHIFTOUT DQ,CLKT,LSBFIRST,[noparse][[/noparse]StartC] ' Send start-conversion protocol.
LOW RST ' Done--deactivate.
' The loop below continuously reads the latest temperature from
' the DS1620.
again:
PAUSE 1000 ' Wait a second between readings.
HIGH RST ' Activate the '1620.
SHIFTOUT DQ,CLKT,LSBFIRST,[noparse][[/noparse]Rtemp] ' Request to read temperature.
SHIFTIN DQ,CLKT,LSBPRE,[noparse][[/noparse]DSdata\9] ' Get the temperature reading.
LOW RST
'SHOW THAT SHIFTIN COMMAND RECIEVED
PAUSE 500 'DATA AND PROGRAM IS WORKING
T_sign = Sign ' Save the sign bit of the reading.
DSdata = DSdata/2 ' Scale reading to whole degrees C.
IF T_sign = 0 THEN no_neg1
DSdata = DSdata | $FF00 ' Extend sign bits for negative temps.
no_neg1:
'DEBUG SDEC DSdata," degrees C",CR ' Show signed temperature in C.
DSdata = (DSdata */ $01CC) ' Multiply by 1.8.
IF T_sign = 0 THEN no_neg2 ' If negative, extend sign bits.
DSdata = DSdata | $FF00
no_neg2:
DSdata = DSdata + 32 ' Complete the conversion.
DEBUG SDEC DSdata," degrees F",CR ' Show signed temperature in F.
' =========================================================================
'
' File......MAX7219
' Purpose...Test the use of shift out to control a MAX7219
' Author....Ken Mathis
' E-mail....
' Started...5/31/04
' Updated...
'
'
' =========================================================================
'
[noparse][[/noparse] Program Description ]
'The program will test the operation of shiftout command to control a MAX7219
'IC that will multiplex 8 seven segment displays
'
[noparse][[/noparse] Revision History ]
'
[noparse][[/noparse] I/O Definitions ]
'0 sets pin as input
'button PIN 0 makes the word button = pin 0
'DIRS = $0000 'pins 1 2 3 output,all other pins outputs
DOUT PIN 7 'pin 1 of stamp to pin 1 of 7219
Load PIN 6 'pin 2 of stamp to pin 12 of 7219
CLK PIN 5 'pin 3 of stamp to pin 13 of 7219
'
[noparse][[/noparse] Variables ]
Dig0 VAR Word
DIG1 VAR Word
Dig2 VAR Word
Value VAR Nib
AJ VAR Nib
'
[noparse][[/noparse] EEPROM Data ]
'
[noparse][[/noparse] Initialization ]
Dig0 = $0100
Dig1 = $0200
Dig2 = $0300
Value = 0
AJ = 0
'
[noparse][[/noparse] Program Code ]
Begin1:
GOSUB DecodeMode
GOSUB ShutDownMode
GOSUB ScanLimit
GOSUB Intensity
continue:
Dig0 = Dig0 | Value
Dig1 = Dig1 | Value
Dig2 = Dig2 | Value
Value = Sign
'first digit least significant
SHIFTIN DQ,CLKT,LSBPRE,[noparse][[/noparse]DSdata\9]
LOW Load
SHIFTOUT DOUT, CLK, MSBFIRST,[noparse][[/noparse]Dig0\16]
HIGH Load
PAUSE 40
'second digit
LOW Load
SHIFTOUT DOUT, CLK, MSBFIRST,[noparse][[/noparse]Dig1\16]
HIGH Load
PAUSE 40
'third digit
LOW Load
SHIFTOUT DOUT, CLK, MSBFIRST,[noparse][[/noparse]Dig2\16]
HIGH Load
PAUSE 40
'
[noparse][[/noparse] Subroutines ]
'Decode mode for no decoding to BCD
'Least sig nibble:
'0 = no decode
'1 = decode digit 0
'F = decode digits 0-3
'FF = decode digits 0-7
DecodeMode:
LOW Load
SHIFTOUT DOUT, CLK, MSBFIRST,[noparse][[/noparse]$090F\16]
HIGH Load
RETURN
'Set shutdown mode so device is active
ShutDownMode:
LOW Load
SHIFTOUT DOUT, CLK, MSBFIRST,[noparse][[/noparse]$0C01\16]
HIGH Load
RETURN
'Set scan limit mode for three digits
ScanLimit:
LOW Load
SHIFTOUT DOUT, CLK, MSBFIRST,[noparse][[/noparse]$0B02\16]
HIGH Load
RETURN
'Set intensity of LEdDs
'LSNibble 0 = min intensity and F = max intensity
Intensity:
LOW Load
SHIFTOUT DOUT, CLK, MSBFIRST,[noparse][[/noparse]$0A05\16]
HIGH Load
RETURN
Maybe play with each device exclusively first!
I've been playing with the DS1620 this w/e with intentions of timestamping the temps with the DS1320. But first I had to play with both to get an idea how I could do this.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Steve
http://ca.geocities.com/steve.brady@rogers.com/index.html
"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
IF temp·> #< #·then
goto cool·down
and so on.· below is some code for the·different set points of tempspans i want·but if someone know how to use the DS1620 as a thermostat i could use a darlington pair to drive the circuits i want to run on Thigh and TLow.
thanks
AJ
Code:
IF IND = 0000·Then
GOTO Code
ELSEIF·IND = 0001 Then
GOTO·tempspan70To75
ELSEIF IND = 0010 Then
GOTO·tempspan65To70
ELSEIF IND = 0011 Then
GOTO tempspan60To65
ELSIF IND = 0100 Then
GOTO tempspan55To60
ELSIF IND > 0101 Then
GOTO Code
ENDIF
All that just for set peramiters·in conjuction with a·dip switche for a thermostat.· So if anyone can help in using the DS1620 it would be much appreciated