I think you wish to build a bar graph with a value

This will help you

Code:
' Build a bar from the value in ChPeak
' Each led gets 1 bit - 0 for on, 1 for off
' Output in BarGraph 16 bits
' Gr[0] is a temporary variable
'
BuildBar:
    for gr[0] = 0 to 15
      if gr[0] < ChPeak then
        ' put this LED off 1
        BarGraph.0(gr[0])=1
      else
        ' put this LED on 0
        BarGraph.0(gr[0])=0
      endif
    next
    return