Check out the 7segment.pbp sample program at meLabs

http://www.melabs.com/resources/samples.htm

HTH,
  Darrel