![Multitech MultiConnect MTPCIE-BW Developer'S Manual Download Page 79](http://html1.mh-extra.com/html/multitech/multiconnect-mtpcie-bw/multiconnect-mtpcie-bw_developers-manual_1855979079.webp)
USING LINUX WITH H5 DEVICES
MultiConnect
®
PCIe MTPCIE-H5/MTPCIE-BW Developer Guide
79
Test Program()
The following simple C program is useful to test the modem issuing an AT command. The program opens the
/dev/ttyACM0 interface and calls the write() and the read() function to send an AT command and receive the
subsequent output.
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */
#define USB "/dev/ttyACM0"
#define BUFSIZE 1000
#define BAUDRATE B115200
int open_port(char *port)
{
struct termios options;
int fd;
fd = open(port, O_RDWR | O_NOCTTY | O_NDELAY);
if (fd == -1)
{
printf("open_port: Unable to open the port - ");
}
else
{
printf ( "Port %s with file descriptor=%i",port, fd);
fcntl(fd, F_SETFL, FNDELAY);
tcgetattr( fd, &options );
cfsetispeed( &options, BAUDRATE );
cfsetospeed( &options, BAUDRATE );
options.c_cflag |= ( CLOCAL | CREAD);
options.c_cflag &= ~(CSIZE | PARENB | CSTOPB | CSIZE);
options.c_cflag |= CS8;
options.c_cflag &= ~CRTSCTS;
options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
options.c_iflag &= ~(IXON | IXOFF | IXANY | ICRNL | INLCR |
IGNCR);
options.c_oflag &= ~OPOST;
if ( tcsetattr( fd, TCSANOW, &options ) == -1 )
printf ("Error with tcsetattr = %s\n", strerror ( errno )
);
else
printf ( "%s\n", "succeed" );
}
return (fd);
}
int main()
{
int serialFD = open_port(USB);
char buf[BUFSIZE];
Summary of Contents for MultiConnect MTPCIE-BW
Page 1: ...MultiConnect PCIe MTPCIE H5 MTPCIE BW Developer Guide...
Page 20: ...DEVELOPER BOARD AND SCHEMATICS 20 MultiConnect PCIe MTPCIE H5 MTPCIE BW Developer Guide...
Page 22: ...DEVELOPER BOARD AND SCHEMATICS 22 MultiConnect PCIe MTPCIE H5 MTPCIE BW Developer Guide Bottom...
Page 25: ...DEVELOPER BOARD AND SCHEMATICS MultiConnect PCIe MTPCIE H5 MTPCIE BW Developer Guide 25...
Page 26: ...DEVELOPER BOARD AND SCHEMATICS 26 MultiConnect PCIe MTPCIE H5 MTPCIE BW Developer Guide...
Page 27: ...DEVELOPER BOARD AND SCHEMATICS MultiConnect PCIe MTPCIE H5 MTPCIE BW Developer Guide 27...
Page 28: ...DEVELOPER BOARD AND SCHEMATICS 28 MultiConnect PCIe MTPCIE H5 MTPCIE BW Developer Guide...
Page 29: ...DEVELOPER BOARD AND SCHEMATICS MultiConnect PCIe MTPCIE H5 MTPCIE BW Developer Guide 29...
Page 30: ...DEVELOPER BOARD AND SCHEMATICS 30 MultiConnect PCIe MTPCIE H5 MTPCIE BW Developer Guide...
Page 31: ...DEVELOPER BOARD AND SCHEMATICS MultiConnect PCIe MTPCIE H5 MTPCIE BW Developer Guide 31...
Page 32: ...DEVELOPER BOARD AND SCHEMATICS 32 MultiConnect PCIe MTPCIE H5 MTPCIE BW Developer Guide...
Page 51: ...MECHANICAL DRAWING MultiConnect PCIe MTPCIE H5 MTPCIE BW Developer Guide 51 MTPCIE BW...