pixtend-iotest.awlpro 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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:17.734599"
  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="1"
  22. mnemonics="2"
  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="source"
  31. type="0"><![CDATA[
  32. // Digital input (DI) / output (DO) tests.
  33. // PiXtend DIs are wired to EB 1
  34. // PiXtend DOs are wired to AB 1
  35. FUNCTION FC 1 : VOID
  36. BEGIN
  37. // Calculate the expected EB 1 from AB 1.
  38. // The fake PiXtend spidev module wires DI do DO in the following way:
  39. // EB1 := ((AB1 & 0x3F) | (((AB1 ^ 0x03) & 0x03) << 6))
  40. L AB 1
  41. UW W#16#3F
  42. L AB 1
  43. XOW W#16#03
  44. UW W#16#03
  45. SLW 6
  46. OW
  47. T MB 10
  48. // Compare the actual EB 1 to the expected EB 1 (MB 10)
  49. L EB 1
  50. L MB 10
  51. __ASSERT== __ACCU 1, __ACCU 2
  52. // Increment the EB 1 / AB 1 test pattern by one
  53. L AB 1
  54. + 1
  55. T AB 1
  56. END_FUNCTION
  57. // GPIO tests
  58. // PiXtend GPIO 0 is wired to E 2.0
  59. // PiXtend GPIO 1 is wired to A 2.0
  60. FUNCTION FC 2 : VOID
  61. BEGIN
  62. // Calculate the expected E 2.0 from A 2.0
  63. // The fake PiXtend spidev module wires GPIO 1 to GPIO 0
  64. L AB 2
  65. UW W#16#01
  66. T MB 20
  67. // Compare the actual EB 1 to the expected EB 1 (MB 20)
  68. L EB 2
  69. L MB 20
  70. __ASSERT== __ACCU 1, __ACCU 2
  71. // Increment the EB 2 / AB 2 test pattern by one
  72. L AB 2
  73. + 1
  74. T AB 2
  75. END_FUNCTION
  76. // Analog input tests
  77. FUNCTION FC 3 : VOID
  78. BEGIN
  79. // Check AI0
  80. // The fake PiXtend spidev module always reports 1 V
  81. L EW 10
  82. L 2754
  83. __ASSERT== __ACCU 1, __ACCU 2
  84. // Check AI1
  85. // The fake PiXtend spidev module always reports 2 V
  86. L EW 12
  87. L 5535
  88. __ASSERT== __ACCU 1, __ACCU 2
  89. // Check AI2
  90. // The fake PiXtend spidev module always reports 20.1 mA
  91. L EW 14
  92. L 27663
  93. __ASSERT== __ACCU 1, __ACCU 2
  94. // Check AI3
  95. // The fake PiXtend spidev module always reports 14.1 mA
  96. L EW 16
  97. L 17295
  98. __ASSERT== __ACCU 1, __ACCU 2
  99. END_FUNCTION
  100. // Analog output tests
  101. FUNCTION FC 4 : VOID
  102. BEGIN
  103. // Check DAC_A
  104. // The magic value is checked by the fake PiXtend-Spidev module
  105. L 27648
  106. T AW 10
  107. // Check DAC_B
  108. // The magic value is checked by the fake PiXtend-Spidev module
  109. L 2764
  110. T AW 12
  111. END_FUNCTION
  112. // PWM output tests
  113. FUNCTION FC 5 : VOID
  114. BEGIN
  115. // Set PWM0
  116. // The magic value is checked by the fake PiXtend-Spidev module
  117. L W#16#1234
  118. T AW 20
  119. // Set PWM1
  120. // The magic value is checked by the fake PiXtend-Spidev module
  121. L W#16#4321
  122. T AW 22
  123. END_FUNCTION
  124. ORGANIZATION_BLOCK OB 1
  125. BEGIN
  126. // This test only works with the fake PiXtend-Spidev module
  127. CALL FC 1 // Test DI/DO
  128. CALL FC 2 // Test GPIOs
  129. CALL FC 3 // Test analog inputs
  130. CALL FC 4 // Test analog outputs
  131. CALL FC 5 // Test PWMs
  132. // If we ran 256 test cycles then exit.
  133. L MW 100
  134. + 1
  135. T MW 100
  136. L 256
  137. <I
  138. BEB
  139. CALL SFC 46 // Exit test; Stop CPU.
  140. END_ORGANIZATION_BLOCK
  141. ORGANIZATION_BLOCK OB 100
  142. BEGIN
  143. L 0
  144. T AB 1
  145. T AB 2
  146. T MW 100
  147. CALL FC 4 // Init analog outputs
  148. CALL FC 5 // Init PWMs
  149. END_ORGANIZATION_BLOCK
  150. ]]></source>
  151. </language_awl>
  152. <!-- Symbol table configuration -->
  153. <symbols>
  154. <!-- symbol table source code -->
  155. <source enabled="1"
  156. name="Main table"
  157. type="3"><![CDATA[
  158. ]]></source>
  159. </symbols>
  160. <!-- Core server link configuration -->
  161. <core_link>
  162. <!-- Locally spawned core server -->
  163. <spawn_local enable="1"
  164. interpreters="$DEFAULT"
  165. port_range_begin="4183"
  166. port_range_end="8278" />
  167. <!-- Remote server connection -->
  168. <connect host="localhost"
  169. port="4151"
  170. timeout_ms="3000" />
  171. <!-- Transport tunnel -->
  172. <tunnel local_port="-1"
  173. type="0">
  174. <ssh executable="ssh"
  175. port="22"
  176. user="pi" />
  177. </tunnel>
  178. </core_link>
  179. <!-- Hardware modules configuration -->
  180. <hardware>
  181. <!-- Loaded hardware module -->
  182. <module name="pixtend">
  183. <params>
  184. <param name="analogIn0_10V"
  185. value="True" />
  186. <param name="analogIn0_addr"
  187. value="IW 10" />
  188. <param name="analogIn0_nos"
  189. value="10" />
  190. <param name="analogIn1_10V"
  191. value="True" />
  192. <param name="analogIn1_addr"
  193. value="IW 12" />
  194. <param name="analogIn1_nos"
  195. value="10" />
  196. <param name="analogIn2_addr"
  197. value="IW 14" />
  198. <param name="analogIn2_nos"
  199. value="10" />
  200. <param name="analogIn3_addr"
  201. value="IW 16" />
  202. <param name="analogIn3_nos"
  203. value="10" />
  204. <param name="analogIn_kHz"
  205. value="125" />
  206. <param name="analogOut0_addr"
  207. value="AW 10" />
  208. <param name="analogOut1_addr"
  209. value="AW 12" />
  210. <param name="boardType"
  211. value="v1.x" />
  212. <param name="digitalIn0_addr"
  213. value="I 1.0" />
  214. <param name="digitalIn1_addr"
  215. value="I 1.1" />
  216. <param name="digitalIn2_addr"
  217. value="I 1.2" />
  218. <param name="digitalIn3_addr"
  219. value="I 1.3" />
  220. <param name="digitalIn4_addr"
  221. value="I 1.4" />
  222. <param name="digitalIn5_addr"
  223. value="I 1.5" />
  224. <param name="digitalIn6_addr"
  225. value="I 1.6" />
  226. <param name="digitalIn7_addr"
  227. value="I 1.7" />
  228. <param name="digitalOut0_addr"
  229. value="Q1.0" />
  230. <param name="digitalOut1_addr"
  231. value="Q1.1" />
  232. <param name="digitalOut2_addr"
  233. value="Q1.2" />
  234. <param name="digitalOut3_addr"
  235. value="Q1.3" />
  236. <param name="digitalOut4_addr"
  237. value="Q1.4" />
  238. <param name="digitalOut5_addr"
  239. value="Q1.5" />
  240. <param name="enabled"
  241. value="True" />
  242. <param name="gpio0_addr"
  243. value="I 2.0" />
  244. <param name="gpio0_hum_addr" />
  245. <param name="gpio0_mode"
  246. value="GPIO" />
  247. <param name="gpio0_pullup"
  248. value="False" />
  249. <param name="gpio0_temp_addr" />
  250. <param name="gpio1_addr"
  251. value="Q 2.0" />
  252. <param name="gpio1_hum_addr" />
  253. <param name="gpio1_mode"
  254. value="GPIO" />
  255. <param name="gpio1_pullup"
  256. value="False" />
  257. <param name="gpio1_temp_addr" />
  258. <param name="gpio2_addr" />
  259. <param name="gpio2_hum_addr" />
  260. <param name="gpio2_mode"
  261. value="GPIO" />
  262. <param name="gpio2_pullup"
  263. value="False" />
  264. <param name="gpio2_temp_addr" />
  265. <param name="gpio3_addr" />
  266. <param name="gpio3_hum_addr" />
  267. <param name="gpio3_mode"
  268. value="GPIO" />
  269. <param name="gpio3_pullup"
  270. value="False" />
  271. <param name="gpio3_temp_addr" />
  272. <param name="inputAddressBase"
  273. value="0" />
  274. <param name="outputAddressBase"
  275. value="0" />
  276. <param name="pollIntMs"
  277. value="25" />
  278. <param name="pwm0A_addr"
  279. value="AW 20" />
  280. <param name="pwm0B_addr"
  281. value="AW 22" />
  282. <param name="pwm0_baseFreqHz"
  283. value="16000000" />
  284. <param name="pwm0_mode"
  285. value="dutycycle" />
  286. <param name="pwm0_period"
  287. value="65000" />
  288. <param name="pwm1A_addr" />
  289. <param name="pwm1B_addr" />
  290. <param name="pwm1_baseFreqHz"
  291. value="0" />
  292. <param name="pwm1_mode"
  293. value="dutycycle" />
  294. <param name="pwm1_period" />
  295. <param name="pwm_servoMode"
  296. value="False" />
  297. <param name="relay0_addr"
  298. value="Q 0.0" />
  299. <param name="relay1_addr"
  300. value="Q 0.1" />
  301. <param name="relay2_addr"
  302. value="Q 0.2" />
  303. <param name="relay3_addr"
  304. value="Q 0.3" />
  305. <param name="rs485"
  306. value="True" />
  307. <param name="testMode"
  308. value="True" />
  309. </params>
  310. </module>
  311. </hardware>
  312. <!-- Graphical user interface configuration -->
  313. <gui>
  314. <editor autoindent="1"
  315. paste_autoindent="1"
  316. validation="1" />
  317. </gui>
  318. </awlsim_project>