DSA524 files.

Discussion in 'Electronics Resources' started by 2N3055, Oct 21, 2011.

  1. 2N3055

    Thread Starter New Member

    Oct 18, 2011
    7
    0
    Anyone know how to convert a waveform file from a Thurlby Digital Storage Adaptor so that it may be viewed in MS Excel?
    The file has either a DSC or SDT suffix. Probably because it is so old I have not been able to locate any information (so far).
    Thank you.
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Have you considered using WinZip or 7Zip to create a zip format file and upload it so that someone can take a look at one or two of them?

    It would be very helpful to have an image of the screen at the time the data was saved.
     
  3. 2N3055

    Thread Starter New Member

    Oct 18, 2011
    7
    0
    Thank you for the suggestion.
    The screen picture is the display of file 009.DSC.
    It shows a single pulse of about 22V.

    Another attached file is 011.DST and is about 28V peak.
    This is not so different to the former, so I haven't added a picture.
    The settings for both are 5V/div, 100uS/div.
    According to the manual, dsc files are 4096 words long and dst files are 1024 long.
     
  4. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Well, I made a bit of progress on it... but I'm writing in ANSI C, which I haven't used for a long time... and I'm running into a sticky wicket with the data. It seems that if a decimal 26 (hex '1A') is in the file, the program thinks it's hit an EOF and stops reading data.

    Anyway, here's what the plotted data from 009.DSC looks like:

    [​IMG]
     
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I used a hex editor (HxD Hex Editor) to change the offending EOF character from x1A to x19, then re-ran the program, and imported the data to Excel and re-scaled it.

    This is the result:

    [​IMG]
     
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Here's 011.DST converted:

    [​IMG]

    Not knowing the input scale, I arbitrarily scaled it so the peak is 7.

    This file had the same problem; I had to change a hex 1A to hex 19.
     
  7. 2N3055

    Thread Starter New Member

    Oct 18, 2011
    7
    0
    Thank you. You must have spent some time on this and I'm grateful.
    The resulting shapes look good.
    I'm not too sure on whether you have run the original file through another program to change it, or if you edited just one part prior to sending on to excel.
    What might you suggest I can do myself to achieve similar results?
     
  8. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    As I think that I mentioned above, I wrote a couple of ANSI C programs. They read in your data files, and write out .txt files that can be loaded into Excel.

    There are no provisions for changing the filenames for input and output. That's not a huge deal, as you could always rename the file that you wanted to convert, run the program, and then rename the output file.

    I don't know yet how to take care of the h'1A'/d'26' problem with it thinking that end of file has been reached. That is annoying, as you would have to edit every file and make certain that if there were any h'1A's that they were changed to h'1B' or h'19'.

    You would really not notice the 1/256 difference. However, if I can figure out a way to detect that EOF condition and read past it to the actual EOF, then that point is moot.
     
    Last edited: Oct 30, 2011
  9. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I fixed it. :)

    Here's the program:
    [eta]
    Program source code removed; see latest reply for the most up-to-date source code in attached .zip file.

    I'm attaching DSx2Excel.zip
    It contains:
    DSx2Excel.c - The source code
    DSx2Excel.exe - The compiled program, in case you do not wish to compile it yourself.

    In these times, it is usually a good idea to compile the source code rather than trusting someone else's executables; there are far too many computer viruses/malware running around in cyberspace.

    I've taken all reasonable precautions to ensure that the executable is virus-free and malware-free, but you don't have to take my word for it.

    Using the program:
    1) Un-zip the program file to a convenient place, like:
    C:\Program Files\DSx2Excel
    2) Associate your .DSC and .DST file extensions to open them with the DSx2Excel program. You can do this by:
    A) Open Windows Explorer
    B) Navigate to where you store your .DSC and .DST files
    C) Double-click on a .DSC suffix file.
    D) When it asks you what you want to open it with, select "Browse"
    E) Navigate to C:\Program Files\DSx2Excel, and click on DSx2Excel.exe
    F) Repeat steps C) through E) for a .DST suffix file.

    Afterwards, any time you double-click on a .DSC or .DST file, the program will automatically run, read the file, and write an .xls output file.
    For example, if you double-click on:
    009.DSC
    The program will read the file, and write:
    009-DSC.xls
    as the output file.

    Then, double-click on 009-DSC.xls, and Excel will launch and load the file.
    Click on the [ C ] column heading to highlight the entire column.
    Then click the Chart Wizard icon
    Select Line graph
    Select chart sub-type: Line. trend over time
    Click the "Finish" button.
    You should then see a plot that looks very similar to your O-scope plot. By default, the plot title will be the fully qualified dataset name of your .DSC or .DST file that you read in originally.

    Column B contains the raw plot data, either 1024 or 4096 occurrences. The values can range from 0 to 255.
    Column C is column B multiplied by B1, with the filename on top.
    Headings:
    ScaleY: - indicates that cell B1 contains the scale factor. By default, the spreadsheet scales the waveform so that whatever the maximum value is in column B will be scaled to 7 on the plot, so that there are 8 major gridlines on the Y axis. You can change that scale to anything you'd like; but be aware that you will likely have to manually set automatic Y axis scaling as well.

    ScaleX: This scale factor results in cell A2 being zero, and the highest-numbered A cell being 10. If the program completed normally, the last cell should be A4097 for the DSC files, and A1025 for DST files.

    If you change ScaleX: in E1 to 1, column A will be numbered sequentially.

    If you go to save the file in .xls format, Excel will prompt you that if you save the file, it won't be compatible with Tab-delimited format. Don't worry about that; go ahead and save it however you see fit. I wrote the data out as tab delimited with an .xls suffix so that you would not have to bother with using the Import Wizard.

    If you open a newly-created output file within Excel, it will still try to walk you through the Text Import Wizard; in that case just click the "Finish" button.

    It's not perfect, but it's certainly usable.

    [eta] Attachment removed; see following reply
     
    Last edited: Oct 31, 2011
  10. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Minor revision; fixed rejection of all filenames when using manual entry (I'd forgotten to save the length of the filename after it was entered)

    [eta]
    Removed attachment and source code; see following replies for latest source & executable
     
    Last edited: Oct 31, 2011
  11. 2N3055

    Thread Starter New Member

    Oct 18, 2011
    7
    0
    Wow!
    Thank you Sarg.:)
    I hope that you didn't loose too much hair in doing all this! You must have spent hours on it. - I am/shall be eternally grateful.
    Thank you also for accurately detailing all the steps required to produce the desired result. What quickly becomes second nature is sometimes difficult and frustrating in the beginning....
    I was able to replicate your results without difficulty.
    This is good mind stimulating stuff for me and I will be looking into what you have shown us for some time to come. I say 'us' in the hope that there are others who may still have a vintage DSA524 on the shelf and might benefit from your efforts.
     
  12. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Updated the program: improved internal documentation, removed redundant/obsolete code. No change in functionality.

    [eta]
    Removed attachment; see further replies for latest version.
     
    Last edited: Oct 31, 2011
  13. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Actually, I did spend a fair bit of time on it, but it was an interesting challenge - and I needed to dust off my somewhat rusty C skills anyway.

    I spent a number of hours just trying to figure out how to get past the embedded x'1A' data looking to C like EOF; the fseek() function was the answer to that.

    Note that there is very little error-checking in the program. It does make sure that you're feeding it a file name with a suffix of .DSC or .DST, and it does check to make certain the file actually exists, but if the data in the file is truncated (to zero bytes), the program may simply crash.

    If you try to convert a file that's already been converted, and the existing output file is open in Excel, the program won't be able to open/overwrite the output file, and you will not receive an error message.

    If an existing output file is not open in Excel, it will be overwritten by the program.

    That part was an absolute must. If one doesn't know how to use a program, it's useless to them!

    Associating a program to a file extension is a trick that makes using the program very easy.

    While browsing & clicking on your .dsc/.dst files using Explorer, you may have to use View/Refresh in order to see the output files.

    I do try to include enough documentation/instructions so that my results can be duplicated.

    Ahh, the sweet taste of success! :D

    I hope that other DSA524 owners find it useful as well.

    Some additional notes...
    Cell B1 contains:
    =IF(I1-G1>20,I1/7,1)
    What this formula does is, if the input data maxvalue (in cell I1) less the minvalue (in cell G1) is greater than 20, then scale the values in column C to maxvalue/7 (the "I1/7" part), otherwise don't scale them (the 1 just before the close paren).
    I decided arbitrarily that if there was less than 20 between the minimum and maximum values, scaling the data points would give odd-looking results.

    If you would like, you can change that "I1/7" to "I1/peakvoltage", where "peakvoltage" is the maximum voltage that you observed on the scope. For example, you said:
    If you changed it to "I1/28", then the plot data would be re-scaled to show 28 as the peak value.

    The ScaleX: value really isn't terribly useful besides being a way to easily check if your spreadsheet contains all of the values that you were expecting; which was why I included it.
    It would probably be a lot more useful if it were next to column C so that you might more easily use it for the X-axis labels.

    By the way, I just stumbled across a site where a fellow in Scotland is starting to write some Python code specifically for the DSA524 here:
    https://github.com/gordonjcp/dsa524
    He may come up with some very interesting stuff.

    Python is a powerful open-source programming language. The website for Python development is here:
    http://www.python.org/
     
    Last edited: Oct 31, 2011
  14. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    In regards to column A not being very useful....

    I just did a re-write of the program to make it more useful. :)

    Column A will now contain the sequence number of the data items.
    Column B is still the raw data.
    Column C is now the scaled sequence number to represent time; scale factor is in F1.
    Column D is now the scaled data; entering the peak voltage in cell B1 will cause the peak voltage in the chart to agree with the Y-axis numbers. The default is still 7 so that you get 8 vertical divisions with the peak touching the 7th bar.

    On the first row, B1 is now 7; everything else is shifted right.
    The formula in C1 uses the value in B1 for scaling the raw data; it makes it easier for you to simply enter a voltage in B1 than to have to edit the formula.

    You will now have the number of data items appearing in L1; this serves as a quick check to verify the count.

    To produce a chart with this new format:
    1) Highlight columns [ C ] and [ D ] by left-clicking on one of them and dragging to the other so they are both highlighted, then release the button.
    2) Click on Chart Wizard
    3) Select standard type "XY (Scatter)" from the scroll list.
    4) Choose one of the "connected by lines without markers" options, either smoothed or plain.

    Continue to select additional options as desired, then finish.

    This adds an interesting capability:
    Load 009-DSC.XLS
    Produce a chart as in steps 1) through 4), above.
    Right-click on the X-axis numbers, and select "Format axis"
    For "Maximum", enter 10; for "Major unit", enter 1; then click OK
    Then go to cell F1. That cell contains "=10/4096"
    Change it to "=10/1024"
    Notice that the waveform, which had seemed to be crammed way over on the left, is now pretty much centered.
    Then go to cell B1, and change the value to 22. Notice that the Y-axis values adjust, so that your peak is now at 22v.

    Right-click on the plot area, not on a grid nor on the plot line. Select "Format plot area". The third row, 4th column green is the most pleasing to me. Click that, and then the OK button.

    Now right-click on the plot line, and select "Format data series". On the Patterns tab, there should be a "Color" option, with a down-arrow selection box on the right; click that. I used the 4th column, 5th row for the trace color (light green). Then click OK.

    [eta]
    Attachment is superceded; see below
     
    Last edited: Oct 31, 2011
  15. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Found a couple of minor bugs; fixed them (1st line of data was being appended to the right of the 1st row; incorrect handling of sequence numbers when x'1A' was read)

    Attached example plot
     
  16. 2N3055

    Thread Starter New Member

    Oct 18, 2011
    7
    0
    I'm having lots of fun making lovely green pictures now.
    - Very professional looking!
     
  17. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I hope you like the latest revision better than the prior, as I deleted all previous revisions of the program. The output files are about 25% larger than the previous versions, but I think that it provides a significant advantage in the utility of the output data.
     
  18. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, one last update; I think this will do it for the foreseeable future.

    I didn't like the fact that the program would blow up if the file was truncated, and the error reporting was not quite being handled correctly. Turned out to be a few minor details that needed cleaning up.

    Now you will at least get messages if there is something really wrong with the input file instead of the program just spouting garbage into the output file. Of course, there's only a limited amount of checking that it can do, due to the nature of the data in the file. You may never even notice the difference if all of your data files are OK.

    I added your original two test files, plus another one that I introduced a deliberate error into; an EOF character in the header.
     
Loading...