pro plot_leb_volt,hk,timeint,pltype,noconvert=noconvert,single=single
;
;     hk = array of all monitors from HK TLM stream generated by DACS
;     timeint = 2 word array givingg the start and end times for the plot
;     pltype = plot type flag
;           0 for all plots
;           1 for LEB voltage set #1 (+5, +9, +10, +15, +24, +31, +120)
;           2 for LEB voltage set #2 (GND, current, -10, -15, -45)
;           3 C1 camera
;           4 C2 camera
;           5 C3 camera
;           6 EIT camera
;
; offset the beginning of HK before LASCO HK information begins
; modified 20 Mar 1996 for hk in bytes
;
; @(#)plot_leb_volt.pro	1.2 11/05/01 :LASCO IDL LIBRARY
;
offset=12		; in bytes after LOBT for /no_hdr
;
hk1 = gethkn(hk,1)
getcputime,hk1,firstday,time,cdstime=utc
time=utc
!x.title = 'Time (Hours) Starting Date:  '+ utc2str(utc(0))
IF keyword_set(noconvert) THEN begin
	!y.title='Voltage (DN)' 
	!y.range= [0,255]
ENDIF else !y.title = 'Voltage (Volt)'
IF (pltype eq 0) or (pltype eq 1) THEN begin
IF keyword_set(single) THEN BEGIN
   single=single
   !p.multi=''
ENDIF ELSE BEGIN
   !p.multi=[0,3,2,0,1]
   !p.multi=[0,3,4,0,1]
   single=0
ENDELSE
   offvolt = offset+2*(4-1)
   IF (single EQ 0) OR (single EQ 1) THEN BEGIN
;   v = tmpoint(hk1,offvolt+5,'ff00'xl)		;subword 5
   v = fix(hk1(offvolt+10,*))		;subword 5
   IF keyword_set(noconvert) THEN begin
      utplot,time,v,title='LEB +5V'
   ENDIF else begin
      v = (v-128)*.0782
      utplot,time,v,title='LEB +5V',/ynozero , yrange=[4,6]
   endelse
   ENDIF
   IF (single EQ 0) OR (single EQ 2) THEN BEGIN
;   v = tmpoint(hk1,offvolt+6,'ff00'xl)		;subword 6
   v = fix(hk1(offvolt+12,*))		;subword 6
   IF keyword_set(noconvert) THEN begin
      utplot,time,v,title='LEB +9V'
   ENDIF else begin
      v = (v-128)*.0869
      utplot,time,v,title='LEB +9V',/ynozero , yrange=[8,10]
   endelse
   ENDIF
   IF (single EQ 0) OR (single EQ 3) THEN BEGIN
;   v = tmpoint(hk1,offvolt+6,'ff'xl)		;subword 6
   v = fix(hk1(offvolt+13,*))		;subword 6
   IF keyword_set(noconvert) THEN begin
      utplot,time,v,title='LEB +10V'
   ENDIF else begin
      v = (v-128)*.0978
      utplot,time,v,title='LEB +10V',/ynozero , yrange=[9,11]
   endelse
   ENDIF
   IF (single EQ 0) OR (single EQ 4) THEN BEGIN
;   v = tmpoint(hk1,offvolt+7,'ff'xl)		;subword 7
   v = fix(hk1(offvolt+15,*))		;subword 7
   IF keyword_set(noconvert) THEN begin
      utplot,time,v,title='LEB -10V'
   ENDIF else begin
      v = (v-128)*.0978
      utplot,time,v,title='LEB -10V',/ynozero , yrange=[-9,-11.]
   endelse
   ENDIF
   IF (single EQ 0) OR (single EQ 5) THEN BEGIN
;   v = tmpoint(hk1,offvolt+7,'ff00'xl)		;subword 7
   v = fix(hk1(offvolt+14,*))		;subword 7
   IF keyword_set(noconvert) THEN begin
      utplot,time,v,title='LEB +15V'
   ENDIF else begin
      v = (v-128)*.1567
;      utplot,time,v,title='LEB +15V',/ynozero , yrange=[14,16]
      utplot,time,v,title='LEB +15V',/ynozero , yrange=[9,16]
   endelse
   ENDIF
   IF (single EQ 0) OR (single EQ 6) THEN BEGIN
;   v = tmpoint(hk1,offvolt+8,'ff'xl)		;subword 8
   v = fix(hk1(offvolt+17,*))		;subword 8
   IF keyword_set(noconvert) THEN begin
      utplot,time,v,title='LEB -15V'
   ENDIF else begin
      v = (v-128)*.1567
      utplot,time,v,title='LEB -15V',/ynozero , yrange=[-14,-16]
   endelse
;   !p.multi = 0
;ENDIF
;IF (pltype eq 0) or (pltype eq 2) THEN begin
;   !p.multi=[0,3,2,0,0]
   offvolt = offset+2*(4-1)
   ENDIF
   IF (single EQ 0) OR (single EQ 7) THEN BEGIN
;   v = tmpoint(hk1,offvolt+8,'ff00'xl)		;subword 8
   v = fix(hk1(offvolt+16,*))		;subword 8
   IF keyword_set(noconvert) THEN begin
      utplot,time,v,title='LEB +24V'
   ENDIF else begin
      v = (v-128)*.2346
      utplot,time,v,title='LEB +24V',/ynozero , yrange=[22,26]
   endelse
   ENDIF
   IF (single EQ 0) OR (single EQ 8) THEN BEGIN
;   v = tmpoint(hk1,offvolt+9,'ff'xl)		;subword 9
   v = fix(hk1(offvolt+19,*))		;subword 9
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='LEB +31V'
   ENDIF else begin
      v = (v-128)*.3399
      utplot,time,v,title='LEB +31V',/ynozero , yrange=[25,35]
   endelse
   ENDIF
   IF (single EQ 0) OR (single EQ 9) THEN BEGIN
;   v = tmpoint(hk1,offvolt+9,'ff00'xl)		;subword 9
   v = fix(hk1(offvolt+18,*))		;subword 9
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='LEB -20V'
   ENDIF else begin
      v = (v-128)*.2058
      utplot,time,v,title='LEB -20V',/ynozero , yrange=[-18,-20]
   endelse
   ENDIF
   IF (single EQ 0) OR (single EQ 10) THEN BEGIN
;   v = tmpoint(hk1,offvolt+10,'ff'xl)		;subword 10
   v = fix(hk1(offvolt+21,*))		;subword 10
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='LEB +120V'
   ENDIF else begin
      v = (v-128)*1.1417
      utplot,time,v,title='LEB +120V',/ynozero , yrange=[115,125]
   endelse
   ENDIF
   IF (single EQ 0) OR (single EQ 11) THEN BEGIN
;   v = tmpoint(hk1,offvolt+3,'ff00'xl)		;subword 3
   v = fix(hk1(offvolt+6,*))		;subword 3
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='LEB Ground'
   ENDIF else begin
      v = (v-128)*.0782
      mx = max(v,min=mn)
      utplot,time,v,title='LEB Ground',/ynozero , yrange=[-0.5,0.5]
   endelse
   ENDIF
   IF (single EQ 0) OR (single EQ 12) THEN BEGIN
;   v = tmpoint(hk1,offvolt+11,'ff'xl)		;subword 11
   v = fix(hk1(offvolt+23,*))		;subword 11
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='LEB Current',ytitle='Current (DN)'
   ENDIF else begin
      w = where(v gt 157,nw)
      w1 = where(v lt 158,nw1)
      fv = float(v)
      IF nw gt 1 then fv(w) = (v(w)-158)*.1249+1.93
      IF nw1 gt 1 then fv(w1) = (v(w1)-128)*.05897
      mx = max(fv,min=mn)
      utplot,time,fv,title='LEB Current',/ynozero,ytitle='Current (amp)' $
   	, yrange=[.98*mn,1.02*mx]
   endelse
   ENDIF
   !p.multi = 0
ENDIF
;ENDIF
IF (pltype eq 0) or (pltype eq 3) then begin
   !p.multi=[0,3,2,0,0]
   offcam = offset+2*(25-1)
;   v = tmpoint(hk1,offcam+2,'3ff'xl)
   v = fix(hk1(offcam+4,*) and 3)*256+fix(hk1(offcam+5,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C1 Camera +15V'
   ENDIF else begin
      v = v*(.010*((200+130)/200.))
      utplot,time,v,title='C1 Camera +15V',yrange=[10,20]
   endelse
;   v = tmpoint(hk1,offcam+1,'3ff'xl)
   v = fix(hk1(offcam+2,*) and 3)*256+fix(hk1(offcam+3,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C1 Camera -15V'
   ENDIF else begin
      v = ((200+226)/200.)*(v*.01-15.3)+15.3
      utplot,time,v,title='C1 Camera -15V',yrange=[-10,-20]
   endelse
;   v = tmpoint(hk1,offcam+3,'3ff'xl)
   v = fix(hk1(offcam+6,*) and 3)*256+fix(hk1(offcam+7,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C1 Camera +24V'
   ENDIF else begin
      v = v*(.010*((200+110)/110.))
      utplot,time,v,title='C1 Camera +24V',yrange=[20,26]
   endelse
;   v = tmpoint(hk1,offcam+5,'3ff'xl)
   v = fix(hk1(offcam+10,*) and 3)*256+fix(hk1(offcam+11,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C1 Camera +10V'
   ENDIF else begin
      v = v*(.010*((825+110)/825.))
      utplot,time,v,title='C1 Camera +10V',yrange=[5,15]
   endelse
;   v = tmpoint(hk1,offcam+4,'3ff'xl)
   v = fix(hk1(offcam+8,*) and 3)*256+fix(hk1(offcam+9,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C1 Camera +5V Analog'
   ENDIF else begin
      v = v*.010
      utplot,time,v,title='C1 Camera +5V Analog',yrange=[3,8]
   endelse
;   v = tmpoint(hk1,offcam+8,'3ff'xl)
   v = fix(hk1(offcam+16,*) and 3)*256+fix(hk1(offcam+17,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C1 Camera +5V Digital'
   ENDIF else begin
      v = v*.010
      utplot,time,v,title='C1 Camera +5V Digital',yrange=[3,8]
   endelse
   !p.multi = 0
ENDIF
IF (pltype eq 0) or (pltype eq 4) then begin
   !p.multi=[0,3,2,0,0]
   offcam = offset+2*(49-1)
;   v = tmpoint(hk1,offcam+2,'3ff'xl)
   v = fix(hk1(offcam+4,*) and 3)*256+fix(hk1(offcam+5,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C2 Camera +15V'
   ENDIF else begin
      v = v*(.010*((200+130)/200.))
      utplot,time,v,title='C2 Camera +15V',yrange=[10,20]
   endelse
;   v = tmpoint(hk1,offcam+1,'3ff'xl)
   v = fix(hk1(offcam+2,*) and 3)*256+fix(hk1(offcam+3,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C2 Camera -15V'
   ENDIF else begin
      v = ((200+226)/200.)*(v*.01-15.3)+15.3
      utplot,time,v,title='C2 Camera -15V',yrange=[-10,-20]
   endelse
;   v = tmpoint(hk1,offcam+3,'3ff'xl)
   v = fix(hk1(offcam+6,*) and 3)*256+fix(hk1(offcam+7,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C2 Camera +24V'
   ENDIF else begin
      v = v*(.010*((200+110)/110.))
      utplot,time,v,title='C2 Camera +24V',yrange=[20,26]
   endelse
;   v = tmpoint(hk1,offcam+5,'3ff'xl)
   v = fix(hk1(offcam+10,*) and 3)*256+fix(hk1(offcam+11,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C2 Camera +10V'
   ENDIF else begin
      v = v*(.010*((825+110)/825.))
      utplot,time,v,title='C2 Camera +10V',yrange=[5,15]
   endelse
;   v = tmpoint(hk1,offcam+4,'3ff'xl)
   v = fix(hk1(offcam+8,*) and 3)*256+fix(hk1(offcam+9,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C2 Camera +5V Analog'
   ENDIF else begin
      v = v*.010
      utplot,time,v,title='C2 Camera +5V Analog',yrange=[3,8]
   endelse
;   v = tmpoint(hk1,offcam+8,'3ff'xl)
   v = fix(hk1(offcam+16,*) and 3)*256+fix(hk1(offcam+17,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C2 Camera +5V Digital'
   ENDIF else begin
      v = v*.010
      utplot,time,v,title='C2 Camera +5V Digital',yrange=[3,8]
   endelse
   !p.multi = 0
ENDIF
IF (pltype eq 0) or (pltype eq 5) then begin
   !p.multi=[0,3,2,0,0]
   offcam = offset+2*(73-1)
;   v = tmpoint(hk1,offcam+2,'3ff'xl)
   v = fix(hk1(offcam+4,*) and 3)*256+fix(hk1(offcam+5,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C3 Camera +15V'
   ENDIF else begin
      v = v*(.010*((200+130)/200.))
      utplot,time,v,title='C3 Camera +15V',yrange=[10,20]
   endelse
;   v = tmpoint(hk1,offcam+1,'3ff'xl)
   v = fix(hk1(offcam+2,*) and 3)*256+fix(hk1(offcam+3,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C3 Camera -15V'
   ENDIF else begin
      v = ((200+226)/200.)*(v*.01-15.3)+15.3
      utplot,time,v,title='C3 Camera -15V',yrange=[-10,-20]
   endelse
;   v = tmpoint(hk1,offcam+3,'3ff'xl)
   v = fix(hk1(offcam+6,*) and 3)*256+fix(hk1(offcam+7,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C3 Camera +24V'
   ENDIF else begin
      v = v*(.010*((200+110)/110.))
      utplot,time,v,title='C3 Camera +24V',yrange=[20,26]
   endelse
;   v = tmpoint(hk1,offcam+5,'3ff'xl)
   v = fix(hk1(offcam+10,*) and 3)*256+fix(hk1(offcam+11,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C3 Camera +10V'
   ENDIF else begin
      v = v*(.010*((825+110)/825.))
      utplot,time,v,title='C3 Camera +10V',yrange=[5,15]
   endelse
;   v = tmpoint(hk1,offcam+4,'3ff'xl)
   v = fix(hk1(offcam+8,*) and 3)*256+fix(hk1(offcam+9,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C3 Camera +5V Analog'
   ENDIF else begin
      v = v*.010
      utplot,time,v,title='C3 Camera +5V Analog',yrange=[3,8]
   endelse
;   v = tmpoint(hk1,offcam+8,'3ff'xl)
   v = fix(hk1(offcam+16,*) and 3)*256+fix(hk1(offcam+17,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='C3 Camera +5V Digital'
   ENDIF else begin
      v = v*.010
      utplot,time,v,title='C3 Camera +5V Digital',yrange=[3,8]
   endelse
   !p.multi = 0
ENDIF
IF (pltype eq 0) or (pltype eq 6) then begin
   !p.multi=[0,3,2,0,0]
   offcam = offset+2*(97-1)
;   v = tmpoint(hk1,offcam+2,'3ff'xl)
   v = fix(hk1(offcam+4,*) and 3)*256+fix(hk1(offcam+5,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='EIT Camera +15V'
   ENDIF else begin
      v = v*(.010*((200+130)/200.))
      utplot,time,v,title='EIT Camera +15V',yrange=[10,20]
   endelse
;   v = tmpoint(hk1,offcam+1,'3ff'xl)
   v = fix(hk1(offcam+2,*) and 3)*256+fix(hk1(offcam+3,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='EIT Camera -15V'
   ENDIF else begin
      v = ((200+226)/200.)*(v*.01-15.3)+15.3
      utplot,time,v,title='EIT Camera -15V',yrange=[-10,-20]
   endelse
;   v = tmpoint(hk1,offcam+3,'3ff'xl)
   v = fix(hk1(offcam+6,*) and 3)*256+fix(hk1(offcam+7,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='EIT Camera +24V'
   ENDIF else begin
      v = v*(.010*((200+110)/110.))
      utplot,time,v,title='EIT Camera +24V',yrange=[20,26]
   endelse
;   v = tmpoint(hk1,offcam+5,'3ff'xl)
   v = fix(hk1(offcam+10,*) and 3)*256+fix(hk1(offcam+11,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='EIT Camera +10V'
   ENDIF else begin
      v = v*(.010*((825+110)/825.))
      utplot,time,v,title='EIT Camera +10V',yrange=[5,15]
   endelse
;   v = tmpoint(hk1,offcam+4,'3ff'xl)
   v = fix(hk1(offcam+8,*) and 3)*256+fix(hk1(offcam+9,*))
   IF keyword_set(noconvert) then begin
      utplot,time,v,title='EIT Camera +5V Analog'
   ENDIF else begin
      v = v*.010
      utplot,time,v,title='EIT Camera +5V Analog',yrange=[3,8]
   endelse
;   v = tmpoint(hk1,offcam+8,'3ff'xl)
   v = fix(hk1(offcam+16,*) and 3)*256+fix(hk1(offcam+17,*))
   IF keyword_set(noconvert) THEN begin
      utplot,time,v,title='EIT Camera +5V Digital'
   ENDIF else begin
      v = v*.010
      utplot,time,v,title='EIT Camera +5V Digital',yrange=[3,8]
   endelse
   !p.multi = 0
ENDIF
!x.title = ''
!y.title = ''
empty
return
end

