pixtend2-iotest.awlpro 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  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.334763"
  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="102"
  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 & 0x0F) | (((AB1 ^ 0x0F) & 0x0F) << 4))
  40. L AB 1
  41. UW W#16#0F
  42. L AB 1
  43. XOW W#16#0F
  44. UW W#16#0F
  45. SLW 4
  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. END_FUNCTION
  90. // Analog output tests
  91. FUNCTION FC 4 : VOID
  92. BEGIN
  93. // Check DAC_A
  94. // The magic value is checked by the fake PiXtend-Spidev module
  95. L 27648
  96. T AW 10
  97. // Check DAC_B
  98. // The magic value is checked by the fake PiXtend-Spidev module
  99. L 2764
  100. T AW 12
  101. END_FUNCTION
  102. // PWM output tests
  103. FUNCTION FC 5 : VOID
  104. BEGIN
  105. // Set PWM0
  106. // The magic value is checked by the fake PiXtend-Spidev module
  107. L W#16#1234
  108. T AW 20
  109. // Set PWM1
  110. // The magic value is checked by the fake PiXtend-Spidev module
  111. L W#16#4321
  112. T AW 22
  113. END_FUNCTION
  114. ORGANIZATION_BLOCK OB 1
  115. BEGIN
  116. // This test only works with the fake PiXtend-Spidev module
  117. CALL FC 1 // Test DI/DO
  118. CALL FC 2 // Test GPIOs
  119. CALL FC 3 // Test analog inputs
  120. CALL FC 4 // Test analog outputs
  121. CALL FC 5 // Test PWMs
  122. // If we ran 50 test cycles then exit.
  123. L MW 100
  124. + 1
  125. T MW 100
  126. L 50
  127. <I
  128. BEB
  129. CALL SFC 46 // Exit test; Stop CPU.
  130. END_ORGANIZATION_BLOCK
  131. ORGANIZATION_BLOCK OB 100
  132. BEGIN
  133. L 0
  134. T AB 1
  135. T AB 2
  136. T MW 100
  137. CALL FC 4 // Init analog outputs
  138. CALL FC 5 // Init PWMs
  139. END_ORGANIZATION_BLOCK
  140. ]]></source>
  141. </language_awl>
  142. <!-- Symbol table configuration -->
  143. <symbols>
  144. <!-- symbol table source code -->
  145. <source enabled="1"
  146. name="Main table"
  147. type="3"><![CDATA[
  148. ]]></source>
  149. </symbols>
  150. <!-- Core server link configuration -->
  151. <core_link>
  152. <!-- Locally spawned core server -->
  153. <spawn_local enable="1"
  154. interpreters="$DEFAULT"
  155. port_range_begin="4183"
  156. port_range_end="8278" />
  157. <!-- Remote server connection -->
  158. <connect host="localhost"
  159. port="4151"
  160. timeout_ms="3000" />
  161. <!-- Transport tunnel -->
  162. <tunnel local_port="-1"
  163. type="0">
  164. <ssh executable="ssh"
  165. port="22"
  166. user="pi" />
  167. </tunnel>
  168. </core_link>
  169. <!-- Hardware modules configuration -->
  170. <hardware>
  171. <!-- Loaded hardware module -->
  172. <module name="pixtend">
  173. <params>
  174. <param name="analogIn0_10V"
  175. value="True" />
  176. <param name="analogIn0_addr"
  177. value="IW 10" />
  178. <param name="analogIn0_nos"
  179. value="10" />
  180. <param name="analogIn1_10V"
  181. value="True" />
  182. <param name="analogIn1_addr"
  183. value="IW 12" />
  184. <param name="analogIn1_nos"
  185. value="10" />
  186. <param name="analogIn2_addr" />
  187. <param name="analogIn2_nos"
  188. value="10" />
  189. <param name="analogIn3_addr" />
  190. <param name="analogIn3_nos"
  191. value="10" />
  192. <param name="analogIn_kHz"
  193. value="125" />
  194. <param name="analogOut0_addr"
  195. value="AW 10" />
  196. <param name="analogOut1_addr"
  197. value="AW 12" />
  198. <param name="boardType"
  199. value="v2.x" />
  200. <param name="digitalIn0_addr"
  201. value="I 1.0" />
  202. <param name="digitalIn1_addr"
  203. value="I 1.1" />
  204. <param name="digitalIn2_addr"
  205. value="I 1.2" />
  206. <param name="digitalIn3_addr"
  207. value="I 1.3" />
  208. <param name="digitalIn4_addr"
  209. value="I 1.4" />
  210. <param name="digitalIn5_addr"
  211. value="I 1.5" />
  212. <param name="digitalIn6_addr"
  213. value="I 1.6" />
  214. <param name="digitalIn7_addr"
  215. value="I 1.7" />
  216. <param name="digitalOut0_addr"
  217. value="Q1.0" />
  218. <param name="digitalOut1_addr"
  219. value="Q1.1" />
  220. <param name="digitalOut2_addr"
  221. value="Q1.2" />
  222. <param name="digitalOut3_addr"
  223. value="Q1.3" />
  224. <param name="digitalOut4_addr" />
  225. <param name="digitalOut5_addr" />
  226. <param name="enabled"
  227. value="True" />
  228. <param name="gpio0_addr"
  229. value="I 2.0" />
  230. <param name="gpio0_hum_addr" />
  231. <param name="gpio0_mode"
  232. value="GPIO" />
  233. <param name="gpio0_pullup"
  234. value="False" />
  235. <param name="gpio0_temp_addr" />
  236. <param name="gpio1_addr"
  237. value="Q 2.0" />
  238. <param name="gpio1_hum_addr" />
  239. <param name="gpio1_mode"
  240. value="GPIO" />
  241. <param name="gpio1_pullup"
  242. value="False" />
  243. <param name="gpio1_temp_addr" />
  244. <param name="gpio2_addr" />
  245. <param name="gpio2_hum_addr" />
  246. <param name="gpio2_mode"
  247. value="GPIO" />
  248. <param name="gpio2_pullup"
  249. value="False" />
  250. <param name="gpio2_temp_addr" />
  251. <param name="gpio3_addr" />
  252. <param name="gpio3_hum_addr" />
  253. <param name="gpio3_mode"
  254. value="GPIO" />
  255. <param name="gpio3_pullup"
  256. value="False" />
  257. <param name="gpio3_temp_addr" />
  258. <param name="inputAddressBase"
  259. value="0" />
  260. <param name="outputAddressBase"
  261. value="0" />
  262. <param name="pollIntMs"
  263. value="2.5" />
  264. <param name="pwm0A_addr"
  265. value="AW 20" />
  266. <param name="pwm0B_addr"
  267. value="AW 22" />
  268. <param name="pwm0_baseFreqHz"
  269. value="16000000" />
  270. <param name="pwm0_mode"
  271. value="dutycycle" />
  272. <param name="pwm0_period"
  273. value="65000" />
  274. <param name="pwm1A_addr" />
  275. <param name="pwm1B_addr" />
  276. <param name="pwm1_baseFreqHz"
  277. value="0" />
  278. <param name="pwm1_mode"
  279. value="dutycycle" />
  280. <param name="pwm1_period" />
  281. <param name="relay0_addr"
  282. value="Q 0.0" />
  283. <param name="relay1_addr"
  284. value="Q 0.1" />
  285. <param name="relay2_addr"
  286. value="Q 0.2" />
  287. <param name="relay3_addr"
  288. value="Q 0.3" />
  289. <param name="rs485"
  290. value="False" />
  291. <param name="testMode"
  292. value="True" />
  293. </params>
  294. </module>
  295. </hardware>
  296. <!-- Graphical user interface configuration -->
  297. <gui>
  298. <editor autoindent="1"
  299. paste_autoindent="1"
  300. validation="1" />
  301. </gui>
  302. </awlsim_project>