Difference between revisions of "Serial Open"
From WikiPrizm
Jump to navigationJump to searchm |
|||
Line 85: | Line 85: | ||
Serial_Open(mode); | Serial_Open(mode); | ||
} | } | ||
+ | |||
+ | [[Category:Syscalls|Serial_Open]] |
Revision as of 11:42, 14 May 2012
Contents
Synopsis
Syscall index: 0x1BB7
Function signature: int Serial_Open(unsigned char *mode)
Inputs
mode: a 6-byte array specifying the desired communication parameters. Summarized in the table below.
Index | Description | Values | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | Unknown | Always 0 | ||||||||||||||||||||||
1 | Bit rate |
| ||||||||||||||||||||||
2 | Parity |
| ||||||||||||||||||||||
3 | Data length |
| ||||||||||||||||||||||
4 | Stop bits |
| ||||||||||||||||||||||
5 | Unused | Always 0 |
Outputs
Returns 0 for success, 3 if the serial port is already open, and 4 if the byte at index 0 was not 0.
Example
Check if the serial port is already open, and configure it for 9600 bps 8n1 operation if not.
if (Serial_IsOpen() != 1) { unsigned char mode[6] = {0, 5, 0, 0, 0, 0}; // 9600 bps 8n1 Serial_Open(mode); }