Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

accessing bits (e.g. of ports)

2005-01-31 by stefan_trethan

Hi,

what is the easiest way to access single bits of ports (SFRs)?

i have found <http://lists.gnu.org/archive/html/avr-libc-dev/2003-08/
msg00020.html> with google.

This: 
PORTC |= _BV(0);.
is madness ;-). I'm doing this for a hobby and stuff like that causes 
me to loose my interest in it. I need to think 30 minutes until i know 
what i have to write, and then i probably got it wrong.

this:
bit_set(PORTC, _BV(0));
is better, but still complicated in a way that boggles my mind.

Why, and if yes how, can i get something like that:
PORTC.0 = 1;
or
PC0 = 1;
or if it must be
PORTC.BIT0 =1;

or whatever, just UNDERSTANDABLE for the mind of a non-programmer.

I do not shy the typing work, but even with comments if i don't 
understand the code it is like reading a book in a foreign language 
you don't speak using a dictionary. (But i'm trying to WRITE that 
book!!)

You see my problem, please help, i'm getting so frustrated here....

ST

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.