Wiki source code of OpenCAN

Last modified by Jett on 2024/10/23 20:40

Show last authors
1 = {{id name="HOpenCAN"/}}**OpenCAN** =
2
3 OpenCan is based on CAN2.0 standard; OpenCAN protocols that could be configured autonomously to accept and send frames.
4
5 The protocol only use in the device have CAN pin.Such as PI8000 and PI3070i-A.
6
7 (% class="box infomessage" %)
8 (((
9 **✎Note:**Our J1939 protocol setting is similar to OpenCAN.If you need connect to J1939 device,please set the setting as OpenCAN.
10 )))
11
12 **HMI Settings**
13
14 |**Items**|**Settings**|**Note**
15 |Protocol|OPENCAN|
16 |Connection|CAN port|
17 |Baud rate|250000|
18
19 **CAN frame setting in HMI**
20
21 Click [OpenCAN setting] button in communication setting window;
22
23 {{id name="I12.PLCProtocol_html_e866b9e56e19785d.png"/}}[[image:xwiki_PIStudio_12.PLC+protocols_WebHome_9fa0e3a15fe03541.png||alt="12.PLC Protocol_html_e866b9e56e19785d.png" height="503" width="600"]]
24
25 Click [Add] to create a new frame;
26
27 {{id name="I12.PLCProtocol_html_3a6f4e2141763c8f.png"/}}[[image:xwiki_PIStudio_12.PLC+protocols_WebHome_e45cfd2ef2eb8ad0.png||alt="12.PLC Protocol_html_3a6f4e2141763c8f.png" height="315" width="600"]]
28
29 |**No**|**Items**|**Description**
30 |1|Add|add a frame related to register address
31 |2|Insert|Select the position where you want to insert a frame, and click [Insert frame] to add a new frame in front of the current frame position
32 |3|Frame manager|This list shows some of the main parameters for each frame that the user adds
33 |4|Modify|Modify the frames in frame management
34 |5|Copy|Copy one frame to another
35 |6|Delete|Remove the selected frames from the list by modifying the frames in frame management. If no frames are selected in the list, the first frame is deleted.
36 |7|Empty|All frames in the list are cleared
37 |8|Browse|Displays configuration files in XML format in IE
38 |9|OK|Complete the configuration of the frame and exit
39
40 Set CANBUS frame in setting windows
41
42 {{id name="I12.PLCProtocol_html_7c83130820321ef.png"/}}[[image:xwiki_PIStudio_12.PLC+protocols_WebHome_db28b6546e2bdaf3.png||alt="12.PLC Protocol_html_7c83130820321ef.png" height="507" width="600"]]
43
44 |**No**|**Items**|**Description**
45 |1|ID|Set the ID of a can frame in hexadecimal format;
46 |2|ID assign|split the ID by PF, PS, and SA;
47 |3|Frame type|Select Standard frame or Extended Frame;
48 |4|Frame format|Select between data frame and remote Frame;
49 |5|Data|Set the data part of CAN frame, with two Numbers representing a hexadecimal number and Spaces spaced; Maximum support of 8 bytes is defined according to CAN message;
50 |6|Use address|(((
51 Set the register address related to the CAN frame, which corresponds to the register address set on the main state one by one. The data obtained from the address is assigned continuously;
52
53 **Edit:** Set a bit or word address by its format;
54
55 **Option: **Set address options related to frame, enter “register address option” interface, specifically browse the following “register address option” interface;
56 )))
57 |(% rowspan="8" %)7|(% rowspan="8" %)Data interactive configuration|There are two interactive modes of the touch screen. One is that the touch screen actively sends frames, and the device receives and processes and feeds back. The other, on the contrary, passively receives frames from the device for processing and feedback;
58 |Send after receiving: if this item is selected, the interaction of the touch screen will act as a passive party, and the touch screen will receive the CAN frame first and send feedback. Unchecked items interact in the opposite way;
59 |Feedback mode: feedback mode includes no response, confirm response and data response;
60 |No response: the device or touch screen will not receive feedback;
61 |Confirm response: the device or the touch screen will receive feedback with confirmation, which could be used to compare the data parts. If this function is used, the 20 addresses before and after this address should not be used. All addresses of cata10-cata30 could not be used with the reply confirmation function of cata20;
62 |Data response: the device or touch screen will receive feedback with data, and the data to be separated from the feedback frame should be set to store in the register address;
63 |response ID: if the address wants to receive data on a frame with a different ID, set this, check "different from sender", and enter a different ID in the following input box. Without this setting, the screen will receive and process a frame with the same ID as the sender;
64 |Response timeout: sets whether the response frame timeout;
65 |(% rowspan="3" %)8|(% rowspan="3" %)Control address|If ticked, enable sending when the value of the corresponding control bit number (address) is non-0.
66 |Control bit: CtrlBit register range 0~~255, if the control bit is ON, can instruction will run normally. Otherwise, it doesn't run;
67 |Manually send: a manually send tick indicates only one send;
68 |9|Flag configuration|Communication control for each frame. Display OFF when communication is normal, and ON when communication is abnormal;
69 |10|Note|Fill the text to explain the meaning of the frame;
70 |11|Data assign|Preview the display in this table based on the address and the corresponding number of digits;
71 |12|Current operation display|Display the description of current operation;
72 |13|Add|Add a new frame;
73 |14|Save frame|Save the configured frame format;
74 |15|Cancel|Cancel the frame configuration;
75
76 Set CAN address (Read or write operation);
77
78 {{id name="I12.PLCProtocol_html_7e9f9b25eb6ae8ce.png"/}}[[image:xwiki_PIStudio_12.PLC+protocols_WebHome_3c2b23a39850a5bf.png||alt="12.PLC Protocol_html_7e9f9b25eb6ae8ce.png" height="446" width="600"]]
79
80 |**No.**|**Item**|**Description**
81 |1|Current address|Displays the register type and register address set by the user in the data access interface
82 |(% rowspan="3" %)2|(% rowspan="3" %)Trigger|Two operations, "read" and "write," are based on on-screen registers
83 |If "read" is selected, the register address is reading device data in a manner of sending frames set by the user in a loop.
84 |If "write" is selected, the screen data of the register address will be written into the device. The writing mode is that the user makes a write operation on the screen, which will trigger the sending of a frame set by the user.
85 |(% rowspan="5" %)3|(% rowspan="3" %)Data operation|The read and write operations in the trigger conditions are set accordingly.
86 |If the trigger condition is a read operation, this section needs to set the position and length of the data to be obtained at the current address in the frame.
87 |If the trigger condition is a writing operation, there are two situations:(((
88 * If the "add writing data to the frame" option is not selected, the frame set by the user will be sent directly when the user writes on the screen.
89 * Select the "add the written data to the frame" option, and when the user writes on the screen, the program will insert the data in the frame set by the user and send the written data to the frame set by the user according to the data insertion position and length set by the user.
90 )))
91 |(% rowspan="2" %)Position and length input format|If the register type is a bit address, the decimal point is required to represent the bits in the byte. For example, 1.1 represents the first bit of the first byte of 8 bytes in the data frame, and the length is in bits, and so on.
92 |If the register type is word address, the integer only needs to represent the byte, such as 1, which represents the first byte of 8-byte data in the data frame, and the unit of length is byte, and so on.
93 |4|Add|Add current configuration
94 |5|Close|Close the configuration window to exit
95
96 **Multiple Packages Settings**
97
98 {{id name="I12.PLCProtocol_html_107e0f6b1a90afff.png"/}}[[image:xwiki_PIStudio_12.PLC+protocols_WebHome_3a7f30ae2fe9ae3e.png||alt="12.PLC Protocol_html_107e0f6b1a90afff.png" height="341" width="600"]]
99
100 Check [Multiple packages supported] to open [Multiple package data] window, as below show.
101
102 Select Multiple package type
103
104 * Not Multiple packages
105 * J1939 Multiple packages
106 * Customized Multiple packages
107
108 Click [Edit Receive data] for [Receive] settings
109
110 * Start code+ Total length (J1939)
111
112 {{id name="I12.PLCProtocol_html_3c360c6b5aca51bf.png"/}}[[image:xwiki_PIStudio_12.PLC+protocols_WebHome_efec23bcbcc42ec3.png||alt="12.PLC Protocol_html_3c360c6b5aca51bf.png" height="340" width="426"]]
113
114 As set above set, J1939 command is received by the HMI, only when its length is 25 bytes, and the start code is 0x57, 0x1B;
115
116 * Start code + Data max length (J1939)
117
118 {{id name="I12.PLCProtocol_html_74496b2a68cfcdde.png"/}}[[image:xwiki_PIStudio_12.PLC+protocols_WebHome_e0450564901bac01.png||alt="12.PLC Protocol_html_74496b2a68cfcdde.png" height="340" width="426"]]
119
120 As set above set, J1939 command is received by the HMI, only when its length less than 50 bytes, and the start code is 0x57, 0x1B;
121
122 * Data max length (J1939)
123
124 {{id name="I12.PLCProtocol_html_98cea3e7cbd8f05d.png"/}}[[image:xwiki_PIStudio_12.PLC+protocols_WebHome_9a0eaf954341bf3d.png||alt="12.PLC Protocol_html_98cea3e7cbd8f05d.png" height="340" width="426"]]
125
126 As set above set, J1939 command is received by the HMI, only when its length less than 50 bytes.
127
128 * Customized multiple package
129
130 {{id name="I12.PLCProtocol_html_4635bbe4d7999db0.png"/}}[[image:xwiki_PIStudio_12.PLC+protocols_WebHome_67f78feb18459ef4.png||alt="12.PLC Protocol_html_4635bbe4d7999db0.png" height="395" width="367"]]
131
132 As set above, It is received by the HMI, when the first frame starts with 0X57 0X1B, and the sum of the data lengths of multiple frames is equal to 79 bytes.
133
134 Click [Edit Send data] for [Send] setting
135
136 * J1939
137
138 {{id name="I12.PLCProtocol_html_a4769e44331ca732.png"/}}[[image:xwiki_PIStudio_12.PLC+protocols_WebHome_d2fa5717cc3349c4.png||alt="12.PLC Protocol_html_a4769e44331ca732.png" height="280" width="463"]]
139
140 [Data] is all data to be sent.
141
142 Since the frame of the J1939 frame contains the number of the data packet, so the data sent is: the first byte (number) + 7 bytes of data. If it is less than 7 bytes, it is sent in the actual number of bytes.
143
144 * Customized multiple package
145
146 {{id name="I12.PLCProtocol_html_78546f765d6f3deb.png"/}}[[image:xwiki_PIStudio_12.PLC+protocols_WebHome_f97dea6a36adf244.png||alt="12.PLC Protocol_html_78546f765d6f3deb.png" height="280" width="463"]]
147
148 [Data] is all data to be sent.
149
150 As set above, fist frame length is 2 bytes, and others are sent with 6 bytes for every frame, if the last frame is less than 6 bytes, send according to the actual length.
151
152 **Cable Wiring**
153
154 {{id name="I12.PLCProtocol_html_fccede84efcbdc22.png"/}}[[image:xwiki_PIStudio_12.PLC+protocols_WebHome_da79ae27acf95368.png||alt="12.PLC Protocol_html_fccede84efcbdc22.png" height="111" width="391"]]
155
156 (% class="box infomessage" %)
157 (((
158 **✎Note:** The address interval between each frame need to be more than a word address;
159 )))