On Mon, 31 Jan 2005 15:44:06 -0000, Leon Heller
<leon.heller@dsl.pipex.com> wrote:
> In most languages, including C, you can't manipulate individual bits
> directly in the same way as other data types like ints, chars, etc. High
> level languages don't usually know about anything smaller than a byte.
> You
> can manipulate individual bits in assembler. For instance:
> sbi portb,PB2
> sets bit 2 of port B
> and
> cbi portb,PB2
> clears bit 2 of port B
> and many embedded C compilers have language extensions that let you use
> in-line assembler by writing something like:
> asm("sbi portb,PB2");
> Leon
Leon, that is something that i have known, but never understood.
You see, i see no reason why a bit shouldn't be a data type. I mean if you
can distinguish between 8 bit and 16 bit words why not make a bit type?
But i have heared several good programmers complain about that shortcoming.
But regardless of what C wants, isn't there a way of fooling it into
cooperation?
Isn't there _any_ way of using bits like bytes? (e.g. PB0=1; ).
thanks
STMessage
Re: [AVR-Chat] accessing bits (e.g. of ports)
2005-01-31 by Stefan Trethan
Attachments
- No local attachments were found for this message.