pbasic 2.5 question.

Hello all,
I'm learning PBASIC 2.5 from a book called PROGRAMMING AND CUSTOMIZING THE BASIC STAMP COMPUTER and I ran into this situation. The following
code produces the output under it:
code---------------------------------------- ' {$STAMP BS2} ' {$PBASIC 2.5}
_x VAR Byte _y VAR Byte _z VAR Byte _area VAR Word _x = 20 _y = 30
B0 = 155 B1 = 220 W2 = B0 + B1
_area = _x*_y 'solve the area
DEBUG "the Area is ", DEC _area, "sq ft." DEBUG CR, ? B0, ? B1, ? B2, ? W2 END =====================================OUTPUT: the Area is 600sq ft. B0 = 88 B1 = 2 B2 = 20 W2 = 375 ===================================My questions are: -why is B1 = 2 when I declared it '220'? -why is B2 = 20 when I didn't load it with any values? -W2 is giving me the correct sum, but why are the B variables displaying strange results?
Thanks,
-Alex
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Hi,
How many sensors are used in your robot?
Thanks Nick
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Alex, I'm not an expert but it looks like B0-B13 are registers (hard wired memory locations in the microcontroller). While the program runs the contents are constantly changing. Dana
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.