This is an old revision of the document!
uPHP functions related to the serial port and Modbus are shown below:
Click on the function name for further details:
FUNCTION NAME | PARAMETER(S) | RETURN | DESCRIPTION | ||
---|---|---|---|---|---|
f485open | int baud, int parity | int handle or 0 | Open the RS-485 port at the specified baud rate and parity | ||
fclose | int handle | Close a file, stream or socket | |||
feof | int handle | int 1 or 0 | Test if no more data is available in a file, stream or socket | ||
fgets | int handle, int size | string or int -1 | Return a single line from a file, stream or socket, with optional size limit | ||
filesize | string filename or int handle | int bytes | Return the size of a file, or the number of unread bytes in a stream or socket | ||
fread | int handle, int bytes | string or int 0 | Read bytes from a file, stream or socket | ||
fseropen | int baud, int blocking, int invert, int parity | int handle or 0 | Open the serial port at the specified baud rate with optional parameters | ||
fsockopen | string host, int port, int timeout | int handle or 0 | Open an internet socket connection with optional |[[.functions:fwrite]]|int handle, mixed data, int length | int bytes written or -1 | Write data to a file, stream or socket |
mb_delete_device | int id | int 1=OK | Delete a device from the list of active devices | ||
mb_get_dev_by_id | int id | array | Return modbus device details by id | ||
mb_get_dev_by_index | int index | array | Return modbus device details by index | ||
mb_get_dev_by_name | string name | array | Return modbus device details by name | ||
mb_get_dev_info | int type | array | Return modbus device details by type | ||
mb_get_role_array | array | Return an array of all roles and their values | |||
mb_get_status_by_role | int role | int 1=OK | Return status of the device attached to the role | ||
mb_get_val_by_role | int role | number | Return value of the role | ||
mb_num_devices | int | Return number of devices on the modbus | |||
mb_queue_command | mixed values ... | array of numbers | Queue a sequence of characters to the RS-485 bus and get but ignore the reply | ||
mb_scan_complete | int 1=complete, 0=ongoing | Check to see if a modbus scan has completed | |||
mb_scan_percent | number percent completed | Return scan percentage completed | |||
mb_send_command | mixed values ... | array of numbers | Send a sequence of characters to the RS-485 bus and get a reply | ||
mb_set_dev_var | string name or int id, string variable, mixed value | int 1=OK | Set a variable on a modbus device | ||
mb_set_val_by_role | int role, number value | int 1=OK | Set a role value on a modbus device | ||
mb_start_scan | int start, int end | Initiate an automatic scan of the modbus |