6/9/2010 8:57 PM | |
Posts: 35 Rating: (0) |
Good Woork but what is this doing: Tmp2:=WORD_TO_BLOCK_DB(DBNumber).DW[i*2]; int*2 ? or // BerraB |
6/10/2010 12:21 AM | |
Joined: 1/17/2007 Last visit: 3/8/2024 Posts: 1541 Rating: (531) |
Thank you!
This is using indirect addressing to access the DB contents. Indirect addressing uses a byte address. As you want to access the data word-by-word (not byte-by-byte), the adrdress has to increase by 2 bytes for every 1 word. Word address 0 = byte address 0 Word address 1 = byte address 2 Word address 2 = byte address 4 etc. The WORD_TO_BLOCK_DB is also a neat trick. This allows you to specify a DB by referring to its number instead of the usual direct ANY pointer connection to the DB. This thread goes into a bit more detail of indirect addressing in SCL. Hope this clears things up a bit. BTW, did the code work for you? |
Programming today is the race between software engineers building bigger and better idiot proof programs, and the universe producing bigger and better idiots. |
|
6/10/2010 10:26 AM | |
Posts: 35 Rating: (0) |
Ok, Thanks No the code dosen´t work, i'm gone take a look at it later. Then i come back to you // BerraB |
6/10/2010 11:17 AM | |
Joined: 1/17/2007 Last visit: 3/8/2024 Posts: 1541 Rating: (531) |
Strange . It works for me - I tested it. See Attached pictures. I setup the FC to check words 9 & 10 (addressed as 8 & 9 for StartDB and SlutAdressDB as it is zero based). With both word 9 and word 10 set to 16#0000, the output was FALSE (both unset.gif). With word 9 set to 16#0001 and word 10 set to 16#0000 the output was TRUE (9 set.gif). With word 9 set to 16#0000 and word 10 set to 16#0001 the output was TRUE (10 set.gif). So if ANY word in the DB range to be checked has bit 0 set, the result will be TRUE else the result is FALSE. This is what I thought you wanted. What exactly is the problem with it? AttachmentFirst bit in word.zip (244 Downloads) |
Programming today is the race between software engineers building bigger and better idiot proof programs, and the universe producing bigger and better idiots. |
|
6/10/2010 12:57 PM | |
Posts: 35 Rating: (0) |
maybe i don´t understand you program then, dbadress= if i whant to check out db200 how do i do then ??? // BerraB |
Follow us on