EasyManua.ls Logo

Vishay 7000 - Page 46

Vishay 7000
142 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Vishay Micro-Measurements System 7000 Programmer’s Reference Manual
Page 46 of 142
if (inFile.Read(inByte, 0, 2) == 0) throw new System.ApplicationException();
scanID = (ulong)((ulong)inByte[0] | ((ulong)inByte[1] << 8));
}
else if (scanIDSize == 02)
{
// read in a 32-bit (4 byte) scan id
if (inFile.Read(inByte, 0, 4) == 0) throw new System.ApplicationException();
scanID = (ulong)((ulong)(inByte[0] | ((ulong)inByte[1]) << 8) |
((ulong)inByte[2] << 16) | ((ulong)inByte[3] << 24));
}
else if (scanIDSize == 03)
{
// read in a 48-bit (6 byte) scan id
if (inFile.Read(inByte, 0, 6) == 0) throw new System.ApplicationException();
scanID = (ulong)((ulong)(inByte[0] |((ulong)inByte[1]) << 8) |
((ulong)inByte[2] << 16) | ((ulong)inByte[3] << 24) |
((ulong)inByte[4] << 32) | ((ulong)inByte[5] << 40));
}
else
{
// Invalid scan ID size
throw new System.ApplicationException();
}
// If group A data is recorded
// Write the scan ID to the console
// Note: This example is only supporting group A, expand
// this statement to reflect the number of groups you're supporting.
if (groupARecorded == 01)
{
// write the 64-bit scan id to the console window
Console.WriteLine(scanID);
}
// If groupA is recorded, read a value for each channel in the group
if (groupARecorded == 01)
{
for (int i = 0; i < numChannelsinGroupA; i++)
{
// if a relative (8-bit) data type
if (dataType == 0)
{
// we are reading in a 1-byte relative value, add it to the current value
groupAValue[i] = groupAValue[i] + (sbyte)inFile.ReadByte();
}
else
{
if (absDataSize == 0)
{
// absolute data size is 16 bits so read 2 bytes from file
if (inFile.Read(inByte, 0, 2) == 0) throw new System.ApplicationException();
groupAValue[i] = (int)((int)inByte[0] | ((int)inByte[1] << 8));
}
else
{
// absolute data size is 32 bits so read 4 bytes from file
if (inFile.Read(inByte, 0, 4) == 0) throw new System.ApplicationException();
groupAValue[i] = (int)((int)inByte[0] | ((int)inByte[1] << 8) |
((int)inByte[2] << 16) | ((int)inByte[3] << 24));
}
}
// Write the 32-bit data value to the console window
Console.WriteLine(groupAValue[i]);
} // end for
}// end if group A recorded
if (groupBRecorded == 01)
// not shown in this sample
if (groupCRecorded == 01)
// not shown in this sample
if (groupDRecorded == 01)
// not shown in this sample
} // end while

Table of Contents