pro plot_ccd_temps,hk,timeint,single=single,camera=camera, $
    unconvert=unconvert
; 
;     hk = array of all monitors from HK TLM stream generated by DACS 
;     timeint = 2 word array giving the start and end times for the plot 
; 
;  modified for byte version of hk
; @(#)plot_ccd_temps.pro	1.1 01/23/98 :LASCO IDL LIBRARY
;
;
offset=12		; number of bytes to LASCO HK definition
; 
hk1 = gethkn(hk,1) 
getcputime,hk1,firstday,time1,cdstime=utc1

!p.multi=[0,2,4,0,0] 
sp = 0
!x.title = 'Time (Hours) Starting Date:  '+ utc2str(utc1(0))
IF KEYWORD_SET(single) THEN BEGIN
   !p.multi=0
   sp = single
ENDIF
IF KEYWORD_SET(camera) THEN BEGIN
   !p.multi=[0,1,2,0,0]
   camlow = camera
   camhih = camera
ENDIF ELSE BEGIN
   sp = 0
   camlow = 0
   camhih = 3
ENDELSE

plotnum = 0
FOR cam=camlow,camhih DO BEGIN 
;
; The camera status begins at word 26 in HK1 where sync is word 1
; There are 24 status words for each camera.  Subtracting 2 accounts
; for the HK definitions starting at 1 and multiplying by 2 accounts
; 2 bytes per word
;
    offcam = offset + 2 * (26 + cam*24 - 2)
;
    plotnum = plotnum+1
    IF (sp eq 0) OR (sp EQ plotnum) THEN BEGIN
       vh = FIX(hk1(offcam+12,*))		; subword 6, high byte
       vl = FIX(hk1(offcam+13,*))		; subword 6, low byte
       v = (vh AND 3) * 256 + vl		; form 10 bit quantity
       v = REFORM(v)
       IF KEYWORD_SET(unconvert) THEN BEGIN
          !y.title = 'Temp (DN)' 
          !y.range=[0,1200]
       ENDIF ELSE BEGIN
          FOR j=0, N_ELEMENTS(v)-1 DO BEGIN
             IF (j EQ 0) THEN allv = cnvrt_temps(v(j),0) ELSE allv = [allv,cnvrt_temps(v(j),0)]
          ENDFOR
          ;v = cnvrt_temps(v,0) 
          v = allv
          !y.title = 'Temp (Deg C)' 
          !y.range=[-100,20]
       ENDELSE
       utplot,utc1,v,title='C'+STRTRIM(cam,2)+' Cold Finger Temp'
    ENDIF
    plotnum = plotnum+1
    IF (sp eq 0) OR (sp EQ plotnum) THEN BEGIN
       vh = FIX(hk1(offcam+14,*))		; subword 7, high byte
       vl = FIX(hk1(offcam+15,*))		; subword 7, low byte
       v = (vh AND 3) * 256 + vl		; form 10 bit quantity
       v = REFORM(v)
       IF KEYWORD_SET(unconvert) THEN BEGIN
          !y.title = 'Temp (DN)' 
          !y.range=[0,1200]
       ENDIF ELSE BEGIN
          v = cnvrt_temps(v,1) 
          !y.title = 'Temp (Deg C)' 
          !y.range=[0,10]
       ENDELSE
       utplot,utc1,v,title='C'+STRTRIM(cam,2)+' CCD Temp'
    ENDIF

ENDFOR
!p.multi = 0 
!x.title = '' 
!y.title = '' 
empty 
return 
end 
