Differences
This shows you the differences between two versions of the page.
| en:software:qview:qview_6:qcl_library:dw14sermodsl [2017/02/24 17:45] – created qem103 | en:software:qview:qview_6:qcl_library:dw14sermodsl [2019/08/29 17:01] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== DW14SerModSl ====== | ||
| + | |||
| + | **D = **// | ||
| + | |||
| + | **W = **//Writing functions// | ||
| + | |||
| + | The DW14SerModSl function simulates the Modbus SLAVE Protocol through the use of a SERCOM device.\\ | ||
| + | In particular the function sorts an array (named " | ||
| + | |||
| + | Modbus functions supported by this function are: | ||
| + | *Function 3 - Read Holding Register | ||
| + | *Function 16 - Force Multiple Register (multiple word writing) | ||
| + | |||
| + | If you want to increase the speed of data exchange you can set the " | ||
| + | |||
| + | ===== IMPLEMENTATION ===== | ||
| + | |||
| + | **DW14SerModSl (Sercom1, Buffer, idcard, slrdelay, gfWrite, glError)** | ||
| + | |||
| + | Parameters: | ||
| + | |||
| + | ^IN/ | ||
| + | | IN | INTDEVICE | ||
| + | | IN | ARRSYS / ARRGBL | ||
| + | | IN | GLOBAL | ||
| + | | IN | SYSTEM | ||
| + | | OUT | GLOBAL | ||
| + | | OUT | GLOBAL | ||
| + | |||
| + | ==== Error ==== | ||
| + | |||
| + | After calling the function if there are any errors the error variable having the following values:\\ | ||
| + | 0: No error\\ | ||
| + | 1: Number char in reception > Buffer dimension (64 items). (Check on " | ||
| + | 2: Error Checksum\\ | ||
| + | 3: Address > maximum size of user Buffer\\ | ||
| + | 4: Number of bytes required to answer > 64 (max limit of the device buffer)\\ | ||
| + | 5: Function Type Modbus not manage by the function (other than 3 or 16) | ||
| + | |||
| + | === Example === | ||
| + | |||
| + | // | ||
| + | <code QCL> | ||
| + | INTDEVICE | ||
| + | ; | ||
| + | | ||
| + | </ | ||
| + | |||
| + | //TASK_00// | ||
| + | <code QCL> | ||
| + | sercom1: | ||
| + | sercom1: | ||
| + | sercom1: | ||
| + | sercom1: | ||
| + | sercom1:par = 0 | ||
| + | |||
| + | slrdelay = 0 | ||
| + | |||
| + | OPENCOM sercom1 | ||
| + | WAIT sercom1: | ||
| + | |||
| + | gfIniz = 1 | ||
| + | </ | ||
| + | |||
| + | //TASK_01// | ||
| + | |||
| + | <code QCL> | ||
| + | Idcard = 1 | ||
| + | |||
| + | MAIN: | ||
| + | IF gfIniz | ||
| + | Buffer [20] = cnCounter: | ||
| + | | ||
| + | IF gfWrite | ||
| + | gfWrite = 0 | ||
| + | cnCounter: | ||
| + | ENDIF | ||
| + | ENDIF | ||
| + | END | ||
| + | </ | ||
| + | |||
| + | === Note === | ||
| + | |||
| + | *It is recommended that you implement the function in a task specific whereas the same contains instructions to WAIT that might block the Task. | ||
| + | *If you want to increase the speed of data exchange you can set the " | ||
| + | |||
| + | === Limits === | ||
| + | |||
| + | The restriction number of variables that you can exchange is as follows | ||
| + | * Function 3 - Read Holding Register | ||
| + | * Funzione 16 - Force Multiple Register (multiple word writing) | ||
| + | |||
| + | The restriction number of variables that you can exchange are as follows: | ||
| + | * Function 3 : maximum 30 word readable at the same time | ||
| + | * Function 16 : maximum 28 word writable drives simultaneously | ||