Commit 6c8c0459 authored by reza's avatar reza

dll with huge

parent 056d8e73
......@@ -127,6 +127,9 @@ namespace I8Devices
private const int _exchanels_count = 3;
public bool[] exchannels_on = new bool[_exchanels_count];
private const int _interaction_count = 4;
public char[] interaction = new char[_interaction_count];
public Settings()
{
test_signal = false;
......@@ -135,6 +138,7 @@ namespace I8Devices
gain = 24;
for (int J = 0; J < _chanels_count; J++) channels_on[J] = true;
for (int J = 0; J < _exchanels_count; J++) exchannels_on[J] = false;
for (int J = 0; J < _interaction_count; J++) interaction[J] = '0';
}
}
......@@ -283,7 +287,13 @@ namespace I8Devices
Exch_arr.CopyTo(Exch_data, 0);
sendBuffer[18] = Exch_data[0]; // channels 1 to 8 on/off status
sendBuffer[19] = 0x00; //reserved
sendBuffer[20] = Convert.ToByte(mysetting.interaction[0]); // user interaction module settings
sendBuffer[21] = Convert.ToByte(mysetting.interaction[1]); // user interaction module settings
sendBuffer[22] = Convert.ToByte(mysetting.interaction[2]); // user interaction module settings
sendBuffer[23] = Convert.ToByte(mysetting.interaction[3]); // user interaction module settings
_serialPort.Open();
_serialPort.Write(sendBuffer, 0, sendBuffer.Length);
......@@ -525,6 +535,8 @@ namespace I8Devices
if (Convert.ToByte(rec_data[31]) == 144) // Indicate I8Device ID
{
Thread.Sleep(500);
Console.WriteLine("num_of_huges: ");
Console.WriteLine(rec_data[23].ToString());
if (Convert.ToByte(rec_data[27]) == 48) // Indicate Fascin8 device
{
if (debug_mode) Console.WriteLine("DLL: Fascin8 writing setiing done succesfully.");
......@@ -604,16 +616,16 @@ namespace I8Devices
data_converted[3] = last_data_recieve[3]; // Device ID
data_converted[4] = last_data_recieve[4]; // user input keys
data_converted[5] = 0; //reserverd
int i = 6, p = 8;
int i = 6, p = 8; // i = data_convewrted position, p = input data position
for (int k = i; k < 24 + i; k++)
{
data_converted[k] = (65536 * last_data_recieve[3 * (k - i) + p + 0]) + (256 * last_data_recieve[3 * (k - i) + p + 1]) +
last_data_recieve[3 * (k - i) + p + 2];
if (data_converted[k] > 8388607) data_converted[k] = data_converted[k] - 16777216;
data_converted[k] = data_converted[k] * 0.536;
last_data_recieve[3 * (k - i) + p + 2]; // adding 3 byte as one data
if (data_converted[k] > 8388607) data_converted[k] = data_converted[k] - 16777216; //two's compliment
data_converted[k] = data_converted[k] * 0.536; //convert to uV
}
receiveBuffer.Add(data_converted);
sample_count++;
sample_count++;
newData_count++;
}
else if (device_name == "Ultim8" && _serialPort.IsOpen && _serialPort.BytesToRead > 25)
......@@ -713,44 +725,4 @@ namespace I8Devices
}
}
class FFTExample
{
static void Main(string[] args)
{
Console.WriteLine();
#region forward 1D real 1024 point FFT
//
// Simple example to compute a forward 1D real 1024 point FFT
//
// Create some random signal data.
RandomNumberGenerator rand = new RandGenMTwist(4230987);
var data = new DoubleVector(1024, rand);
// Compute the FFT
// This will create a complex conjugate symmetric packed result.
var fft1024 = new DoubleForward1DFFT(1024);
DoubleVector fftresult = fft1024.FFT(data);
// Ask the FFT instance for the correct reader, to unpacked the result.
DoubleSymmetricSignalReader reader = fft1024.GetSignalReader(data);
// The reader provides random access to any element in the pack fft result.
DoubleComplex thirdelement = reader[2];
Console.WriteLine();
Console.WriteLine("1D real forward 1024 point FFT computed.");
Console.WriteLine("-----------------------------------\n");
#endregion
Console.WriteLine();
Console.WriteLine("Finished. Press Enter Key.");
Console.Read();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment