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

BASCOM-AVR : Splitting an INTEGER or WORD into a byte array : NEWTOPIC

$
0
0
Hi all, New to Bascom, just getting my head around the limited version. No problem with familiarity with micros and electronics though, we've got 15 years experience with HC11s, PICs, and AVRs using mainly ASM. Bascom question: If I've got an int (never negative, i.e. 0 to 32767) or a word (0 to 65535) variable, bot can I split this into a 5 element byte array? For example, given an int 21486, set MyByte(1) to 2, MyByte(2) to 1, MyByte(3) to 4, MyByte(4) to 8, MyByte(5) to 6. 2nd example, given a word int 47990, set MyByte(1) to 2, MyByte(2) to 7, MyByte(3) to 9, MyByte(4) to 8, MyByte(5) to 0. Easy or impossible? The rest of the console figured out, but this one hats us stumped. Cheers [b:5917a144f4][color=red:5917a144f4](BASCOM-AVR version : 2.0.7.6 )[/b:5917a144f4][/color:5917a144f4]

Viewing all articles
Browse latest Browse all 20596

Trending Articles



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