Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20562

BASCOM-AVR : Problem with bitwise operation inside sub - Please help. : REPLY

$
0
0
[quote:9724774b16="Evert :-)"]When i haven problem's looking at the report can sometimes be interesting.[/quote:9724774b16] Have a look into the opcode, that's more interesting. [quote:9724774b16]There's something not going very well, so maybe Mark can take a look at it. [/quote:9724774b16] Do not see anything wrong in the report, Tick to Dummy7, 8 bits, are forced into one byte at address 256, Bit_1..2 are therefore in address 257. The reason for that effect is easy to explain, or better how to solve: make the access [b:9724774b16]atomic[/b:9724774b16] in your code to one bit in the same byte-container. It can't be done differently, as accessing single bits within a byte can only be done with one single opcode, if this bytes is above lower IO adress. Instead this is translated into opcode of 3+ commands, which can be interrupted by an ISR accessing the same byte. The solution is either that you make bit-access atomic, or Mark has to do it via compiler. The latter gives more and unnecessary overhead, as mostly it is not required. Imho better you do it, I don't think it has to become a compiler feature. However, if a warning makes it into the help, it wouldn't hurt.

Viewing all articles
Browse latest Browse all 20562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>