PDA

View Full Version : Accessing the variable bits



vilaprinyo
- 25th March 2011, 23:20
Hi,

I migrated from PicBasic to PicBasicPro and I found this code stops running well.

MR var word: H var byte

for H=0 to 15
MR.0[H]=1 'set bit H of MR
next H

I supose this code sets to 1 all bits of MR but not works.

Any ideas?

Many thanks,

Ricard.

Archangel
- 26th March 2011, 02:46
Try MR var bit[16]

vilaprinyo
- 26th March 2011, 06:51
Thanks Joe,

I mean to read single bits I can use MR instead of MR.0[bit]??

Also, I can keep using this variable as a Word? I mean for example if I can assign this bit variable to a word variable:

[B]W var word
MR=W

Can I do that?

Many thanks,

Ricard.

Archangel
- 27th March 2011, 07:39
I think what you need is in this post:
http://www.picbasic.co.uk/forum/showthread.php?t=544
or here:
http://www.picbasic.co.uk/forum/showthread.php?t=3891