![VC VC40 series Скачать руководство пользователя страница 44](http://html.mh-extra.com/html/vc/vc40-series/vc40-series_operaing-instructions_857555044.webp)
VC4XXX_HW.pdf – Hardware Documentation VC4XXX Smart Cameras
1996-2014 Vision Components GmbH Ettlingen, Germany
44
if(c!=0x1b)
{
{
io_fputc(c, tty);
}
}
}
}
fclose(tty);
/* close serial device */
fclose(tty);
/* close RS485
*/
}
8.2 Programming the Encoder Interface
Refer to section 6.2 for details on this interface and also the separate “Encoder Application Notes” under
“References” on page 2 of this document!
The encoder interface needs to be enabled prior to its use:
INTERFACE_MODE(ENCODER); // Encoder mode (RS232 disabled)
void enctest(void)
{
int Run=1,i=0;
char c;
print("\nEncoder Interface Test, press <ESC> to abort\n\n");
TRIGINP_NEG() ;
// turning direction anti clockwise
tpict();
// take image to end live mode
INTERFACE_MODE(ENCODER);
// Encoder mode (RS232 disabled)
ENC_DISABLE_CNT();
// disable counter
//ENC_WAIT_N();
// wait one time for next 0+ pulse
ENC_WAIT_N_TRIG();
// wait every time for next 0+ pulse
ENC_ENABLE_CNT();
// enable inputs
ENC_WRITE_CNT(506);
// set Counter value
ENC_WRITE_RELOAD(256);
// set Reload value
while(Run)
{
tenable();
// wait for external trigger and take picture
while(!trdy())
// wait for image completion
{
if(kbhit())
// check for keyboard input
{
c=rs232rcv();
if(c==0x1B) // check for "ESC"
{
while(cancel_capture_rq());
Run = 0; // deleting last capture request
}
}
printf("encodervalue is: %08d \r",ENC_READ_CNT());
wait(0,50);
//
waiting time to slow printing
}
print("************* exposure ************** (%u)\n",i++);
}
INTERFACE_MODE(SERIAL);
// Serial mode (RS232 enabled)
vmode(0);
// swtiching camera back to live mode
}