make it volatile

This commit is contained in:
Tristan Krause 2019-04-03 08:40:14 +02:00
parent 4d2ea6013c
commit de7143887d
25 changed files with 368 additions and 377 deletions

View file

@ -136,13 +136,12 @@ std::vector<std::string> B15F::getBoardInfo(void)
while(n--)
{
uint8_t len = usart.readByte();
std::cout << (int) len << std::endl;
std::string str;
while(len--)
while(len--) {
str += static_cast<char>(usart.readByte());
std::cout << str << std::endl;
}
info.push_back(str);
}
@ -215,7 +214,7 @@ uint16_t B15F::analogRead(uint8_t channel)
return usart.readInt();
}
bool B15F::analogSequence(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t* buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count)
void B15F::analogSequence(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t* buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count)
{
buffer_a += offset_a;
buffer_b += offset_b;
@ -239,13 +238,15 @@ bool B15F::analogSequence(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset
{
buffer_a[i] = usart.readInt();
buffer_b[i] = usart.readInt();
if(buffer_a[i] > 1023 || buffer_b[i] > 1023)
std::cout << PRE << "bad data detected" << std::endl;
}
uint8_t aw = usart.readByte();
if(aw == MSG_OK)
return aw;
throw DriverException("Sequenz unterbrochen");
if(aw != MSG_OK)
throw DriverException("Sequenz unterbrochen");
delay_us(1);
}
void B15F::delay_ms(uint16_t ms)

View file

@ -162,7 +162,7 @@ public:
* \param count Anzahl an Inkrementierungen
* \throws DriverException
*/
bool analogSequence(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t* buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count);
void analogSequence(uint8_t channel_a, uint16_t* buffer_a, uint32_t offset_a, uint8_t channel_b, uint16_t* buffer_b, uint32_t offset_b, uint16_t start, int16_t delta, uint16_t count);
/*************************/

Binary file not shown.

View file

@ -132,7 +132,7 @@ private:
int file_desc = -1; // Linux Dateideskriptor
uint32_t baudrate = 9600;
int TEST = 0;
uint8_t timeout = 10; // in Dezisekunden
uint8_t timeout = 5; // in Dezisekunden
uint8_t block_buffer[MAX_BLOCK_SIZE + 3];
// debug statistics

View file

@ -2,35 +2,19 @@ set margin 10,10
unset key
set grid
set title ''
set xlabel 'U_{GS} [V]'
set xlabel 'U_{DS} [V]'
set ylabel 'I_D [mA]'
set xrange [5:0]
set x2range [5:0]
set y2range [0:50]
set xrange [0:5]
set yrange [0:50]
set label at 2,36 'U_{DS} [V] = 300' right
set label at 2,33 'U_{DS} [V] = 325' right
set label at 2,21 'U_{DS} [V] = 350' right
set label at 2,38 'U_{DS} [V] = 375' right
set label at 2,23 'U_{DS} [V] = 400' right
set label at 2,23 'U_{DS} [V] = 425' right
set label at 2,24 'U_{DS} [V] = 450' right
set label at 2,24 'U_{DS} [V] = 475' right
set label at 2,25 'U_{DS} [V] = 500' right
set label at 2,5 'U_{DS} [V] = 525' right
set label at 2,6 'U_{DS} [V] = 550' right
set label at 2,13 'U_{DS} [V] = 575' right
set label at 2,13 'U_{DS} [V] = 600' right
set label at 2,13 'U_{DS} [V] = 625' right
set label at 2,2 '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] = 725' right
set y2tics
unset ytics
set ytics format ''
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
unset output
set terminal qt
unset output
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
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

Binary file not shown.

View file

@ -13,8 +13,8 @@ void kennlinieErsterQuadrant()
uint16_t ba[1024];
uint16_t bb[1024];
const uint16_t sample_count = 100;
const uint16_t delta = 10;
const uint16_t sample_count = 1024;
const uint16_t delta = 1;
const uint16_t u_gs_start = 440;
const uint16_t u_gs_delta = 20;
@ -37,11 +37,11 @@ void kennlinieErsterQuadrant()
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);
//drv.delay_ms(10);
//drv.discard();
//drv.delay_ms(10);
for(uint16_t k = 0; k < sample_count+1; k++)
for(uint16_t k = 0; k < sample_count; k++)
{
uint16_t i_d = ba[k] - bb[k];
uint16_t u_ds = bb[k];
@ -64,7 +64,7 @@ void kennlinieZweiterQuadrant()
uint16_t ba[1024];
uint16_t bb[1024];
const uint16_t sample_count = 1000;
const uint16_t sample_count = 1024;
const uint16_t delta = 1;
const uint16_t u_gs_start = 300;
@ -91,9 +91,9 @@ void kennlinieZweiterQuadrant()
drv.analogSequence(0, &ba[0], 0, 1, &bb[0], 0, 0, delta, sample_count);
curve = 0;
for(uint16_t k = 0; k < sample_count + 1; k++)
for(uint16_t k = 0; k < sample_count; k++)
{
if(ba[k] > bb[k] && bb[k] % 50 == 0 && bb[k] > 0)
if(ba[k] > bb[k] && bb[k] % 50 == 0 && bb[k] != 0)
{
uint16_t i_d = ba[k] - bb[k];
pf.addDot(Dot(u_gs, i_d, bb[k] / 50));
@ -143,7 +143,8 @@ void testFunktionen()
int main()
{
testFunktionen();
kennlinieZweiterQuadrant();
kennlinieErsterQuadrant();
std::cout << "Schluss." << std::endl;
}

Binary file not shown.

Binary file not shown.