Hi,
This is untested but I think it'll do what you want/Henrik.Code:Sens VAR BIT[5] ' 5bit array for sensor bits Sens1 VAR Sens[0] ' Aliases to the array bits. Sens2 VAR Sens[1] Sens3 VAR Sens[2] Sens4 VAR Sens[3] Sens5 VAR Sens[4] Multiplicator VAR WORD Value VAR WORD i VAR BYTE CalculateValue: Multiplicator = 1 Value = 0 For i = 0 to 4 ' Index the 5 sensor bits of the array IF Sens[i] THEN Value = Value + ((i+1) * Multiplicator) Multiplicator = Multiplicator * 10 ENDIF NEXT
Bookmarks