Why not use LONG variable? PBP will do everything for you.
Before LONG I use something like this
A is lowest byte, D is highest.Code:A var byte B var byte C var byte etc main: GOTO main Init: ' start value of each byte A=0 B=0 etc... RETURN Inc: A=A+1 IF A=0 THEN B=B+1 IF B=0 THEN C=C+1 IF C=0 THEN D=D+1 ENDIF ENDIF ENDIF
A,B,C,D is 0 only on overflow, so if lowest byte overflow(IT go from 255 to 0) you need to add 1 to second byte.
For example if you want to calculate actual value of counter you need to do it like this:
32bitResult=D*2^24+C*2^16+B*2^8+A
Hope that I understand what exactly you need.
EDIT:
Sorry for long, you use 16F. I didn't use 16F since LONG variable is added to PBP...




Bookmarks