Application Notes
Appendix C
AT-DIO-32F User Manual
C-6
© National Instruments Corporation
/* address offset of the registers of AT-DIO-32F */
#define
CFG1os
0x00
#define
CFG2os
0x02
#define
CFG3os
0x04
#define
CFG4os
0x14
#define
STATos
0x00
#define
PORTAos
0x06
#define
PORTCos
0x08
unsigned int
base_addr;
unsigned int CFG1,CFG2,CFG3,CFG4,
/* Registers of AT-DIO-32F */
STAT1,PORTA,PORTC;
FILE
*fp;
char
filename[81];
int
lowEOF;
main()
{
/*... base_address is input from the keyboard....*/
printf("\nEnter the base_address of the AT-MIO-32F(Hex): ");
scanf("%x", &base_addr);
CFG1
=
base_addr;
CFG2
=
base_addr;
CFG3
=
base_addr;
CFG4
=
base_addr;
STAT1 =
base_addr;
PORTA =
P base_addr;
PORTC =
P base_addr;
lowEOF = (EOF & 0x00ff);
/* Set so that EOF character is in the low
byte only. */
setup_dio();
choose_what();
}/* End main */
/*..... Sets up AT-DIO-32F .....*/
setup_dio()
{
outpw(CFG1, 0x00); /* Initialize the board */
outpw(CFG2, 0x00);
outpw(CFG3, 0x00);
outpw(CFG4, 0x01);
/* Set for Rev. C board */
/* Set up for leading edge. */
outpw(CFG1, 0x710);
/* Enable DIOAEN and DIOBEN; PULSE1 is high;
EDGE1 is low, and LRESET1 */
outpw(CFG2, 0x710);
/* Enable DIOCEN and DIODEN; PULSE2 is high;
EDGE2 is low, and LRESET2. */
outpw(CFG1, 0x610); /* Reconfigure after reset. */
outpw(CFG2, 0x610);
outpw(CFG3, 0x4800);
/* Enable WRITEC and WRITED to write;
WRITEA and WRITEB are configured to read. */
Содержание AT-DIO-32F
Страница 19: ......
Страница 101: ......
Страница 102: ......
Страница 123: ......
Страница 124: ......
Страница 125: ......
Страница 126: ......
Страница 127: ......
Страница 128: ......
Страница 129: ......
Страница 130: ......
Страница 131: ......
Страница 132: ......
Страница 133: ......
Страница 134: ......
Страница 135: ......
Страница 136: ......
Страница 137: ......
Страница 138: ......
Страница 139: ......
Страница 140: ......
Страница 141: ......
Страница 142: ......
Страница 143: ......