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

BASCOM-AVR : Question about casting : NEWTOPIC

$
0
0
Hello, Maybe I miss something, but let me understand how it works in bascom. I have very basic example below: [code:1:1bc4c32fe4] $regfile = "m8def.DAT" $crystal = 8000000 $sim Dim W16 As Word Dim X16 As Word Dim M08 As Byte W16 = 450 M08 = W16 / 100 'it should give me 4, but I get 1 X16 = W16 / 100 'it properly gives 4 M08 = X16 'but require new variable X16 End [/code:1:1bc4c32fe4] If I try to store result directly in byte variable, it gives me result only from low byte of this word. To get proper result I have to use additional word variable. This same, but form single to byte works ok: [code:1:1bc4c32fe4] $regfile = "m8def.DAT" $crystal = 8000000 $sim Dim W32 As Single Dim M08 As Byte W32 = 450 M08 = W32 / 100 'it gives 4 End [/code:1:1bc4c32fe4] Is it intentional and by design, or some bug? [/code] [b:1bc4c32fe4][color=red:1bc4c32fe4](BASCOM-AVR version : 2073 , Latest : 2.0.7.7 )[/b:1bc4c32fe4][/color:1bc4c32fe4]

Viewing all articles
Browse latest Browse all 20577

Trending Articles



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