Products > Test Equipment
Some old school instruments showing how it's done (HP 3325A and Fluke 8506a)
<< < (53/91) > >>
garrettm:
I reworked the 3-byte, 22bit fixed point to 64bit floating point conversion since I neglected to perform the two's complement for negative values. :palm:

Unions and structs make this look slick and allow for easy code modification. Do note that there are byte boundary limititations with structs that can cause errors in what would otherwise look like valid code.

Two's complement conversion must be done using the entire 22bit word which was thankfully pretty simple to do using another member inside the union. Note that the error bit is used as a sign bit since they are identical when the ADC has no errors. (Checking for overflow first guarantees this.)

If anyone wants to test it, throw the following code into https://www.jdoodle.com/online-compiler-c++/ and edit the b_data binary values as indicated in the code comments.


--- Code: ---#include <iostream>
#include <inttypes.h>

typedef union {
  struct {
    uint32_t f :20; // fraction bits
    bool     i :1;  // integer bit
    bool     e :1;  // error bit
    bool     s :1;  // sign bit
  };
  uint32_t   w :22; // 22bit word for two's comp. conversion
  uint8_t    b[3];
} adc_t;

typedef union {
  struct {
    uint64_t m :32; // mantissa (32bit offset)
    uint32_t f :31; // mantissa + exponent
    bool     s :1;  // sign bit
  };
  double     r = 1; // set mantissa bits to 0
} b3fp64_t; // 3-byte binary to FP data structure

//dummy data for testing
uint8_t b_data[3] = {0b11110111,  // 1st byte
                     0b10111111,  // 2nd byte
                     0b11111111}; // 3rd byte

int main() {

adc_t raw; // data stucture for working with raw ADC output

//acquire 3-byte binary data
for (int32_t i=sizeof b_data-1; i>=0; i--) {
  // code for data acqusition...
  raw.b[i] = b_data[sizeof b_data-1-i];
}

// ADC overflow check
if (!raw.s == raw.e) {
  //return 0; // same error value as 5 and 6-byte binary data
  std::cout << "ADC OVERFLOW" << std::endl;
}

// perform two's complement if sign bit == 1
if (raw.s) {
  raw.w = ~raw.w + 1;
}

b3fp64_t val; // unscaled floating point value

val.f |=  raw.f; // fraction bits,        b0-b19
val.r -= !raw.i; // int portion / FP exp, b20
val.s  =  raw.s; // sign,                 b21

std::cout << "FP value = " << val.r << std::endl;
}
--- End code ---


*Made some minor improvements to the code: Merged all fraction bits into a single operation and removed a struct for code simplicity.
SilverSolder:

I got the EPROMS working by programming them multiple times with the same data...   They are probably just getting old and cranky.  The Intel EPROMs from the same era seem to not have this issue, they worked reliably first time on the cheapo programmer.

Bottom line - all units are now on the latest firmware, even if something that should have been a simple job ended up taking half the night!  :D




garrettm:

--- Quote from: dietert1 on February 11, 2021, 04:55:55 pm ---...
While waiting for the AB-25 to arrive, i am using our two Flukes with "S2", at about 10 readouts per second and calculating averages every 320 samples.
...
Regards, Dieter
--- End quote ---

Dieter try using S5 sampling, it acquires samples and outputs them with the least amount of processing delay (reaching 97% sample/average to reading throughput efficiency). See "AVG Processing Delay" in the table below and the updated Excel spreadsheet. Your 8502A might have a different optimal sampling setting than my 8506A, but the concept still holds.

This way, you should have effectively "more" samples per individual reading from the DMM for the same effective number of samples when averaging at the PC.


--- Quote from: garrettm on February 08, 2021, 07:19:19 am ---
--- Code: ---Sampling Reading AVG Digitizing AVG Processing Digitizing
Exponent Period Time / Sample Delay         Period
0         52.2         52.20         48.03         4.17
1         55.2         27.60         46.87         8.33
2         60.3         15.08         43.63         16.67
3         68.8         8.60                 35.47         33.33
4         89.4         5.59                 22.73         66.67
5         137.5 4.30                 4.17         133.3
6         270.9 4.23                 4.23         266.7
7         537.7 4.20                 4.37         533.3
8         1071 4.18                 4.33         1067
9         2140 4.18                 6.67         2133
10         4273 4.17                 6.33         4267
11         8540 4.17                 6.67         8533
--- End code ---

--- End quote ---
SilverSolder:

@Dietert,  do you know what firmware revision is in your 8502A units?

I have an 8502A here that says 2.0.8 on startup.

dietert1:
One of our Fluke 8502A runs firmware 2.0.3, the other one 3.0.0.
Today i learned how to exercise both input relays K1 and K2 on startup, cycling through "VA,R1," then "V,R2," then "V,R3,".

Regards, Dieter
Navigation
Message Index
Next page
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod