This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Missing definition for function WriteSMBusInteger in document SLUA379E

Does anyone know what's required to utilize the sample VB sourcecode found in the slua379e.pdf document?  The function WriteSMBusInteger is not defined in the ActiveX file Bq80xRW1.OCX.

Thanks in advance!

  • The WriteSMBusWord() function is the same as WriteSMBusInteger()

    bq80xrw.ocx uses the name WriteSMBusWord()

  • Thanks for the quick response.

    I believe I have modified the code correctly.  I noticed that I had to also modify the ReadSMBusArray() function to ReadSMBusByteArray().  Does this look correct?

    Option Explicit
    Public Function WriteDataFlashImageFromFile(sFileName As String) As Long
    Dim lError As Long
    Dim iFileNumber As Integer
    Dim iNumberOfRows As Integer
    Dim iRow As Integer
    Dim iIndex As Integer
    Dim yRowData(32) As Byte
    Dim yDataFlashImage(&H700) As Byte
    Dim MSB As Byte
    Dim LSB As Byte

    '// READ THE FLASH IMAGE FROM THE FILE INTO A BYTE ARRAY
    iFileNumber = FreeFile
    Open sFileName For Binary Access Read As #iFileNumber
    Get #iFileNumber, , yDataFlashImage
    Close #iFileNumber
    '// FOR CLARITY, WITHOUT USING CONSTANTS
    iNumberOfRows = 54 '&H60 \ 32 '54 Rows
    '// PUT DEVICE INTO ROM MODE
    lError = WriteSMBusWord(&H0, &HF, &O0)
    doDelay 0.01
    '// ERASE DATA FLASH, ROWS ARE ERASED IN PAIRS
    For iRow = 0 To iNumberOfRows - 1 Step 2
      MSB = iRow / 256
      LSB = iRow And &HFF
      lError = WriteSMBusWord(&H11, MSB, LSB)
      doDelay 0.04
    Next iRow
    '// WRITE EACH ROW
    For iRow = 0 To iNumberOfRows - 1
      '// Set the row to program into the first element of the 33 byte array
      yRowData(0) = iRow
      '// Copy data from the full array to the row array 
      For iIndex = 0 To 31
        yRowData(iIndex + 1) = yDataFlashImage((iRow * 32) = iIndex)
      Next iIndex
      '//Write the row. Length is 33 because the first byte is the row number
      lError = ReadSMBusByteArray(&H10, yRowData, 32 + 1)
      doDelay 0.02
    Next iRow
    '// EXECUTE GAS GAUGE PROGRAM
    lError = WriteSMBusCommand(&H8)
    End Function

  • Hi Tim,

    You are correct about the ReadSMBusByteArray

    thanks

    Onyx