0
Private Structure word
        Dim b1 As Byte
        Dim b2 As Byte
        Dim b3 As Byte
        Dim b4 As Byte
    End Structure

Private Function DoubleToWord(ByVal n As Double) As word
        DoubleToWord.b1 = Int(DMod(n, 2 ^ 32) / (2 ^ 24))
        DoubleToWord.b2 = Int(DMod(n, 2 ^ 24) / (2 ^ 16))
        DoubleToWord.b3 = Int(DMod(n, 2 ^ 16) / (2 ^ 8))
        DoubleToWord.b4 = Int(DMod(n, 2 ^ 8))
    End Function

Private Function WordToDouble(ByVal w As word) As Double
        WordToDouble = (w.b1 * (2 ^ 24)) + (w.b2 * (2 ^ 16)) + (w.b3 * (2 ^ 8)) + w.b4
    End Function

Private Function HexToWord(ByVal H As String) As word
        HexToWord = DoubleToWord(Val("&H" & H & "#"))
    End Function

Private Function WordToHex(ByVal w As word) As String
        WordToHex = Hex(w.b1).PadLeft(2, "0") & Hex(w.b2).PadLeft(2, "0") & Hex(w.b3).PadLeft(2, "0") & Hex(w.b4).PadLeft(2, "0")
    End Function

i have a few function...this function is to convert from word to hex

i don't knw how to make the convert from word to binary......plz help me

what should i do...????
thx

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by allopiloping
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.