i m reading 2 measurements from oscilloscope for eash diver setting( 15) i am geeting the desired out put 2 measurements for each setting, now i want to add these vector element. i want the sum value for each setting, but my vector size is one and i cannot get the sum values, can anyone have a look
// Note to self: if you want to shorten the following lines,
// remember that HighVal is 16 bit and (HighVal << 16) will yield 0
// :-)
AValue = (HighVal & 0xff);
AValue <<= 16;
AValue |= LowVal;
}
/// Old test measurement from FIFO scan, adapt if necessary
bool TDctrlMeasurement::TestPattern(int pattern, bool &exception)
{
int readBack;
WriteMem(m_testChip, m_region, m_offset, pattern);
ReadMem(m_testChip, m_region, m_offset, readBack, exception);
if (exception) return false;
if (readBack != pattern) return false;
return true;
}
void TDctrlMeasurement::LoopEnd(int loopIndex)
{
if (loopIndex == 2) {
while (!(m_mutex->try_lock()))
;
m_histoQue->push_back(*m_histo);
m_mutex->unlock();
m_histo->Clear();
}
}
// Execute does the actual measurement
// this method has to implement the amplitude measurement for one single chip,
// for one driver setting
// results are saved into m_histo as described below
void TDctrlMeasurement::Execute()
{
bool exception;
common::TChipIndex idx;
idx.boardIndex = m_boardIndex;
idx.chipId = m_testChip->GetConfig()->GetChipId();
idx.dataReceiver = m_testChip->GetConfig()->GetParamValue("RECEIVER");
// skip disabled chips and OB slaves
for (int i=0; i<2; i++){
float peak_p;
if ((m_testChip->GetConfig()->IsEnabled()) &&
(m_testChip->GetConfig()->GetParamValue("LINKSPEED") != -1)) {
scope.single_capture(); // Stop on first trigger
TestPattern(0xFFFFFF, exception); // Generate data on bus
/*if (exception) { // Should these be ignored?
std::cout << "Fifo scan failed" << std::endl;
throw runtime_erro("Fifo scan failed");
}*/
scope.wait_for_trigger(10); // Check and wait until triggered
// Do the measurement here, value has to be saved in the histogram
// with THisto::Set, idx indicates the chip, e.g.
// m_histo->Set(idx, m_value[1], measured amplitude)
// to enter the measured amplitude for the current chip and the current
// driver setting
if ((m_testChip->GetConfig()->GetCtrInt() == 0) && (FindBoardIndex(m_testChip) == 0)) {
// Retrieve measuremts
scope.en_measure_ch(3); // Set measurement to read from scope channel 3
scope.get_meas();
peak_p=scope.ch3.peak;
//std::cout<<"peak_p"<<peak_p<<"the single measurement "<<scope.ch3.peak<<std::endl;
// here only to avoid error "idx set but not used"
// remove in implementation
} // m_histo->Set(idx, m_value[1], 0);
void TDctrlMeasurement::Terminate()
{
if (m_disableManchesterEncoding == 1) {
for (unsigned int i = 0; i < m_chips.size(); i++) {
if (!m_chips.at(i)->GetConfig()->IsEnabled()) continue;
m_chips.at(i)->GetConfig()->SetDisableManchester(true);
AlpideConfig::ConfigureCMU(m_chips.at(i));
}
}