Konica Minolta PCI-1712L user manual Chapter, Show the duty ratio of positive

Models: PCI-1712L PCI-1712

1 114
Download 114 pages 26.45 Kb
Page 66
Image 66

Chapter 5

//CNT1’s gate input received the measured signal, check if finished? while(1)

{

i = inport(addr2_1712+0x22) & 0x0800;

if(i == 0x0000) break;//CNT1’s gate input is low

}

/*The CNT1 & 2 has finished the job, and then show the measured period on display*/

dl= inport(addr2_1712+0x1a);

//Read low byte

dh= inport(addr2_1712+0x1a)<<8;

//Read high byte

dh= dh + (dl & 0x00ff);

 

neg_count = 0xffff - dh ;

 

dl= inport(addr2_1712+0x1c);

 

dh= inport(addr2_1712+0x1c)<<8;

 

dh= dh + (dl & 0x00ff);

 

pos_count = 0xffff - dh ;

 

duty = pos_count;

 

duty = duty + neg_count;

 

duty = (pos_count/duty)*100;

//Show the duty ratio of positive

cycle

 

printf(“P+ = %u P- = %u Duty %5.3f \n”,pos_count,neg_count, duty);

neg_count = 0; pos_count = 0;

}

PCI-1712/1712L User’s Manual

– 54 –

Advantech Co., Ltd.

 

 

www.advantech.com

Page 66
Image 66
Konica Minolta PCI-1712L user manual Chapter, Show the duty ratio of positive