13.07.2015 Views

User manual - ICP DAS USA

User manual - ICP DAS USA

User manual - ICP DAS USA

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

• sio_openDescription:This function is used to open and initiate a specified serial port in the LinPAC-8000.The n-port modules in the LinPAC-8000 will use this function. For example, if you want tosend or receive data from a specified serial port, this function must be called first. Then theother functions can be used later.Syntax:[ C ]int sio_open(const char *port, speed_t baudrate, tcflag_t data, tcflag_t parity,tcflag_t stop)Parameter:port : [Input] device name: /dev/ttyS2, /dev/ttyS3…/dev/ttyS34baudrate: [Input] B1200/ B2400/ B4800/ B9600/ B19200/ B38400/ B57600/B115200date : : [Input] DATA_BITS_5/ DATA_BITS_6/ DATA_BITS_7/ DATA_BITS_8parity : : [Input] NO_PARITY / ODD_PARITY / EVEN_PARITYstop : : [Input] ONE_STOP_BIT / TWO_STOP_BITSReturn Value:This function returns int port descriptor for the port opened successfully.ERR_PORT_OPEN is for FailureExample:#define COM_M1 "/dev/ttyS2" // Defined the first port of I-8144 in slot 1char fd[5];fd[0]=sio_open(COM_M1, B9600, DATA_BITS_8, NO_PARITY,ONE_STOP_BIT);if (fd[0] == ERR_PORT_OPEN) {printf("open port_m failed!\n");return (-1);}// The i8114 is plug in slot 1 and the first port will be open and initiated.Remark:This function can be applied on modules: I-8114, I-8112, I-8142 and I-8144.LinPAC-8x4x SDK:51

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!