Could use this or the BIN$ Version about the same.
[code=thinbasic]
' Usage of the HEX$ Instruction example
'
' Returns HEX String of a number
'
' Written by Abraxas
DIM Base10Num as DWORD value &hAAAA5555
DIM TempVal As DWORD Value Base10Num
DIM n as byte value 0
Dim sMsg as String
sMsg += "Base10 = " & Base10Num & $CRLF
sMsg += "Binary = " & Bin$(Base10Num,32) & $CRLF
sMsg += "Hex Nibbles = "
' This Groups 4 bits (a nibble)
For n = 28 to 0 step -4
TempVal = Base10Num
sMsg += " " & HEX$((SHIFT SIGNED RIGHT TempVal,n),1) ' Shift(n) bits
Next
sMsg += $CRLF
sMsg += "Hex = &h" & Hex$(Base10Num,
MsgBox 0, sMsg ' Display The information
[/code]
Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370
Added. Thanks
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Bookmarks