Code:
$regfile = "m8def.dat"
$crystal = 1000000
$baud = 9600
Config Adc = Single , Prescaler = Auto
Dim A As Word
Const B = 128

Start Adc

Do
 A = Getadc(0)
 If A > B Then
  Portb.1 = 0
  Else
    Portb.1 = 1
  End If
 Loop
End
soweit mein "pseudocode"...keine ahnung, ob das funzt, aber so würde ich anfangen.
mfg knacki