Download IK 121 - CTI Software

Transcript
The IK 121 in DOS-Applications
(*Display measured values*)
gotoxy(1,10);
write(c_value_0*0.02/1024:16:4,
c_value_1*0.02/1024:16:4);
UNTIL KEYPRESSED;
END.
Examples in BORLAND C:
Measured value latch via software
The following examples SAMPLE32.C and SAMPLE48.C
illustrate the use of the previously described functions. These
are declared and defined in the files IK121_0.H and IK121_0.C
(all files are on the supplied floppy disk 1). For compiling, a
project must be created with IK121_0.C and SAMPLE32.C or
SAMPLE48.C. Since this example does not read the address of
the IK 121 from IK121.INI, the address is defined as the
constant "base_address".
/*----------------------SAMPLE32.C---------------------DR. JOHANNES HEIDENHAIN GmbH, Traunreut, Germany
A simple program for the IK 121 to display
two axes. Measured value with 32 bits.
V 1.01
April 1995
Project files:
IK121_0.C, SAMPLE32.C
Include file:
IK121_0.H
------------------------------------------------------*/
#include <stdio.h>
#include <conio.h>
#include "ik121_0.h"
#define base_address 0x0330
int main()
{
double c_value_0, c_value_1;
cls;
/*Initialise the board in interpolation mode, axis 1*/
write_g26 (base_address, 1, 0x0c, 0x0001);
/*Initialise the board in interpolation mode, axis 2*/
write_g26 (base_address, 2, 0x0c, 0x0001);
/*Reset error bit, start counter, axis 1*/
write_g26 (base_address, 1, 0x0e, 0x0048);
/*Reset error bit, start counter, axis 2*/
write_g26 (base_address, 2, 0x0e, 0x0048);
/*Write to control register 2, axis 1*/
write_g26 (base_address, 1, 0x1c, 0x0008);
/*Write to control register 2, axis 2*/
write_g26 (base_address, 2, 0x1c, 0x0008);
/*Cursor off*/
_setcursortype (_NOCURSOR);
while(!kbhit())
{
69
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com