Home
Projects
Proton-
Magnetometer
Proton-
Magnetometer II
Marine Magnetometer
UV PCB Writer
Lab Power Supply
Light Barrier
Line Frequency
Interesting
Strange Sensor
ABPM50
Pedal with 270 Degrees Poti
Misc Stuff
China!
About Myself
 
DE  EN

File Format of the ABPM50 24h Blood Pressure Measurement Instrument

When taking blood pressure measurements, there are two things that annoyed me again and again:

  1. Single measurements that one knows that they will come. Because of the extreme variability of blood pressure measurements, excitement due to the "white-coat effect" etc., I really think that single measurements done at home are more or less useless. Only periodic measurements that are triggered automatically without a preliminary warning have some relevance.

  2. Almost every blood-pressure instrument hardware could perform periodic automatic measurements - in theory. In a simple manner a few lines of code in the used processors would enable that. Even with a simple memory-function without any export feature, this would offer everyone to get really useful values. But none of the typical consumer instruments offer that. Even a function that triggers a measurement after a random waiting time would be interesting. But obviously no company is thinking on such features, maybe they do not want to start a conflict with the high-price medical industry and other lobbyists who do not want to see automatic measurements in the hands of us end users. Or they are simply to lazy to change products, thinking that they can make money anyway, even if things could be made better.

Therefore kudos to the Contec, that shows with their ABPM50 how long-term periodic measurements can be made by a relatively affordable price:

ABPM50

I do not want to write long about the instrument itself, there are lots of reviews in the internet. My negative points are quickly listed: The highlighting of the active menu point is very hard to see (white frame changes to yellow). The seconds point is the PC software, it is not really beautiful, some rework could not harm, many cosmetic points to complain about. But what is really bad: There seems to be no export in a useful data format.

The measurement values are saved with an extension ".awp". I have analyzed the data format at least partially by some reverse-engineering. I also wrote an Excel-Macro that allows the import into Excel. Because I believe that other users could be interested too I decided to present them here.

The .awp files are luckily text files that can be viewed with an editor such as notepad. It can be seen easily that the measurements are stored within lines by using hexadecimal digits. After looking deeper I was able to guess the secrets, kudos to the software developer who has done that, it is pragmatic and simple. According to my understanding the lines are composed as follows:

     Measurement Number
     |       Systolic Pressure in mmHg (2-digit Hexadecimal Number), 74(hex) = 116(dez)
     |       | Diastolic Pressure, 43(hex) = 67(dez)
     |       | | Pulse Rat in Beats per Minute, 44(hex) = 68(dez)
     |       | | | Average Artery Pressure, 52(hex) = 82(dez)
     |       | | | | Minutes since Measurement Start (4-digit Hexadecimal Number), 04C4(hex) = 1220(dez)
     |       | | | | |
     |       ssddppaammmm??
     149=00007443445204C4030000000
     148=000072433A4F04BF030000000
     147=0000784B3B5904BA030000000
     146=00007947395504B5030000000

The part marked with "??" remains unresolved. Maybe these are marker bits for measurements that have been edited with the PC program. The information about the minutes since measurement start requires the true starting time to calculate the absolute time and date. This information can be found in the following lines:

     MinBegin=40
     HourBegin=14
     DayBegin=25
     MonthBegin=7
     YearBegin=2008

Visual Basic, the language used for Excel-Macros, offers all required functions to import the data: Opening files, scanning character strings, cut them in fragments, converting hexadecimal digits too.

Here is a simple Excel-Macro, which reads .awp-Files and displays the contained measurement data in a table with the thw following columns (MAP = Mean Artery Pressure, HR = Heart Pulse Rate):

     Number Date/Time Sys Dia MAP HR

The macro can be simply entered by copy&paste from this web-page into the Visual-Basic editor of Excel:

Sub ReadAbpm50File()
'
' Simple Exce Macro to read ABPM50 files
'
    fName = Application.GetOpenFilename("ABPM50 Files (*.awp), *.awp")
    If fName = "" Or fName = False Then
        MsgBox "File Selection - Abort"
        Exit Sub
    End If
    Columns("A:F").Select ' Attention!
    Selection.ClearContents ' This will delete contents of the actual table in Excel!
    i = 1
    Cells(i, 1).Value = "Number" ' Column headlines
    Cells(i, 2).Value = "Date/Time"
    Cells(i, 3).Value = "Sys"
    Cells(i, 4).Value = "Dia"
    Cells(i, 5).Value = "MAP"
    Cells(i, 6).Value = "HR"
    i = i + 1
    Open fName For Input As #1 ' Open file for reading
        Do Until EOF(1) ' Until end of file not reached:
            Line Input #1, txt ' Read lines from file
            If InStr(txt, "=") Then ' Line with equal sign?
            txtL = Left(txt, InStr(txt, "=") - 1) ' Text left from equal sign
            txtR = Right(txt, Len(txt) - InStr(txt, "=")) ' Text right from equal sign
            If IsNumeric(txtL) Then ' Number on left side? Measurement found!
                Cells(i, 1).EntireRow.Clear ' Delete line in table
                Cells(i, 1).Value = Val(txtL) ' Number
                Cells(i, 2).Value = Val("&H" + Mid(txtR, 13, 4)) ' Minutes since Start (with Hex-Dez-Conversion)
                Cells(i, 3).Value = Val("&H" + Mid(txtR, 5, 2)) ' Sys (with Hex-Dez-Conversion)
                Cells(i, 4).Value = Val("&H" + Mid(txtR, 7, 2)) ' Dia (with Hex-Dez-Conversion)
                Cells(i, 5).Value = Val("&H" + Mid(txtR, 11, 2)) ' MAP (with Hex-Dez-Conversion)
                Cells(i, 6).Value = Val("&H" + Mid(txtR, 9, 2)) ' HR  (with Hex-Dez-Conversion)
                i = i + 1
            ElseIf txtL = "MinBegin" Then ' Start Minutes found
                minBegin = txtR ' Store it
            ElseIf txtL = "HourBegin" Then ' Start Hours found
                hourBegin = txtR ' Store it
            ElseIf txtL = "DayBegin" Then ' Start Day found
                dayBegin = txtR ' Store it
            ElseIf txtL = "MonthBegin" Then ' Start Month found
                monthBegin = txtR ' Store it
            ElseIf txtL = "YearBegin" Then ' Start Year found
                yearBegin = txtR ' Store it
            End If
         End If
      Loop
   Close
   startDate = yearBegin + "-" + monthBegin + "-" + dayBegin + " " + hourBegin + ":" + minBegin
   If IsDate(startDate) = False Then ' Check found start date
      MsgBox "Abort - No Start Date"
      Exit Sub
   End If
   While i > 2 ' Iterate through table backwards and convert minutes in absolute date/time
        i = i - 1
        minutes = Cells(i, 2).Value
        Cells(i, 2).Value = CDate(startDate) + minutes / 24 / 60
        Cells(i, 2).NumberFormat = "DD.MM.YYYY hh:mm"
   Wend
   Columns("A:F").Select ' Sort (just to be sure about the order)
   Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, Orientation:=xlTopToBottom
   Range("A1").Select
End Sub

For sure a lot of things can be improved, such as an automatic creation of a diagram for example. But here I tried to present only a basic starting point that can be extended by everyone on his own.

Oktober 2017

2021 Alexander Mumm