Hello Don,
Don>>How can I convert a number in hex 4 bytes into decimal 10 digit ! <<
Humm....I am sure there are many ways...This way below has NOT been tested, but I think it will work...Or will work with minor changes.
No4 VAR BYTE
No3 VAR BYTE
No2 VAR BYTE
No1 VAR BYTE
Co1 VAR BYTE
VAR Val[10]="0000000000"
'Increment ones
For Co1=0 TO No1 STEP 1
Val[10]=Val[10]+1;
GoSub Increment
Next Co1
'Increment 256
For Co1=0 TO No2 STEP 1
Val[10]=Val[10]+6;
Val[9]=Val[9]+5;
Val[8]=Val[8]+2;
GoSub Increment
Next Co1
'Increment 65536
For Co1=0 TO No2 STEP 1
Val[10]=Val[10]+6;
Val[9]=Val[9]+3;
Val[8]=Val[8]+5;
Val[7]=Val[7]+5;
Val[6]=Val[6]+6;
GoSub Increment
Next Co1
'Increment 16777216
For Co1=0 TO No2 STEP 1
Val[10]=Val[10]+6;
Val[9]=Val[9]+1;
Val[8]=Val[8]+2;
Val[7]=Val[7]+7;
Val[6]=Val[6]+7;
Val[5]=Val[5]+7;
Val[4]=Val[4]+6;
Val[3]=Val[3]+1
GoSub Increment
Next Co1
For Co1=10 TO 0 STEP -1
LCDOut Val[Co1]
Next Co1
Loop:
GoTo Loop
Increment:
IF Val[10]>9 Then
Val[9]=Val[9]+1
Val[10]=Val[10]-10;
EndIF
IF Val[9]>9 Then
Val[8]=Val[8]+1
Val[9]=Val[9]-10;
EndIF
IF Val[8]>9 Then
Val[7]=Val[7]+1
Val[8]=Val[8]-10;
EndIF
IF Val[7]>9 Then
Val[6]=Val[6]+1
Val[7]=Val[7]-10;
EndIF
IF Val[6]>9 Then
Val[5]=Val[5]+1
Val[6]=Val[6]-10;
EndIF
IF Val[5]>9 Then
Val[4]=Val[4]+1
Val[5]=Val[5]-10;
EndIF
IF Val[4]>9 Then
Val[3]=Val[3]+1
Val[4]=Val[4]-10;
EndIF
IF Val[3]>9 Then
Val[2]=Val[2]+1
Val[3]=Val[3]-10;
EndIF
IF Val[2]>9 Then
Val[1]=Val[1]+1
Val[2]=Va[2]-10;
EndIF
IF Val[1]>9 Then
Val[0]=Val[0]+1
Val[1]=Va[1]-10;
EndIF
Return
End
Ability to Fly:
Hurling yourself towards the ground, and missing.
Engineers that Contribute to flying:
Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute
Pilots that are Flying:
Those who know their limitations, and respect the green side of the grass...
Bookmarks