This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
uphp:functions:f485open [2017/03/27 16:07] jeff |
uphp:functions:f485open [2021/09/13 05:57] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
======f485open====== | ======f485open====== | ||
+ | |||
< | < | ||
Line 5: | Line 6: | ||
====Description==== | ====Description==== | ||
- | <well size=" | + | |
- | <span style=" | + | <well size=" |
- | < | + | <span style=" |
- | <span style=" | + | <span style=" |
- | <span style=" | + | <span style=" |
- | <span style=" | + | <span style=" |
- | <span style=" | + | <span style=" |
- | <span style=" | + | <span style=" |
+ | <span style=" | ||
</ | </ | ||
Line 20: | Line 22: | ||
====Parameters==== | ====Parameters==== | ||
- | < | ||
- | < | + | <html><b>< |
- | ====Return Value==== | + | < |
- | Upon success it returns a file handle which may be used together with the other file functions that require a handle such as [[fgets()]], | + | |
- | If the attempt to open the RS-485 port fails it will return 0 | + | ====Return Values==== |
+ | < | ||
+ | |||
+ | The file handle may be used together with the other file functions that require a handle such as [[fgets()]], | ||
====Example==== | ====Example==== | ||
- | **Open the 485 port at 115200 baud with even parity:** | + | |
+ | ===Open the 485 port at 115200 baud with even parity=== | ||
<code php> | <code php> | ||
<? | <? | ||
$fp=f485open(115200, | $fp=f485open(115200, | ||
- | if (!$fp) { | + | if ($fp) { |
- | print(" | + | |
- | } else { | + | |
$res=fwrite($fp," | $res=fwrite($fp," | ||
if ($res) { | if ($res) { | ||
Line 44: | Line 46: | ||
} | } | ||
fclose($fp); | fclose($fp); | ||
+ | } else { | ||
+ | print(" | ||
} | } | ||
?> | ?> | ||
Line 49: | Line 53: | ||
====See Also==== | ====See Also==== | ||
+ | |||
[[how_tos: | [[how_tos: | ||
+ | |||
+ | [[fopen()]] - Open a file for reading or writing | ||
[[fseropen()]] - Open the serial port at the specified baud rate with optional parameters | [[fseropen()]] - Open the serial port at the specified baud rate with optional parameters | ||
Line 55: | Line 62: | ||
[[fsockopen()]] - Open an internet socket connection with optional timeout | [[fsockopen()]] - Open an internet socket connection with optional timeout | ||
- | [[fopen()]] - Open a file for reading | + | [[fread()]] - Read bytes from a file, stream |
- | [[fclose()]] - Close a file, stream or socket | + | [[fgets()]] - Return a single line from a file, stream or socket, with optional size limit |
- | [[feof()]] - Test if no more data is available in a file or stream | + | [[fwrite()]] - Write data to a file, stream |
- | [[fgets()]] - Return a single line from a file or stream, with optional size limit | + | [[feof()]] - Test if no more data is available in a file, stream |
- | [[fread()]] - Return | + | [[filesize()]] - Return |
- | [[fwrite()]] - Write data to a file or stream | + | [[fseek()]] - Position the file pointer in an open file |
+ | |||
+ | [[ftell()]] - Return the current position of a file read/write pointer | ||
+ | |||
+ | [[fclose()]] - Close a file, stream | ||