... actually if I have PBP show me the 'DIG1' of the value that was 27, it is actually 27.7... it needs to be just 27.. How does one round using PBP?
... actually if I have PBP show me the 'DIG1' of the value that was 27, it is actually 27.7... it needs to be just 27.. How does one round using PBP?
Tom, Where is the value for the variable TC1 comming from?
Dave Purola,
N8NTA
It is coming from an array of 2 HEX bytes, which are then converted to binary. In the case I am using, the
the value '44308' is what TRACID_ID is in this example..
SSD4= (ssmax[1]>>4)
SSD3= (ssmax[1] & $f)
SSD2= (ssmax[0]>>4)
SSD1= (ssmax[0] & $f)
TracID_D=(ssd4*4096)+(ssd3*256)+(ssd2*16)+ssd1' convert to dec
TC1=(TracID_D/1600)
I have attached a spreadsheet that does this also. It uses an "INT" function to keep the result of the TracID_D/1600 rounded to 27. In PBP I need an equivalent function. Otherwise the answer is 27.7 and that messes up the CASE statement.
IN the excel example, if you remove the INT function, it gives 27.7 also.
TG
WOW!! I just tried setting my value to 27 manually, and it STILL does not work!!
Check this out:
TC1=27
Select Case TC1
case 0
TracID1 = " "
case TC1 < 27 'A-Z
TracID1 = TC1 + 64
case TC1 >= 27 '0-9
TracID1 = TC1 + 21
case 37
TracID1 = ":"
case 38
TracID1 = "."
case else
TracID1 = "$"
End Select
The result is "[", when it should be "0"!!! How could I be setting a value of "27" and having this kind of result?
TG
Tom, If you would please try the code exactly as I have written it in my first reply and tell me what the results are.
Dave Purola,
N8NTA
The answer was to not use the CASE statement at all.. It looked like it was failing somehow internally. So I moved to:
If TCX = 0 then TracID1 = " "
If TCX < 27 then TracID1 = TCX+64
If TCX >=27 then TracID1 = TCX+21
If TCX = 37 then TracID1 = ":"
If TCX = 38 then TracID1 = "."
if TCX > 38 then TracID1 = "$"
I think the code is smaller, and best of all it works.
Tom, It only goes to show, There's more than 1 way to skin a cat.......
Dave Purola,
N8NTA
Bookmarks