array.awl 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. DATA_BLOCK DB 99
  2. TITLE = Main data block
  3. VERSION : 0.1
  4. STRUCT
  5. VAR0 : ARRAY [1 .. 2] OF INT;
  6. VAR1 : ARRAY [1 .. 2] OF INT := 1, 2;
  7. VAR2 : ARRAY [1 .. 2, 1 .. 2] OF INT := 1, 2, 3, 4;
  8. VAR3 : ARRAY [-2 .. -1] OF INT := -2, -1;
  9. VAR4 : ARRAY [1 .. 2, 1 .. 2, 1 .. 2, 1 .. 2, 1 .. 2, 1 .. 2] OF INT := 4 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
  10. VAR5 : ARRAY [0 .. 9 ] OF INT := 5 (1, 2);
  11. VAR6 : ARRAY [1 .. 2, 1 .. 10, 1 .. 5 ] OF INT := 5 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20);
  12. VAR7 : ARRAY [1 .. 14 ] OF BOOL := 7 (TRUE, FALSE);
  13. VAR8 : ARRAY [1 .. 3 ] OF BOOL := TRUE, FALSE, TRUE;
  14. VAR9 : ARRAY [1 .. 1 ] OF INT := 42;
  15. END_STRUCT;
  16. BEGIN
  17. VAR0[1] := 0;
  18. VAR0[2] := 0;
  19. VAR1[1] := -30000;
  20. VAR1[2] := 30000;
  21. // Do not write VAR2 here.
  22. // Keep the default startup values from the declaration.
  23. VAR3[-2] := -2;
  24. VAR3[-1] := -1;
  25. VAR4[1, 1, 1, 1, 1, 1] := 1;
  26. VAR4[1, 1, 1, 1, 1, 2] := 2;
  27. VAR4[1, 1, 1, 1, 2, 1] := 3;
  28. VAR4[1, 1, 1, 1, 2, 2] := 4;
  29. VAR4[1, 1, 1, 2, 1, 1] := 5;
  30. VAR4[1, 1, 1, 2, 1, 2] := 6;
  31. VAR4[1, 1, 1, 2, 2, 1] := 7;
  32. VAR4[1, 1, 1, 2, 2, 2] := 8;
  33. VAR4[1, 1, 2, 1, 1, 1] := 9;
  34. VAR4[1, 1, 2, 1, 1, 2] := 10;
  35. VAR4[1, 1, 2, 1, 2, 1] := 11;
  36. VAR4[1, 1, 2, 1, 2, 2] := 12;
  37. VAR4[1, 1, 2, 2, 1, 1] := 13;
  38. VAR4[1, 1, 2, 2, 1, 2] := 14;
  39. VAR4[1, 1, 2, 2, 2, 1] := 15;
  40. VAR4[1, 1, 2, 2, 2, 2] := 16;
  41. VAR4[1, 2, 1, 1, 1, 1] := 1;
  42. VAR4[1, 2, 1, 1, 1, 2] := 2;
  43. VAR4[1, 2, 1, 1, 2, 1] := 3;
  44. VAR4[1, 2, 1, 1, 2, 2] := 4;
  45. VAR4[1, 2, 1, 2, 1, 1] := 5;
  46. VAR4[1, 2, 1, 2, 1, 2] := 6;
  47. VAR4[1, 2, 1, 2, 2, 1] := 7;
  48. VAR4[1, 2, 1, 2, 2, 2] := 8;
  49. VAR4[1, 2, 2, 1, 1, 1] := 9;
  50. VAR4[1, 2, 2, 1, 1, 2] := 10;
  51. VAR4[1, 2, 2, 1, 2, 1] := 11;
  52. VAR4[1, 2, 2, 1, 2, 2] := 12;
  53. VAR4[1, 2, 2, 2, 1, 1] := 13;
  54. VAR4[1, 2, 2, 2, 1, 2] := 14;
  55. VAR4[1, 2, 2, 2, 2, 1] := 15;
  56. VAR4[1, 2, 2, 2, 2, 2] := 16;
  57. VAR4[2, 1, 1, 1, 1, 1] := 1;
  58. VAR4[2, 1, 1, 1, 1, 2] := 2;
  59. VAR4[2, 1, 1, 1, 2, 1] := 3;
  60. VAR4[2, 1, 1, 1, 2, 2] := 4;
  61. VAR4[2, 1, 1, 2, 1, 1] := 5;
  62. VAR4[2, 1, 1, 2, 1, 2] := 6;
  63. VAR4[2, 1, 1, 2, 2, 1] := 7;
  64. VAR4[2, 1, 1, 2, 2, 2] := 8;
  65. VAR4[2, 1, 2, 1, 1, 1] := 9;
  66. VAR4[2, 1, 2, 1, 1, 2] := 10;
  67. VAR4[2, 1, 2, 1, 2, 1] := 11;
  68. VAR4[2, 1, 2, 1, 2, 2] := 12;
  69. VAR4[2, 1, 2, 2, 1, 1] := 13;
  70. VAR4[2, 1, 2, 2, 1, 2] := 14;
  71. VAR4[2, 1, 2, 2, 2, 1] := 15;
  72. VAR4[2, 1, 2, 2, 2, 2] := 16;
  73. VAR4[2, 2, 1, 1, 1, 1] := 1;
  74. VAR4[2, 2, 1, 1, 1, 2] := 2;
  75. VAR4[2, 2, 1, 1, 2, 1] := 3;
  76. VAR4[2, 2, 1, 1, 2, 2] := 4;
  77. VAR4[2, 2, 1, 2, 1, 1] := 5;
  78. VAR4[2, 2, 1, 2, 1, 2] := 6;
  79. VAR4[2, 2, 1, 2, 2, 1] := 7;
  80. VAR4[2, 2, 1, 2, 2, 2] := 8;
  81. VAR4[2, 2, 2, 1, 1, 1] := 9;
  82. VAR4[2, 2, 2, 1, 1, 2] := 10;
  83. VAR4[2, 2, 2, 1, 2, 1] := 11;
  84. VAR4[2, 2, 2, 1, 2, 2] := 12;
  85. VAR4[2, 2, 2, 2, 1, 1] := 13;
  86. VAR4[2, 2, 2, 2, 1, 2] := 14;
  87. VAR4[2, 2, 2, 2, 2, 1] := 15;
  88. VAR4[2, 2, 2, 2, 2, 2] := 16;
  89. VAR5[0] := 1;
  90. VAR5[1] := 2;
  91. VAR5[2] := 1;
  92. VAR5[3] := 2;
  93. VAR5[4] := 1;
  94. VAR5[5] := 2;
  95. VAR5[6] := 1;
  96. VAR5[7] := 2;
  97. VAR5[8] := 1;
  98. VAR5[9] := 2;
  99. VAR6[1, 1, 1] := 1;
  100. VAR6[1, 1, 2] := 2;
  101. VAR6[1, 1, 3] := 3;
  102. VAR6[1, 1, 4] := 4;
  103. VAR6[1, 1, 5] := 5;
  104. VAR6[1, 2, 1] := 6;
  105. VAR6[1, 2, 2] := 7;
  106. VAR6[1, 2, 3] := 8;
  107. VAR6[1, 2, 4] := 9;
  108. VAR6[1, 2, 5] := 10;
  109. VAR6[1, 3, 1] := 11;
  110. VAR6[1, 3, 2] := 12;
  111. VAR6[1, 3, 3] := 13;
  112. VAR6[1, 3, 4] := 14;
  113. VAR6[1, 3, 5] := 15;
  114. VAR6[1, 4, 1] := 16;
  115. VAR6[1, 4, 2] := 17;
  116. VAR6[1, 4, 3] := 18;
  117. VAR6[1, 4, 4] := 19;
  118. VAR6[1, 4, 5] := 20;
  119. VAR6[1, 5, 1] := 1;
  120. VAR6[1, 5, 2] := 2;
  121. VAR6[1, 5, 3] := 3;
  122. VAR6[1, 5, 4] := 4;
  123. VAR6[1, 5, 5] := 5;
  124. VAR6[1, 6, 1] := 6;
  125. VAR6[1, 6, 2] := 7;
  126. VAR6[1, 6, 3] := 8;
  127. VAR6[1, 6, 4] := 9;
  128. VAR6[1, 6, 5] := 10;
  129. VAR6[1, 7, 1] := 11;
  130. VAR6[1, 7, 2] := 12;
  131. VAR6[1, 7, 3] := 13;
  132. VAR6[1, 7, 4] := 14;
  133. VAR6[1, 7, 5] := 15;
  134. VAR6[1, 8, 1] := 16;
  135. VAR6[1, 8, 2] := 17;
  136. VAR6[1, 8, 3] := 18;
  137. VAR6[1, 8, 4] := 19;
  138. VAR6[1, 8, 5] := 20;
  139. VAR6[1, 9, 1] := 1;
  140. VAR6[1, 9, 2] := 2;
  141. VAR6[1, 9, 3] := 3;
  142. VAR6[1, 9, 4] := 4;
  143. VAR6[1, 9, 5] := 5;
  144. VAR6[1, 10, 1] := 6;
  145. VAR6[1, 10, 2] := 7;
  146. VAR6[1, 10, 3] := 8;
  147. VAR6[1, 10, 4] := 9;
  148. VAR6[1, 10, 5] := 10;
  149. VAR6[2, 1, 1] := 11;
  150. VAR6[2, 1, 2] := 12;
  151. VAR6[2, 1, 3] := 13;
  152. VAR6[2, 1, 4] := 14;
  153. VAR6[2, 1, 5] := 15;
  154. VAR6[2, 2, 1] := 16;
  155. VAR6[2, 2, 2] := 17;
  156. VAR6[2, 2, 3] := 18;
  157. VAR6[2, 2, 4] := 19;
  158. VAR6[2, 2, 5] := 20;
  159. VAR6[2, 3, 1] := 1;
  160. VAR6[2, 3, 2] := 2;
  161. VAR6[2, 3, 3] := 3;
  162. VAR6[2, 3, 4] := 4;
  163. VAR6[2, 3, 5] := 5;
  164. VAR6[2, 4, 1] := 6;
  165. VAR6[2, 4, 2] := 7;
  166. VAR6[2, 4, 3] := 8;
  167. VAR6[2, 4, 4] := 9;
  168. VAR6[2, 4, 5] := 10;
  169. VAR6[2, 5, 1] := 11;
  170. VAR6[2, 5, 2] := 12;
  171. VAR6[2, 5, 3] := 13;
  172. VAR6[2, 5, 4] := 14;
  173. VAR6[2, 5, 5] := 15;
  174. VAR6[2, 6, 1] := 16;
  175. VAR6[2, 6, 2] := 17;
  176. VAR6[2, 6, 3] := 18;
  177. VAR6[2, 6, 4] := 19;
  178. VAR6[2, 6, 5] := 20;
  179. VAR6[2, 7, 1] := 1;
  180. VAR6[2, 7, 2] := 2;
  181. VAR6[2, 7, 3] := 3;
  182. VAR6[2, 7, 4] := 4;
  183. VAR6[2, 7, 5] := 5;
  184. VAR6[2, 8, 1] := 6;
  185. VAR6[2, 8, 2] := 7;
  186. VAR6[2, 8, 3] := 8;
  187. VAR6[2, 8, 4] := 9;
  188. VAR6[2, 8, 5] := 10;
  189. VAR6[2, 9, 1] := 11;
  190. VAR6[2, 9, 2] := 12;
  191. VAR6[2, 9, 3] := 13;
  192. VAR6[2, 9, 4] := 14;
  193. VAR6[2, 9, 5] := 15;
  194. VAR6[2, 10, 1] := 16;
  195. VAR6[2, 10, 2] := 17;
  196. VAR6[2, 10, 3] := 18;
  197. VAR6[2, 10, 4] := 19;
  198. VAR6[2, 10, 5] := 20;
  199. VAR7[1] := TRUE;
  200. VAR7[2] := FALSE;
  201. VAR7[3] := TRUE;
  202. VAR7[4] := FALSE;
  203. VAR7[5] := TRUE;
  204. VAR7[6] := FALSE;
  205. VAR7[7] := TRUE;
  206. VAR7[8] := FALSE;
  207. VAR7[9] := TRUE;
  208. VAR7[10] := FALSE;
  209. VAR7[11] := TRUE;
  210. VAR7[12] := FALSE;
  211. VAR7[13] := TRUE;
  212. VAR7[14] := FALSE;
  213. VAR8[1] := TRUE;
  214. VAR8[2] := FALSE;
  215. VAR8[3] := TRUE;
  216. VAR9[1] := 42;
  217. END_DATA_BLOCK
  218. FUNCTION FC 1 : VOID
  219. VAR_INPUT
  220. VAR00 : ARRAY [1 .. 2] OF INT;
  221. VAR01 : ARRAY [1 .. 2, 0 .. 1] OF INT;
  222. SELECT : INT;
  223. END_VAR
  224. VAR_OUTPUT
  225. VAROUT : ARRAY [1 .. 2] OF DINT;
  226. END_VAR
  227. VAR_TEMP
  228. DBNR : INT;
  229. END_VAR
  230. BEGIN
  231. // Only run tests for SELECT=1
  232. L #SELECT
  233. L 1
  234. <>I
  235. BEB
  236. // Check passed parameters
  237. L #VAR00[1]
  238. __ASSERT== __ACCU 1, 91
  239. L #VAR00[2]
  240. __ASSERT== __ACCU 1, 92
  241. L #VAR01[1, 0]
  242. __ASSERT== __ACCU 1, 9100
  243. L #VAR01[1, 1]
  244. __ASSERT== __ACCU 1, 9101
  245. L #VAR01[2, 0]
  246. __ASSERT== __ACCU 1, 9102
  247. L #VAR01[2, 1]
  248. __ASSERT== __ACCU 1, 9103
  249. L P##VAR00 // Ptr to array name is ptr to DB-ptr.
  250. LAR1
  251. UD DW#16#FF000000
  252. __ASSERT== __ACCU 1, DW#16#87000000
  253. L W [AR1, P#0.0]
  254. T #DBNR
  255. AUF DB [#DBNR]
  256. L D [AR1, P#2.0]
  257. LAR1
  258. L W [AR1, P#0.0]
  259. __ASSERT== __ACCU 1, 91
  260. // Forward FC-parameter to FB
  261. CALL FB 2, DB 10 (
  262. VAR0 := #VAR00,
  263. )
  264. // Write the output
  265. L L#90001
  266. T #VAROUT[1]
  267. L L#90002
  268. T #VAROUT[2]
  269. END_FUNCTION
  270. FUNCTION_BLOCK FB 1
  271. VAR_INPUT
  272. VAR0 : ARRAY [1 .. 2] OF INT;
  273. VAR1 : ARRAY [1 .. 2, 0 .. 1] OF INT;
  274. VARBOOL : ARRAY [1 .. 10] OF BOOL;
  275. SELECT : INT;
  276. END_VAR
  277. VAR_OUTPUT
  278. VAROUT : ARRAY [1 .. 2] OF DINT;
  279. END_VAR
  280. BEGIN
  281. L #SELECT
  282. SPL ERR
  283. SPA M000
  284. SPA M001
  285. ERR: __ASSERT== 1, 2 // Wrong #SELECT
  286. // Check instance-DB initial values
  287. M000: L #VAR0[1]
  288. __ASSERT== __ACCU 1, 1
  289. L DIW 0
  290. __ASSERT== __ACCU 1, 1
  291. L #VAR0[2]
  292. __ASSERT== __ACCU 1, 2
  293. L DIW 2
  294. __ASSERT== __ACCU 1, 2
  295. L #VAR1[1, 0]
  296. __ASSERT== __ACCU 1, 100
  297. L DIW 4
  298. __ASSERT== __ACCU 1, 100
  299. L #VAR1[1, 1]
  300. __ASSERT== __ACCU 1, 101
  301. L DIW 6
  302. __ASSERT== __ACCU 1, 101
  303. L #VAR1[2, 0]
  304. __ASSERT== __ACCU 1, 102
  305. L DIW 8
  306. __ASSERT== __ACCU 1, 102
  307. L #VAR1[2, 1]
  308. __ASSERT== __ACCU 1, 103
  309. L DIW 10
  310. __ASSERT== __ACCU 1, 103
  311. U #VARBOOL[2]
  312. U #VARBOOL[3]
  313. U #VARBOOL[5]
  314. U #VARBOOL[8]
  315. U #VARBOOL[9]
  316. __ASSERT== __STW VKE, 1
  317. O #VARBOOL[1]
  318. O #VARBOOL[4]
  319. O #VARBOOL[6]
  320. O #VARBOOL[7]
  321. O #VARBOOL[10]
  322. __ASSERT== __STW VKE, 0
  323. L DIW 12
  324. __ASSERT== __ACCU 1, W#16#9601
  325. L P##VAR0 // Ptr to array name is ptr to first element
  326. __ASSERT== __ACCU 1, DW#16#85000000
  327. LAR1
  328. L W [AR1, P#0.0]
  329. __ASSERT== __ACCU 1, 1
  330. SPA M500
  331. // Check passed parameters
  332. M001: L #VAR0[1]
  333. __ASSERT== __ACCU 1, 91
  334. L DIW 0
  335. __ASSERT== __ACCU 1, 91
  336. L #VAR0[2]
  337. __ASSERT== __ACCU 1, 92
  338. L DIW 2
  339. __ASSERT== __ACCU 1, 92
  340. L #VAR1[1, 0]
  341. __ASSERT== __ACCU 1, 9100
  342. L DIW 4
  343. __ASSERT== __ACCU 1, 9100
  344. L #VAR1[1, 1]
  345. __ASSERT== __ACCU 1, 9101
  346. L DIW 6
  347. __ASSERT== __ACCU 1, 9101
  348. L #VAR1[2, 0]
  349. __ASSERT== __ACCU 1, 9102
  350. L DIW 8
  351. __ASSERT== __ACCU 1, 9102
  352. L #VAR1[2, 1]
  353. __ASSERT== __ACCU 1, 9103
  354. L DIW 10
  355. __ASSERT== __ACCU 1, 9103
  356. U #VARBOOL[1]
  357. U #VARBOOL[4]
  358. U #VARBOOL[6]
  359. U #VARBOOL[7]
  360. U #VARBOOL[10]
  361. __ASSERT== __STW VKE, 1
  362. O #VARBOOL[2]
  363. O #VARBOOL[3]
  364. O #VARBOOL[5]
  365. O #VARBOOL[8]
  366. O #VARBOOL[9]
  367. __ASSERT== __STW VKE, 0
  368. L DIW 12
  369. __ASSERT== __ACCU 1, W#16#6902
  370. L P##VAR0 // Ptr to array name is ptr to first element
  371. __ASSERT== __ACCU 1, DW#16#85000000
  372. LAR1
  373. L W [AR1, P#0.0]
  374. __ASSERT== __ACCU 1, 91
  375. SPA M500
  376. // Call FC 1 and forward array parameters
  377. M500: CALL FC 1 (
  378. VAR00 := #VAR0,
  379. VAR01 := #VAR1,
  380. SELECT := #SELECT,
  381. VAROUT := #VAROUT,
  382. )
  383. END_FUNCTION_BLOCK
  384. DATA_BLOCK DB 1
  385. TITLE = FB 1 instance DB
  386. FB 1
  387. BEGIN
  388. VAR0[1] := 1;
  389. VAR0[2] := 2;
  390. VAR1[1, 0] := 100;
  391. VAR1[1, 1] := 101;
  392. VAR1[2, 0] := 102;
  393. VAR1[2, 1] := 103;
  394. SELECT := 0;
  395. VARBOOL[1] := FALSE;
  396. VARBOOL[2] := TRUE;
  397. VARBOOL[3] := TRUE;
  398. VARBOOL[4] := FALSE;
  399. VARBOOL[5] := TRUE;
  400. VARBOOL[6] := FALSE;
  401. VARBOOL[7] := FALSE;
  402. VARBOOL[8] := TRUE;
  403. VARBOOL[9] := TRUE;
  404. VARBOOL[10] := FALSE;
  405. END_DATA_BLOCK
  406. FUNCTION_BLOCK FB 2
  407. VAR_INPUT
  408. VAR0 : ARRAY [1 .. 2] OF INT;
  409. END_VAR
  410. BEGIN
  411. L #VAR0[1]
  412. __ASSERT== __ACCU 1, 91
  413. L #VAR0[2]
  414. __ASSERT== __ACCU 1, 92
  415. END_FUNCTION_BLOCK
  416. DATA_BLOCK DB 10
  417. TITLE = FB 2 instance DB
  418. FB 2
  419. BEGIN
  420. VAR0[1] := 0;
  421. VAR0[2] := 0;
  422. END_DATA_BLOCK
  423. DATA_BLOCK DB 2
  424. TITLE = Parameter passing DB
  425. STRUCT
  426. VAR0 : ARRAY [1 .. 2] OF INT;
  427. VAR1 : ARRAY [1 .. 2, 0 .. 1] OF INT;
  428. VAR2 : ARRAY [1 .. 2] OF DINT;
  429. VAR3 : ARRAY [1 .. 10] OF BOOL;
  430. END_STRUCT;
  431. BEGIN
  432. VAR0[1] := 91;
  433. VAR0[2] := 92;
  434. VAR1[1, 0] := 9100;
  435. VAR1[1, 1] := 9101;
  436. VAR1[2, 0] := 9102;
  437. VAR1[2, 1] := 9103;
  438. VAR2[1] := L#0;
  439. VAR2[2] := L#0;
  440. VAR3[1] := TRUE;
  441. VAR3[2] := FALSE;
  442. VAR3[3] := FALSE;
  443. VAR3[4] := TRUE;
  444. VAR3[5] := FALSE;
  445. VAR3[6] := TRUE;
  446. VAR3[7] := TRUE;
  447. VAR3[8] := FALSE;
  448. VAR3[9] := FALSE;
  449. VAR3[10] := TRUE;
  450. END_DATA_BLOCK
  451. ORGANIZATION_BLOCK OB 1
  452. BEGIN
  453. // Check DB99 initial values
  454. L DB99.VAR0[1]
  455. __ASSERT== __ACCU 1, 0
  456. L DB99.DBW 0
  457. __ASSERT== __ACCU 1, 0
  458. L DB99.VAR0[2]
  459. __ASSERT== __ACCU 1, 0
  460. L DB99.DBW 2
  461. __ASSERT== __ACCU 1, 0
  462. L DB99.VAR1[1]
  463. __ASSERT== __ACCU 1, -30000
  464. L DB99.DBW 4
  465. __ASSERT== __ACCU 1, -30000
  466. L DB99.VAR1[2]
  467. __ASSERT== __ACCU 1, 30000
  468. L DB99.DBW 6
  469. __ASSERT== __ACCU 1, 30000
  470. L DB99.VAR2[1, 1]
  471. __ASSERT== __ACCU 1, 1
  472. L DB99.DBW 8
  473. __ASSERT== __ACCU 1, 1
  474. L DB99.VAR2[1, 2]
  475. __ASSERT== __ACCU 1, 2
  476. L DB99.DBW 10
  477. __ASSERT== __ACCU 1, 2
  478. L DB99.VAR2[2, 1]
  479. __ASSERT== __ACCU 1, 3
  480. L DB99.DBW 12
  481. __ASSERT== __ACCU 1, 3
  482. L DB99.VAR2[2, 2]
  483. __ASSERT== __ACCU 1, 4
  484. L DB99.DBW 14
  485. __ASSERT== __ACCU 1, 4
  486. // Call FB 1 without array parameter passing
  487. CALL FB 1, DB 1 (
  488. SELECT := 0,
  489. )
  490. // Call FB 1 with array parameter passing
  491. L 0
  492. T DB2.VAR2[1]
  493. T DB2.VAR2[2]
  494. CALL FB 1, DB 1 (
  495. VAR0 := DB2.VAR0,
  496. VAR1 := DB2.VAR1,
  497. VARBOOL := DB2.VAR3,
  498. SELECT := 1,
  499. VAROUT := DB2.VAR2,
  500. )
  501. L DB2.VAR2[1]
  502. __ASSERT== __ACCU 1, L#90001
  503. L DB2.VAR2[2]
  504. __ASSERT== __ACCU 1, L#90002
  505. // Call FC 1 with array parameter passing
  506. L 0
  507. T DB2.VAR2[1]
  508. T DB2.VAR2[2]
  509. CALL FC 1 (
  510. VAR00 := DB2.VAR0,
  511. VAR01 := DB2.VAR1,
  512. SELECT := 1,
  513. VAROUT := DB2.VAR2,
  514. )
  515. L DB2.VAR2[1]
  516. __ASSERT== __ACCU 1, L#90001
  517. L DB2.VAR2[2]
  518. __ASSERT== __ACCU 1, L#90002
  519. CALL SFC 46 // STOP CPU
  520. END_ORGANIZATION_BLOCK