raspberrypi-profibus.awlpro 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  2. <!-- Awlsim project file generated by awlsim-0.66.0-pre -->
  3. <awlsim_project date_create="2016-03-16 00:00:00.000000"
  4. date_modify="2018-07-08 18:00:04.959722"
  5. format_version="1">
  6. <!-- CPU core configuration -->
  7. <cpu>
  8. <!-- CPU core feature specification -->
  9. <specs call_stack_size="256"
  10. nr_accus="2"
  11. nr_counters="256"
  12. nr_flags="2048"
  13. nr_inputs="128"
  14. nr_localbytes="1024"
  15. nr_outputs="128"
  16. nr_timers="256"
  17. parenthesis_stack_size="7" />
  18. <!-- CPU core configuration -->
  19. <config clock_memory_byte="-1"
  20. cycle_time_limit_us="1000000"
  21. ext_insns_enable="0"
  22. mnemonics="0"
  23. ob_startinfo_enable="0"
  24. run_time_limit_us="-1" />
  25. </cpu>
  26. <!-- AWL/STL language configuration -->
  27. <language_awl>
  28. <!-- AWL/STL source code -->
  29. <source enabled="1"
  30. name="Unnamed source"
  31. type="0"><![CDATA[
  32. ORGANIZATION_BLOCK OB 1
  33. VAR_TEMP
  34. OB1_EV_CLASS : BYTE; // Bits 0-3 = 1 (Coming event), Bits 4-7 = 1 (Event class 1)
  35. OB1_SCAN_1 : BYTE; // 1 (Cold restart scan 1 of OB 1), 3 (Scan 2-n of OB 1)
  36. OB1_PRIORITY : BYTE; // Priority of OB execution
  37. OB1_OB_NUMBR : BYTE; // 1 (Organization block 1, OB 1)
  38. OB1_RESERVED_1 : BYTE;
  39. OB1_RESERVED_2 : BYTE;
  40. OB1_PREV_CYCLE : INT; // Cycle time of previous OB 1 scan (milliseconds)
  41. OB1_MIN_CYCLE : INT; // Minimum cycle time of OB 1 (milliseconds)
  42. OB1_MAX_CYCLE : INT; // Maximum cycle time of OB 1 (milliseconds)
  43. OB1_DATE_TIME : DATE_AND_TIME; // Date and time OB 1 started
  44. END_VAR
  45. BEGIN
  46. //
  47. // EXAMPLE RASPBERRY PI PROJECT
  48. //
  49. // Two hardware modules are enabled in the
  50. // configuration of this project:
  51. // The 'rpigpio' module is used to access tha Raspberry Pi
  52. // GPIO ports.
  53. // The 'pyprofibus' module is used to access the PiLC
  54. // PROFIBUS-DP header and talk to PROFIBUS-DP slaves.
  55. //
  56. // The HW-config of the 'rpigpio' module
  57. // does the following input/output memory mappings:
  58. // I0.0 <= BCM17
  59. // I0.1 <= BCM24
  60. // Q0.0 => BCM27
  61. // Q0.1 => BCM23
  62. //
  63. // The HW-config of the 'pyprofibus' module
  64. // maps the PROFIBUS memory start to
  65. // I8.0 and Q8.0
  66. //
  67. A I 0.0 // Read bit from GPIO BCM17
  68. = Q 0.0 // Write bit to GPIO BCM27
  69. A I 0.0 // Read bit from GPIO BCM17
  70. A I 0.1 // Read bit from GPIO BCM24 and do an AND operation
  71. = Q 0.1 // Write resulting bit to GPIO BCM23
  72. L IB 8 // Read the first byte from PROFIBUS
  73. T QB 8 // Write it to the first byte of PROFIBUS
  74. // Run some other code...
  75. CALL FC 1
  76. END_ORGANIZATION_BLOCK
  77. FUNCTION FC 1 : VOID
  78. BEGIN
  79. NOP 0
  80. NOP 0
  81. NOP 0
  82. NOP 0
  83. NOP 0
  84. NOP 0
  85. NOP 0
  86. NOP 0
  87. NOP 0
  88. NOP 0
  89. NOP 0
  90. NOP 0
  91. NOP 0
  92. NOP 0
  93. NOP 0
  94. NOP 0
  95. NOP 0
  96. NOP 0
  97. NOP 0
  98. NOP 0
  99. NOP 0
  100. NOP 0
  101. NOP 0
  102. NOP 0
  103. L MW 200
  104. + 1
  105. T MW 202
  106. L MW 204
  107. + 1
  108. T MW 206
  109. L MW 208
  110. + 1
  111. T MW 210
  112. L MW 212
  113. + 1
  114. T MW 214
  115. L MW 216
  116. + 1
  117. T MW 218
  118. L MW 220
  119. + 1
  120. T MW 222
  121. L MW 224
  122. + 1
  123. T MW 226
  124. L MW 228
  125. + 1
  126. T MW 230
  127. L MW 200
  128. + 1
  129. T MW 202
  130. L MW 204
  131. + 1
  132. T MW 206
  133. L MW 208
  134. + 1
  135. T MW 210
  136. L MW 212
  137. + 1
  138. T MW 214
  139. L MW 216
  140. + 1
  141. T MW 218
  142. L MW 220
  143. + 1
  144. T MW 222
  145. L MW 224
  146. + 1
  147. T MW 226
  148. L MW 228
  149. + 1
  150. T MW 230
  151. L MW 200
  152. + 1
  153. T MW 202
  154. L MW 204
  155. + 1
  156. T MW 206
  157. L MW 208
  158. + 1
  159. T MW 210
  160. L MW 212
  161. + 1
  162. T MW 214
  163. L MW 216
  164. + 1
  165. T MW 218
  166. L MW 220
  167. + 1
  168. T MW 222
  169. L MW 224
  170. + 1
  171. T MW 226
  172. L MW 228
  173. + 1
  174. T MW 230
  175. L MW 200
  176. + 1
  177. T MW 202
  178. L MW 204
  179. + 1
  180. T MW 206
  181. L MW 208
  182. + 1
  183. T MW 210
  184. L MW 212
  185. + 1
  186. T MW 214
  187. L MW 216
  188. + 1
  189. T MW 218
  190. L MW 220
  191. + 1
  192. T MW 222
  193. L MW 224
  194. + 1
  195. T MW 226
  196. L MW 228
  197. + 1
  198. T MW 230
  199. L MW 200
  200. + 1
  201. T MW 202
  202. L MW 204
  203. + 1
  204. T MW 206
  205. L MW 208
  206. + 1
  207. T MW 210
  208. L MW 212
  209. + 1
  210. T MW 214
  211. L MW 216
  212. + 1
  213. T MW 218
  214. L MW 220
  215. + 1
  216. T MW 222
  217. L MW 224
  218. + 1
  219. T MW 226
  220. L MW 228
  221. + 1
  222. T MW 230
  223. NOP 0
  224. NOP 0
  225. NOP 0
  226. NOP 0
  227. NOP 0
  228. NOP 0
  229. NOP 0
  230. NOP 0
  231. NOP 0
  232. NOP 0
  233. NOP 0
  234. NOP 0
  235. NOP 0
  236. NOP 0
  237. NOP 0
  238. NOP 0
  239. NOP 0
  240. NOP 0
  241. NOP 0
  242. NOP 0
  243. NOP 0
  244. NOP 0
  245. NOP 0
  246. NOP 0
  247. END_FUNCTION
  248. ]]></source>
  249. </language_awl>
  250. <!-- Symbol table configuration -->
  251. <symbols>
  252. <!-- symbol table source code -->
  253. <source enabled="1"
  254. name="Main table"
  255. type="3"><![CDATA[
  256. ]]></source>
  257. </symbols>
  258. <!-- Core server link configuration -->
  259. <core_link>
  260. <!-- Locally spawned core server -->
  261. <spawn_local enable="0"
  262. interpreters="$DEFAULT"
  263. port_range_begin="4183"
  264. port_range_end="8278" />
  265. <!-- Remote server connection -->
  266. <connect host="pilc"
  267. port="4151"
  268. timeout_ms="3000" />
  269. <!-- Transport tunnel -->
  270. <tunnel local_port="-1"
  271. type="1">
  272. <ssh executable="ssh"
  273. port="22"
  274. user="pi" />
  275. </tunnel>
  276. </core_link>
  277. <!-- Hardware modules configuration -->
  278. <hardware>
  279. <!-- Loaded hardware module -->
  280. <module name="pyprofibus">
  281. <params>
  282. <param name="config"
  283. value="awlsimhw_pyprofibus.conf" />
  284. <param name="inputAddressBase"
  285. value="8" />
  286. <param name="outputAddressBase"
  287. value="8" />
  288. </params>
  289. </module>
  290. <!-- Loaded hardware module -->
  291. <module name="rpigpio">
  292. <params>
  293. <param name="I0.0"
  294. value="BCM17" />
  295. <param name="I0.1"
  296. value="BCM24" />
  297. <param name="Q0.0"
  298. value="BCM27" />
  299. <param name="Q0.1"
  300. value="BCM23" />
  301. <param name="inputAddressBase"
  302. value="0" />
  303. <param name="outputAddressBase"
  304. value="0" />
  305. </params>
  306. </module>
  307. </hardware>
  308. <!-- Graphical user interface configuration -->
  309. <gui>
  310. <editor autoindent="1"
  311. paste_autoindent="1"
  312. validation="1" />
  313. </gui>
  314. </awlsim_project>