fancy tests
This commit is contained in:
parent
de7143887d
commit
266d90df56
17 changed files with 594 additions and 349 deletions
|
@ -186,6 +186,13 @@ uint8_t B15F::digitalRead1()
|
|||
return usart.readByte();
|
||||
}
|
||||
|
||||
uint8_t B15F::readDipSwitch()
|
||||
{
|
||||
usart.clearInputBuffer();
|
||||
usart.writeByte(RQ_DSW);
|
||||
return usart.readByte();
|
||||
}
|
||||
|
||||
bool B15F::analogWrite0(uint16_t value)
|
||||
{
|
||||
usart.clearInputBuffer();
|
||||
|
|
|
@ -125,6 +125,13 @@ public:
|
|||
*/
|
||||
uint8_t digitalRead1(void);
|
||||
|
||||
/**
|
||||
* Liest den Wert des digitalen Eingabeports, an dem der DIP-switch angeschlossen ist (S7)
|
||||
* \return Wert für gesamten Port
|
||||
* \throws DriverException
|
||||
*/
|
||||
uint8_t readDipSwitch(void);
|
||||
|
||||
/**
|
||||
* Setzt den Wert des Digital-Analog-Converters (DAC / DAU) 0
|
||||
* \param port 10-Bit Wert
|
||||
|
@ -190,10 +197,11 @@ private:
|
|||
constexpr static uint8_t RQ_BA1 = 6;
|
||||
constexpr static uint8_t RQ_BE0 = 7;
|
||||
constexpr static uint8_t RQ_BE1 = 8;
|
||||
constexpr static uint8_t RQ_AA0 = 9;
|
||||
constexpr static uint8_t RQ_AA1 = 10;
|
||||
constexpr static uint8_t RQ_ADC = 11;
|
||||
constexpr static uint8_t RQ_ADC_DAC_STROKE = 12;
|
||||
constexpr static uint8_t RQ_DSW = 9;
|
||||
constexpr static uint8_t RQ_AA0 = 10;
|
||||
constexpr static uint8_t RQ_AA1 = 11;
|
||||
constexpr static uint8_t RQ_ADC = 12;
|
||||
constexpr static uint8_t RQ_ADC_DAC_STROKE = 13;
|
||||
};
|
||||
|
||||
#endif // B15F_H
|
||||
|
|
Binary file not shown.
|
@ -2,19 +2,36 @@ set margin 10,10
|
|||
unset key
|
||||
set grid
|
||||
set title ''
|
||||
set xlabel 'U_{DS} [V]'
|
||||
set xlabel 'U_{GS} [V]'
|
||||
set ylabel 'I_D [mA]'
|
||||
set xrange [0:5]
|
||||
set xrange [5:0]
|
||||
set x2range [5:0]
|
||||
set y2range [0:50]
|
||||
set yrange [0:50]
|
||||
set label at 4,3 'U_{GS} [V] = 460' left
|
||||
set label at 4,7 'U_{GS} [V] = 480' left
|
||||
set label at 3,13 'U_{GS} [V] = 500' left
|
||||
set label at 2,22 'U_{GS} [V] = 520' left
|
||||
set label at 1,32 'U_{GS} [V] = 540' left
|
||||
set label at 0,38 'U_{GS} [V] = 560' left
|
||||
set label at 0,38 'U_{GS} [V] = 580' left
|
||||
set label at 0,38 'U_{GS} [V] = 600' left
|
||||
set label at 2,35 'U_{DS} [V] = 300' right
|
||||
set label at 2,31 'U_{DS} [V] = 325' right
|
||||
set label at 2,35 'U_{DS} [V] = 350' right
|
||||
set label at 2,21 'U_{DS} [V] = 375' right
|
||||
set label at 2,22 'U_{DS} [V] = 400' right
|
||||
set label at 2,22 'U_{DS} [V] = 425' right
|
||||
set label at 2,12 'U_{DS} [V] = 450' right
|
||||
set label at 2,23 'U_{DS} [V] = 475' right
|
||||
set label at 2,24 'U_{DS} [V] = 500' right
|
||||
set label at 2,24 'U_{DS} [V] = 525' right
|
||||
set label at 2,13 'U_{DS} [V] = 550' right
|
||||
set label at 2,13 'U_{DS} [V] = 550' right
|
||||
set label at 2,2 'U_{DS} [V] = 600' right
|
||||
set label at 2,13 'U_{DS} [V] = 625' right
|
||||
set label at 2,6 'U_{DS} [V] = 650' right
|
||||
set label at 2,2 'U_{DS} [V] = 675' right
|
||||
set label at 2,6 'U_{DS} [V] = 700' right
|
||||
set label at 2,2 'U_{DS} [V] = 725' right
|
||||
set label at 2,2 'U_{DS} [V] = 750' right
|
||||
set label at 2,2 'U_{DS} [V] = 750' right
|
||||
set y2tics
|
||||
unset ytics
|
||||
set ytics format ''
|
||||
unset output
|
||||
set terminal qt
|
||||
unset output
|
||||
plot "/tmp/tempfile0" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{GS} [V] = 440' w l,"/tmp/tempfile1" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{GS} [V] = 460' w l,"/tmp/tempfile2" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{GS} [V] = 480' w l,"/tmp/tempfile3" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{GS} [V] = 500' w l,"/tmp/tempfile4" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{GS} [V] = 520' w l,"/tmp/tempfile5" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{GS} [V] = 540' w l,"/tmp/tempfile6" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{GS} [V] = 560' w l,"/tmp/tempfile7" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{GS} [V] = 580' w l,"/tmp/tempfile8" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{GS} [V] = 600' w l
|
||||
plot "/tmp/tempfile1" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 300' w l,"/tmp/tempfile2" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 325' w l,"/tmp/tempfile3" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 350' w l,"/tmp/tempfile4" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 375' w l,"/tmp/tempfile5" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 400' w l,"/tmp/tempfile6" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 425' w l,"/tmp/tempfile7" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 450' w l,"/tmp/tempfile8" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 475' w l,"/tmp/tempfile9" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 500' w l,"/tmp/tempfile10" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 525' w l,"/tmp/tempfile11" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 550' w l,"/tmp/tempfile12" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 575' w l,"/tmp/tempfile13" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 600' w l,"/tmp/tempfile14" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 625' w l,"/tmp/tempfile15" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 650' w l,"/tmp/tempfile16" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 675' w l,"/tmp/tempfile17" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 700' w l,"/tmp/tempfile18" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 725' w l,"/tmp/tempfile19" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 750' w l,"/tmp/tempfile20" using ($1*0.004888):($2*0.048876) binary format="%int16%int16" endian=big title 'U_{DS} [V] = 775' w l
|
||||
|
|
BIN
driver/main
BIN
driver/main
Binary file not shown.
|
@ -7,6 +7,7 @@
|
|||
|
||||
void kennlinieErsterQuadrant()
|
||||
{
|
||||
|
||||
B15F& drv = B15F::getInstance();
|
||||
PlottyFile pf;
|
||||
|
||||
|
@ -32,14 +33,14 @@ void kennlinieErsterQuadrant()
|
|||
pf.setParaStepWidth(u_gs_delta);
|
||||
|
||||
uint8_t curve = 0;
|
||||
|
||||
std::cout << "Erfasse Kennlinie erster Quadrant..." << std::endl << std::flush;
|
||||
|
||||
for(uint16_t u_gs = u_gs_start; u_gs <= u_gs_end; u_gs += u_gs_delta)
|
||||
{
|
||||
drv.analogWrite1(u_gs);
|
||||
|
||||
drv.analogSequence(0, &ba[0], 0, 1, &bb[0], 0, 0, delta, sample_count);
|
||||
//drv.delay_ms(10);
|
||||
//drv.discard();
|
||||
//drv.delay_ms(10);
|
||||
|
||||
for(uint16_t k = 0; k < sample_count; k++)
|
||||
{
|
||||
|
@ -48,9 +49,13 @@ void kennlinieErsterQuadrant()
|
|||
pf.addDot(Dot(u_ds, i_d, curve));
|
||||
}
|
||||
|
||||
std::cout << "\033[1K\r" << 1e2 * (u_gs - u_gs_start) / (u_gs_end - u_gs_start) << "%" << std::flush;
|
||||
|
||||
curve++;
|
||||
}
|
||||
|
||||
std::cout << "\033[1K\r" << std::flush;
|
||||
|
||||
// speichern und plotty starten
|
||||
pf.writeToFile("test_plot");
|
||||
pf.startPlotty("test_plot");
|
||||
|
@ -84,6 +89,9 @@ void kennlinieZweiterQuadrant()
|
|||
pf.setParaStepWidth(u_gs_delta);
|
||||
|
||||
uint8_t curve = 0;
|
||||
|
||||
std::cout << "Erfasse Kennlinie zweiter Quadrant..." << std::endl << std::flush;
|
||||
|
||||
for(uint16_t u_gs = u_gs_start; u_gs <= u_gs_end; u_gs += u_gs_delta)
|
||||
{
|
||||
drv.analogWrite1(u_gs);
|
||||
|
@ -100,9 +108,12 @@ void kennlinieZweiterQuadrant()
|
|||
}
|
||||
curve++;
|
||||
}
|
||||
std::cout << "u_gs: " << u_gs << std::endl;
|
||||
|
||||
std::cout << "\033[1K\r" << 1e2 * (u_gs - u_gs_start) / (u_gs_end - u_gs_start) << "%" << std::flush;
|
||||
}
|
||||
|
||||
std::cout << "\033[1K\r" << std::flush;
|
||||
|
||||
// speichern und plotty starten
|
||||
pf.writeToFile("test_plot");
|
||||
pf.startPlotty("test_plot");
|
||||
|
@ -112,6 +123,8 @@ void testFunktionen()
|
|||
{
|
||||
B15F& drv = B15F::getInstance();
|
||||
|
||||
std::cout << "DIP-Switch: " << (int) drv.readDipSwitch() << std::endl;
|
||||
|
||||
|
||||
drv.digitalWrite0(0xFF);
|
||||
drv.analogWrite0(128);
|
||||
|
@ -131,18 +144,19 @@ void testFunktionen()
|
|||
|
||||
std::cout << "Kennlinie..." << std::endl;
|
||||
uint16_t a[1024];
|
||||
uint16_t b[1024];
|
||||
uint16_t b[1024];
|
||||
drv.analogSequence(0, &a[0], 0, 1, &b[0], 0, 0, 1, 1024);
|
||||
for(uint16_t i= 0; i < sizeof(a) / sizeof(uint16_t); i++)
|
||||
|
||||
/*for(uint16_t i= 0; i < sizeof(a) / sizeof(uint16_t); i++)
|
||||
{
|
||||
std::cout << (int) i << " : " << a[i] << " " << b[i] << std::endl;
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
testFunktionen();
|
||||
kennlinieZweiterQuadrant();
|
||||
kennlinieErsterQuadrant();
|
||||
|
||||
|
|
BIN
driver/main.o
BIN
driver/main.o
Binary file not shown.
BIN
driver/test_plot
BIN
driver/test_plot
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue