mbusScan (Function) |
Top Previous Next |
This function is used to scan for slaves on wired M-Bus. The search for primary addresses is done by checking every address. Depending on the baud rate, this can take a few minutes.
The search for secondary addresses is done using a mask, where only the address space containing devices will be scanned. Depending on the baudrate and the devices on the bus, the scan can take many minutes.
Input: handle : SYSHANDLE A handle to the connection
smode : SINT default 1 The scan mode determining the address type to scan for:
mask : STRING default "FFFFFFFFFFFFFFFF" String containing the mask to use for filtering the addresses in scan mode 2. The mask must be 16 characters long and must use 'F' as placeholder for unknown values. The mask contains: •4 bytes with the device ID, encoded as BCD. •2 bytes for the manufacturer ID as binary. •1 byte for the device version as binary. •1 byte for the device media as binary.
For a device with device ID 12345678, manufacturer ID 0x1C36, version 123 and medium 7, the secondary address would be "12345678361C7B07". To search for a device ID 12345678, use mask "12345678FFFFFFFF". To search for devices starting with "123", use mask "123FFFFFFFFFFFFF". For the device ID, each nibble can be replaced with 'F', the rest of the fields can only use wildcards for the entire field, i.e. 'FF' for version or medium, 'FFFF' for manufacturer ID.
cb_found : CALLBACK The callback function to call for every found slave. (See the mbusScanFoundCallback callback declaration below)
cb_progress : CALLBACK Callback function to call before every search to indicate the progress. (See the mbusScanProgressCallback callback declaration below)
Returns: INT
Declaration: FUNCTION mbusScan : INT;
FUNCTION CALLBACK mbusScanFoundCallback;
FUNCTION CALLBACK mbusScanProgressCallback;
Example: INCLUDE rtcu.inc
|