National Instruments PC-TIO-10 User Manual page 44

Timing i/o board for the pc
Table of Contents

Advertisement

Chapter 4
void
main(void);
void
reset9513(unsigned int, unsigned int);
int
square_wave(unsigned int, unsigned int, unsigned int, unsigned long,
unsigned long);
/*
support functions
void
reset9513(base_address, chip_offset)
unsigned int
{
unsigned int
int
/*
set up the register addresses
cmd = base_address | chip_offset | cmd_port;
data = base_address | chip_offset | data_port;
/*
reset the 9513
outp(cmd, 0xff);
for (ctr = 1; ctr <=5; ctr++)
{
outp(cmd, ctr);
outp(data, 0x00);
outp(data, 0x00);
outp(cmd, (ctr + 8));
outp(data, 0x03);
outp(data, 0x00);
}
outp(cmd, 0x5f);
}
int square_wave(base_address, counter, timebase, high_time, low_time)
unsigned int
unsigned long
{
unsigned int
/*
check ranges
if ((counter < 1) || (counter > 10) ||
(timebase > 15) ||
(high_time < 1L) || (high_time > 65536L) ||
(low_time < 1L) || (low_time > 65536L))
return range_err;
/*
set up the register addresses
© National Instruments Corporation
*/
base_address,
chip_offset;
cmd,
data;
ctr;
*/
base_address,
counter,
timebase;
high_time,
low_time;
cmd,
data,
mode;
*/
*/
/*
reset the chip
/*
select Counter Mode Register
/*
store mode low-byte */
/*
store mode high-byte
/*
select Counter Load Register
/*
store load low-byte */
/*
store load high-byte
/*
load all counters
*/
4-11
Programming
*/
*/
*/
*/
*/
*/
PC-TIO-10 User Manual

Advertisement

Table of Contents
loading

Table of Contents