Contec F&eIT Series User Manual page 46

Isolated counter module
Hide thumbs Also See for F&eIT Series:
Table of Contents

Advertisement

Sample Program
/*======================================================
Sample program 1
DEVICE ID:
Mode:
Initial Data:
Compare Data:
Channel:
Programmable Timer: N/A
Digital Filter
Interrupt:
======================================================*/
#include <stdio.h>
#include <conio.h>
/* ----- Constant --------------------------------------
*/
#define
#define
/* ----- Declarations ----------------------------------
*/
struct
unsigned char lower;
unsigned char middle;
unsigned char upper;
unsigned char reserved;
};
struct
unsigned long count;
};
union ACCESS {
struct
struct
};
struct
struct
union ACCESS
union ACCESS
/* ----- Prototype -------------------------------------
*/
void
void
void
* );
/* ----- Initialize ------------------------------------
*/
void
{
outp( ADR+0x10, ch*5+1 );
outp( ADR+0x11, 0x8c );
outp( ADR+0x10, ch*5+2 );
outp( ADR+0x11, 0x4 );
outp( ADR+0x10, ch*5+4 );
outp( ADR+0x11, 0x1 );
outp( ADR+0x10, 0x16 );
outp( ADR+0x11, 0xff );
outp( ADR+0x10, ch*5 );
outp( ADR+0x11, CountData.Byte[ch].lower ); /* lower */
outp( ADR+0x11, CountData.Byte[ch].middle );
*/
outp( ADR+0x11, CountData.Byte[ch].upper ); /* upper */
outp( ADR+0x10, ch*5+3 );
outp( ADR+0x11, CompData.Byte[ch].lower );
outp( ADR+0x11, CompData.Byte[ch].middle ); /* middle */
outp( ADR+0x11, CompData.Byte[ch].upper );
outp( ADR+0x10, 0x19 );
outp( ADR+0x11, 0xff );
}
CNT24-2(FIT)GY
ADR
CH
REGS08 {
REGS24 {
REGS08
REGS24
REGS08
/*
8-bit */
REGS24
CountData;
CompData;
main( void );
Initialize( unsigned char );
ReadData( unsigned char, unsigned long *, unsigned char
Initialize( unsigned char ch )
0
2-Phase, Asynchronous Clear, Normal Count
000000H
000064H
0ch
6.5 used
N/A
0x0800
2
Byte[CH];
Whole[CH];
Byte[CH];
Whole[CH];
/* digital filter set */
/* initial data set */
/* compare data set */
/* one-shot pulse set */
Using the I/O Address Map
/* I/O address */
/* channel */
/* 8-bit */
/* lower */
/* middle */
/* upper */
/* reserved */
/* 24-bit */
/*
8-bit */
/* 24-bit */
/* 24-bit */
/* initialize */
/* read data */
/* mode set */
/* z-pulse set */
/* sense reset */
/* middle
/* lower */
/* upper */
41

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cnt24-2(fit)gy

Table of Contents