pro plot_temps,hk,timeint , single=single
; 
;     hk = array of all monitors from HK TLM stream generated by DACS 
;     timeint = [optional] 2 word array giving the start and end times for the plot 
;	ex: 
;		IDL> hk = readallhk('971022') or hk = readallhk('971022_1', /ecs)
;		IDL> plot_temps, hk or plot_temps, hk, ['1997/10/22 16:00','1997/10/22 20:00']
; 
; @(#)plot_temps.pro	1.1 01/23/98 :LASCO IDL LIBRARY
;
; offset the beginning of HK before LASCO HK information begins 
; 
;  modified for byte version of hk
;
offset=12

IF KEYWORD_SET(timeint) THEN timerange=timeint ELSE timerange=0
IF NOT(KEYWORD_SET(single)) THEN single=0
; 
hk1 = gethkn(hk,1) 
hk2 = gethkn(hk,2) 
hk3 = gethkn(hk,3) 
 
!y.title = 'Temp (Deg C)' 
IF (single EQ 0) THEN !p.multi=[0,3,4,0,1] ELSE !p.multi=0
 
getcputime,hk1,firstday,time1,cdstime=utc1
getcputime,hk2,firstday,time2,cdstime=utc2
getcputime,hk3,firstday,time3,cdstime=utc3

!x.title = 'Time (Hours) Starting Date:  '+ utc2str(utc1(0))
 
offvolt = offset+2*(4-1)
off_fp = offset+2*(47-1)
 
IF (single EQ 0) OR (single EQ 1)  THEN BEGIN
   ;v = tmpoint(hk1,offvolt+11,'ff00'xl)            ;subword 11 
   v = fix(hk1(offvolt+22,*))            ;subword 11, high byte
   v = cnvrt_temps(v,3) 
   utplot,utc1,v,title='LEB PC',yrange=[10,+50] , timerange=timerange
ENDIF
 
;v = tmpoint(hk2,off_fp+79,'ffff'xl)            ;subword 79 
;v = cnvrt_temps(v,5) 
;plot,time2,v,title='FP RING Board',yrange=[0,+40] 
;v = tmpoint(hk2,off_fp+88,'ffff'xl)            ;subword 88 
;v = cnvrt_temps(v) 
;plot,time2,v,title='FP APZ Board',yrange=[0,+40] 
 
IF (single EQ 0) OR (single EQ 2)  THEN BEGIN
   ;v = tmpoint(hk1,offvolt+16,'ff00'xl)            ;subword 16 
   v = fix(hk1(offvolt+32,*))            ;subword 16, high byte
   v = cnvrt_temps(v,3) 
   utplot,utc1,v,title='C2 Therm 1',yrange=[0,+40] , timerange=timerange
ENDIF

IF (single EQ 0) OR (single EQ 3)  THEN BEGIN
   ;v = tmpoint(hk1,offvolt+17,'ff'xl)              ;subword 17 
   v = fix(hk1(offvolt+35,*))              ;subword 17, low byte
   v = cnvrt_temps(v,3) 
   utplot,utc1,v,title='C2 Therm 2',yrange=[0,+40] , timerange=timerange
ENDIF

IF (single EQ 0) OR (single EQ 4)  THEN BEGIN
   ;v = tmpoint(hk1,offvolt+17,'ff00'xl)            ;subword 17 
   v = fix(hk1(offvolt+34,*))            ;subword 17, high byte
   v = cnvrt_temps(v,3) 
   utplot,utc1,v,title='C2 Therm 3',yrange=[0,+40] , timerange=timerange
ENDIF

IF (single EQ 0) OR (single EQ 5)  THEN BEGIN
   ;v = tmpoint(hk1,offvolt+18,'ff'xl)              ;subword 18 
   v = fix(hk1(offvolt+37,*))              ;subword 18, low byte
   v = cnvrt_temps(v,3) 
   utplot,utc1,v,title='C3 Therm 1',yrange=[0,+40] , timerange=timerange
ENDIF

IF (single EQ 0) OR (single EQ 6)  THEN BEGIN
   ;v = tmpoint(hk1,offvolt+18,'ff00'xl)            ;subword 18 
   v = fix(hk1(offvolt+36,*))            ;subword 18, high byte
   v = cnvrt_temps(v,3) 
   utplot,utc1,v,title='C3 Therm 2',yrange=[0,+40] , timerange=timerange
ENDIF

IF (single EQ 0) OR (single EQ 7)  THEN BEGIN
   ;v = tmpoint(hk1,offvolt+19,'ff'xl)              ;subword 19 
   v = fix(hk1(offvolt+39,*))              ;subword 19, low byte 
   v = cnvrt_temps(v,3) 
   utplot,utc1,v,title='C3 Therm 3',yrange=[0,+40] , timerange=timerange
ENDIF

; 
;   now do zone thermistors 
; 
;offvolt = offset+88-1           ; the -1 is to take care of the subword offset 
offvolt = offset+2*(88-1)           ; the -1 takes care of the subword offset 
IF (single EQ 0) OR (single EQ 8)  THEN BEGIN
   ;v = tmpoint(hk3,offvolt+2,'ff'xl)               ;subword 2 
   v = fix(hk3(offvolt+5,*))               ;subword 2, low byte
   v = cnvrt_temps(v,2) 
   utplot,utc3,v,title='Zone Therm 1',yrange=[0,+40] , timerange=timerange
ENDIF

IF (single EQ 0) OR (single EQ 9)  THEN BEGIN
   ;v = tmpoint(hk3,offvolt+2,'ff00'xl)             ;subword 2 
   v = fix(hk3(offvolt+4,*))             ;subword 2, high byte
   v = cnvrt_temps(v,2) 
   utplot,utc3,v,title='Zone Therm 2',yrange=[0,+40] , timerange=timerange
ENDIF

IF (single EQ 0) OR (single EQ 10)  THEN BEGIN
   ;v = tmpoint(hk3,offvolt+3,'ff'xl)               ;subword 3 
   v = fix(hk3(offvolt+7,*))               ;subword 3, low byte
   v = cnvrt_temps(v,2) 
   utplot,utc3,v,title='Zone Therm 3',yrange=[0,+40] , timerange=timerange
ENDIF

IF (single EQ 0) OR (single EQ 11)  THEN BEGIN
   ;v = tmpoint(hk3,offvolt+3,'ff00'xl)             ;subword 3 
   v = fix(hk3(offvolt+6,*))             ;subword 3, high byte
   v = cnvrt_temps(v,2) 
   utplot,utc3,v,title='Zone Therm 4',yrange=[0,+40] , timerange=timerange
ENDIF

IF (single EQ 0) OR (single EQ 12)  THEN BEGIN
   ;v = tmpoint(hk3,offvolt+4,'ff'xl)               ;subword 4 
   v = fix(hk3(offvolt+9,*))               ;subword 4, low byte
   v = cnvrt_temps(v,2) 
   utplot,utc3,v,title='Zone Therm 5',yrange=[0,+40] , timerange=timerange
ENDIF
   
!p.multi = 0 
!x.title = '' 
!y.title = '' 
empty 
return 
end 
 
