PRO PLCT,R,G,B,RESULT=RESULT


case strlowcase(!version.os) of
   'ultix': busname = 'q'               ; Q bus interface to Peritek board
   'irix' : busname = 'v'               ; V bus interface to Peritek board
   else   : busname = 'v'               ; V bus assumed
endcase
r = byte(r) & g = byte(g) & b = byte(b)
n_col = n_elements(r)
rgb = bytarr(3*256)
for i=0,n_col-1 do rgb(3*i) = [r(i),g(i),b(i)]
if n_col lt 256 then $
  for i=n_col,255 do rgb(3*i) = [r(n_col-1),g(n_col-1),b(n_col-1)]
spawn,'$DIR_PERITEK/maketemp',result & fn = result(0)
openw,unit,fn,/get_lun
writeu,unit,rgb & free_lun,unit
command = '$DIR_PERITEK/vct' + busname + 'pseudo -quiet -cmm ' + fn
spawn,command,result
command = 'rm -f ' + fn
spawn,command,result

return
end