05-02-2012, 08:07 PM
slenkar Wrote:so one byte is 8 bits or 8 'switches'?Yes.
so how would you say read or write a 'switch' in a byte? say I wanted to read switch 4 and read switch 5
Reading:
Code:
switch4=(byte>>4)&1
Code:
switch5=(byte>>5)&1
Code:
poke address,(peek address)|(switch4<<4)
Code:
poke address,(peek address)|(switch5<<5)
Code:
switch4=byte>>4&1
<!-- l --><a class="postlink-local" href="http://www.boriel.com/forum/post2064.html#p2064">post2064.html#p2064</a><!-- l -->
I found the english precedence table of Freebasic which shows that SHL and SHR have higher priority than +/- and binary AND, OR etc.
<!-- m --><a class="postlink" href="http://www.freebasic.net/wiki/wikka.php?wakka=OpPrecedence">http://www.freebasic.net/wiki/wikka.php ... Precedence</a><!-- m -->
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!