US Robotics USR3520 User Manual page 84

3g m2m cellular gateway
Hide thumbs Also See for USR3520:
Table of Contents

Advertisement

Note:
By default the TX and RX of the RS485 connection are disabled. So you have to enable them
before you can start using the RS485 port. (You can enable this by using the DE and RE
signals). For a 2 wire interface (=half duplex) you should of course only enable one direction
at the same time.
Below an example of how to do this in your code.
(The example shows how to activate both DE and RE)
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
# include <unistd.h>
#include <sys/ioctl.h>
#include <errno.h>
/**************************************************************************
* Manifest Constants
**************************************************************************/
#ifndef TIOCM_OUT1
#define TIOCM_OUT1
#define TIOCM_OUT2
#endif
#define TIOCM_RE TIOCM_OUT1
#define TIOCM_DE TIOCM_OUT2
/*************************************************************************/
int main (void)
{
int fd = open("/dev/ttySP4",O_RDWR || O_NONBLOCK);
if (fd < 0) { printf("failed to pen device\n"); return 0; }
int status, err;
/* switch on RS485 TRANSMIT buffer and RECEIVE buffer */
ioctl(fd, TIOCMGET, &status);
status |= (TIOCM_DE | TIOCM_RE);
if ((err = ioctl(fd, TIOCMSET, &status)))
{
printf("ioctl error 0x%x, errno 0x%x, status %x",err, errno, status);
}
close(fd);
return 0;
}
Revision: 1.00
0x2000
0x4000
Copyright 2015 U.S. Robotics Corporation
84 |
P a g e

Advertisement

Table of Contents
loading

This manual is also suitable for:

Usr803520Courier usr3510Courier usr803510

Table of Contents