maybe like this , the msb of a var is the sign bit
to convert between unsigned an signed use abs() or vice versa var=~var+1
Code:Vadc var word Vref var word vDif var word aDif var word vDif = Vref - Vadc ;signed difference adif= abs(Vref - Vadc);absoloute unsigned difference if vDif.15 then do negative stuff else do positive stuff endif
Bookmarks