
44
3
VMIVME-1160A 32-bit Optically Coupled Digital Input Board with Change-of-State Detection
Typical Programming Example
The following example code enables interrupts, processes interrupts, and displays the
current input data when a change-of-state occurs.
/*
** 1160.h
**
** VMIVME-1160 32 BIT OPTICALLY COUPLED DIGITAL INPUT W/COS
*/
struct vmivme_1160_registers {
unsigned char offset[32];
};
typedef struct vmivme_1160_registers v1160_t;
/*
** register offset definitions
**
** note: defining register offsets using the above
** structure/array and defines facilitates
** skipping unused addresses in the board map.
*/
#define dr0 offset[0x00]
#define dr1 offset[0x01]
#define dr2 offset[0x02]
#define dr3 offset[0x03]
#define ier offset[0x05]
#define cr0 offset[0x11]
#define cr1 offset[0x13]
#define cr2 offset[0x15]
#define cr3 offset[0x17]
#define vr0 offset[0x19]
#define vr1 offset[0x1b]
#define vr2 offset[0x1d]
#define vr3 offset[0x1f]
/*
** interrupt enable control bits
*/
#define IE_DR0 0x08
#define IE_DR1 0x04
#define IE_DR2 0x02
#define IE_DR3 0x01
/*
** BIM control bits
*/
#define FLAG_BIT 0x80
#define FLAG_AUTO_CLEAR 0x40
#define EXTERNAL_VECTOR 0x20 /* don’t use ! - see manual */
#define INTERRUPT_ENABLE 0x10
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com