envea CAIRSENS PM Série Notice Technique page 58

Table des Matières

Publicité

Les langues disponibles

Les langues disponibles

}
return
}
int
readFrame(
{
int
nb;
int
i;
int
timeout;
int
iLen;
int
maxtimeout = 20;
int
waittempo = 100;
int
indexFrame;
do
{
© 2016 Cairpol
GetDownload structure for cairsens (Stored data download)
return
0;
stat.cbInQue;
void
* port ,
unsigned char
i = 0;
indexFrame = 0;
data[0] = 0;
i = 1;
timeout = 0;
// Detect 0xFF
do
{
if( rs_bytesWaiting( port) > 0)
{
rs_read(port , &data[0] , 1);
}
Sleep(waittempo);
if( timeout > maxtimeout )
{
return
}
timeout += 1;
// break loop if data(0) is 0xFF
if( 0xFF == data[0] ) i = 0;
}while
( i > 0 );
// detect 0x02
timeout = 0;
i = 1;
do
{
if( rs_bytesWaiting( port) > 0)
{
rs_read(port , &data[1], 1);
}
Sleep(waittempo);
if( timeout > maxtimeout )
{
return
}
timeout += 1;
if( 0x02 == data[1])
{
// 0x02 detected
i = 0;
}
indexFrame += 1;
if( indexFrame > (256 - 1) )
{
//0x02 not detected
i = 0;
data[1] = 0;
}
}
while
(i > 0);
// 0x02 detected
if( 0x02 == data[1] )
{
timeout = 0;
do
{
i = rs_bytesWaiting( port);
Sleep(waittempo);
* data)
0;
0;
21

Publicité

Chapitres

Table des Matières
loading

Ce manuel est également adapté pour:

Cairsens pm1Cairsens pm2.5Cairsens pm10

Table des Matières