![Melec C-875 Скачать руководство пользователя страница 93](http://html1.mh-extra.com/html/melec/c-875/c-875_instruction-manual_1767048093.webp)
- 93 -
16-6ORIGIN DRIVE Program Example
The ORIGIN DRIVE requires data on URATE, DRATE, LSPD, HSPD, CSPD, OFFSET PULSE, LDELAY, SDELAY and JDELAY.
You must set these data prior to the drive.
Once set, these data remain valid until a change is needed of
them.
Also, you must specify the machine origin detect type before turning on the ORIGIN DRIVE.
This data is needed whenever starting the drive.
/*-----------------------------------*/
/*
X-AXIS ORIGIN DRIVE
*/
/*-----------------------------------*/
void
xorg( void )
{
/** RATE SET COMMAND **/
xmccrdy();
/* X-AXIS MCC05 RDY WAIT */
outp(XMCCDT2 ,urate);
/* UP RATE No. OUT */
outp(XMCCDT3 ,drate);
/* DOWN RATE No. OUT */
outp(XMCCCOM ,0x06);
/* RATE SET COMMAND OUT */
/** LSPD SET COMMAND **/
xmccrdy();
/* X-AXIS MCC05 RDY WAIT */
outp(XMCCDT1 ,*((UC *)&lspd + 2));
/* LOW SPEED DATA MSB SET */
outp(XMCCDT2 ,*((UC *)&lspd + 1));
outp(XMCCDT3 ,*((UC *)&lspd ));
/* LOW SPEED DATA LSB SET */
outp(XMCCCOM ,0x07);
/* LSPD SET COMMAND OUT */
/** HSPD SET COMMAND **/
xmccrdy();
/* X-AXIS MCC05 RDY WAIT */
outp(XMCCDT1 ,*((UC *)&hspd + 2));
/* HIGH SPEED DATA MSB SET */
outp(XMCCDT2 ,*((UC *)&hspd + 1));
outp(XMCCDT3 ,*((UC *)&hspd ));
/* HIGH SPEED DATA LSB SET */
outp(XMCCCOM ,0x08);
/* HSPD SET COMMAND OUT */
/** CSPD SET COMMAND **/
xmccrdy();
/* X-AXIS MCC05 RDY WAIT */
outp(XMCCDT1 ,*((UC *)&cspd + 2));
/* CONSTANT SPEED DATA MSB SET */
outp(XMCCDT2 ,*((UC *)&cspd + 1));
outp(XMCCDT3 ,*((UC *)&cspd ));
/* CONSTANT SPEED DATA LSB SET */
outp(XMCCCOM ,0x1a);
/* CSPD SET COMMAND OUT */
/** OFFSET PULSE SET COMMAND **/
xmccrdy();
/* X-AXIS MCC05 RDY WAIT */
outp(XMCCDT3 ,offset);
/* OFFSET PULSE DATA OUT */
outp(XMCCCOM ,0x1b);
/* OFFSET PULSE SET COMMAND OUT */
/** ORG DELAY SET COMMAND **/
xmccrdy();
/* X-AXIS MCC05 RDY WAIT */
outp(XMCCDT1 ,ldelay);
/* LIMIT DELAY TIME OUT */
outp(XMCCDT2 ,sdelay);
/* SCAN DELAY TIME OUT */
outp(XMCCDT3 ,jdelay);
/* JOG DELAY TIME OUT */
outp(XMCCCOM ,0x1c);
/* ORG DELAY SET COMMAND OUT */
/** ORIGIN DRIVE COMMAND **/
xmccrdy();
/* X-AXIS MCC05 RDY WAIT */
outp(XMCCDT1 ,orgno);
/* ORIGIN TYPE No. OUT */
outp(XMCCCOM ,0x1e);
/* ORIGIN DRIVE COMMAND OUT */
}
Note: The above program is developed on the assumption that the RAM AREA URATE and DRATE contain the
RATE DATA TABLE No., the LSPD and HSPD contain the speed data set in Hz and the OFFSET contains
the offset pulse number.
Likewise, the LDELAY, SDELAY and JDELAY are supposed to contain respective delay time, and the
ORGNO is supposed to contain the machine origin detection type.
Содержание C-875
Страница 98: ... 98 2 M TYPE 3 H TYPE ...