1/22/2013 8:51 PM | |
Posts: 621 Rating: (10) |
just leave this all siemens forum mebers are friends...every one having there own talent and have idea.. to just share it it will help to others and biginers....have a fun..... |
1/23/2013 12:43 PM | |
Posts: 47 Rating: (3) |
Hello Intelligent, In the attachement you will find an exemple for what you need. best regards AttachmentSplit_BitWise.pdf (593 Downloads) |
This contribution was helpful to1 thankful Users |
1/23/2013 1:42 PM | |
Posts: 11 Rating: (0) |
hi techhno. thank you for your idea, it works very well. but inever like to use FOR...NEXT in my programs because this command significantly decreases the performance of our code and sometimes it takes too much amount of RAMspecially whenever ourcode has alot of lines (for my program more than 1000 lines! ) i solved my second problem such as below: (reference:stackoverflow.com) If you want to set the Nth bit of a number to 1: mask = 1 << n ' if n is 3, mask results in 00001000 bytevalue = bytevalue or mask To set a bit as 0: mask = 255 - (1 << n) ' if n is 3, mask results in 11110111 bytevalue = bytevalue and mask In both examples, bytevalue is the byte in which you want to alter and mask is also a byte. EDIT: To retrieve the state of a bit easily is a lot like setting a bit, Where IsSet is a boolean: mask = 1 << n ' just as above IsSet = (bytevalue and mask) != 0 |
Follow us on