In the past I used .lowbyte and .highbyte instead of .byte0 and .byte1.
What does the compiler do ?
In the past I used .lowbyte and .highbyte instead of .byte0 and .byte1.
What does the compiler do ?
PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2
It actually compiled without any problems. But now I think I have another question. If I had a byte that represents different config bits, how can I set each bit individually?
If I had variable set as testbit VAR databyte1.0, will bit0 of databyte1 change if I set testbit to another value?
Errr.... how would I also set multiple bits in a byte? Say, I want to set bit5 to bit0 to a certain value.
Thanks!
Last edited by Qacer; - 10th March 2006 at 21:17.
I'M BACK!!!
Sorry to be impolite and a pest but why don't simply test it and send results to a LCD or via Serial communication to your PC to see what's happen with?
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi mister_e,
:-) Sorry, I was feeling a bit lazy. Plus, I don't have the most efficient computer setup in the world. Anyway, this actually the question that I can't figure out: how would I set multiple bits in a byte simultaneously? Say, I want to set bit5 to bit0 to a certain value.
I was hoping there was something like this:
databyte1.[5 to 0] = %101011
Hi:
You can create aliases for each configuration bit. Ex:
name1 var byte1.0
name2 var byte1.2 etc.
then, you can clear or set each one by
name1 = 0, or name1 = 1
Or you can test them:
if name1 = 1 then do_something
I hope this helps.
Greetings...
Ruben de la Pena
To set bit 4 on and leave the rest unchanged:
mybyte=mybyte | %00010000 'OR function with selected bit masked ON
To turn bit 4 off and leave the rest unchanged:
mybyte=mybyte & %11101111 'AND function with selected bit masked OFF
OR you can set multiple bits on or off by either ADDING or SUBTRACTING the bit weight to/from either 0 or 255 respectively.
------------------Picster-----------------
Bookmarks