Thanks Dave,
I looked at both as you suggested. These are the results
Number 40.8914
DEC2 returns the value 1
DEC4 RETURNS
Number 50.143
Thanks Dave,
I looked at both as you suggested. These are the results
Number 40.8914
DEC2 returns the value 1
DEC4 RETURNS
Number 50.143
Hit the end button before finished.
Results
The value before Knots is what is the result of whether I have used DEC 1or 2 and DIG 1 or 2. The value fi=ollowing is the knotsRem variable.Code:DEC 1 47.6 Knots 686 46.8 Knots 9598 46.7 Knots 8727 46.2 Knots 9162 47.6 Knots 686 46.4 Knots 8074 46.2 Knots 9162 46.7 Knots 8727 46.2 Knots 9162 46.8 Knots 9598 DEC 2 46.28 Knots 5028 46.69 Knots 3069 46.28 Knots 5028 46.81 Knots 5681 46.93 Knots 893 46.39 Knots 7639 46.62 Knots 9162 46.16 Knots 6116 46.81 Knots 5681 46.04 Knots 7204 DIG 1 43.1 Knots 3910 42.4 Knots 6946 43.7 Knots 3475 43.8 Knots 6086 44.3 Knots 438 43.6 Knots 4563 43.5 Knots 5651 43.5 Knots 5651 43.8 Knots 6086 43.8 Knots 6086 DIG 2 49.0 Knots 7016 49.5 Knots 8539 49.0 Knots 5058 49.9 Knots 8975 50.4 Knots 498 50.4 Knots 498 49.0 Knots 5058 49.4 Knots 7451 49.6 Knots 4622 49.0 Knots 5058
The DEC1 and 2 seem to make sense, although not displaying the first digit but the DIG 1 and 2 look to return the 2nd digit for DIG1 and 3rd digit for DIG2
Before I was confused - now I'm way past that!!
Looking at the manual there doesn't seem to be anywhere that left justifies a number.
Thanks
aajgss
Last edited by aajgss; - 20th June 2011 at 23:05.
Code:NUM VAR WORD NUM = 12345 NUM_DIG VAR BYTE BOOT: SEROUT2 TX,BAUD,[$d,$a] 'RETURNS 12345 SEROUT2 TX,BAUD,["NUM= ",DEC NUM,$d ,$a] 'RETURNS 345 SEROUT2 TX,BAUD,["NUM= ",DEC3 NUM,$d ,$a] NUM_DIG = NUM DIG 4 'RETURNS 1 SEROUT2 TX,BAUD,["NUM_DIG4= ",DEC NUM_DIG,$d ,$a] NUM_DIG = NUM DIG 3 'RETURNS 2 SEROUT2 TX,BAUD,["NUM_DIG3= ",DEC NUM_DIG,$d ,$a] NUM_DIG = NUM DIG 2 'RETURNS 3 SEROUT2 TX,BAUD,["NUM_DIG2= ",DEC NUM_DIG,$d ,$a] GOTO BOOT
Dave
Always wear safety glasses while programming.
Hi Dave,
I think I understand where your heading with this.
Where I can see a problem with what I am doing is I dont have a constant number of digits in the remainder. It could be 1,2,3 or 4 characters long, So DIG2 would pick the right number if the remainder was in the hundreds, but the wrong number if the result was in the thousands.
If I remember back to Q Basic days there was a Left$ or Right$ and number of characters command, but I cant see anything like that in PBP.
Am I seeing this right or not?
aajgss
Nope...If I remember back to Q Basic days there was a Left$ or Right$ and number of characters command, but I cant see anything like that in PBP.
Try something like this.
IF NUM_REM >= 9999 and <= 1000 THEN
DIG3 NUM_REM
IF NUM_REM >= 999 and <= 100 THEN
DIG2 NUM_REM
Dave
Always wear safety glasses while programming.
Ah Yes,
A good solution, thanks. Using that method I could also now look at the second digit and if >= 5 round up to the next value.
aajgss
Bookmarks