individual I/O pin access

i just shifted from PIC to atmel. i have a trouble of finding the individual PIN status change. in PIC you just state like access PORTB pin No. 7 you just state it "PORBTD.F7 = 1". i don't know if there is a function in arudino or atmel which do the same. aside from using digital write. its more of an old school. thank you so much.

You can do the old school port access here: http://www.arduino.cc/en/Reference/PortManipulation If you want, but most of the time the individual bit abstraction of digitalWrite is much simpler and portable across different models of arduino.

thanks i don't have much choice then i have to use digital write. no old school stuff. but how state like on button press it inverts the old state of the port. what we do in PIC just "portd.f1 = ~portd.f1" for example. it actually makes the code compact with this method. are there any statements that does the same thing using digitalwrite?

thanks

Rolandchok:
thanks i don’t have much choice then i have to use digital write. no old school stuff.

Already given to you: http://www.arduino.cc/en/Reference/PortManipulation

PORTD = PORTD | 0x04; // sets Pin 2 of Uno to Input.
int singleBit = PIND & 0x04 >> 2; // read Pin 2 on an UNO

or as most people prefer
pinMode(2, INPUT); // only run once
int singleBit = digitalRead(2);

Rolandchok:
but how state like on button press it inverts the old state of the port. what we do in PIC just “portd.f1 = ~portd.f1” for example.

pinMode(13, OUTPUT); // only run once
digitalWrite(13, **!**digitalRead(13)); // inverts the state of an output pin.

Edit: Forgot the bang.

it really helps thank you so much. its kind a big adjustment for migrating to arduino.

Rolandchok: it really helps thank you so much. its kind a big adjustment for migrating to arduino.

The source code for all of the Arduino functions are included with the IDE. So you can see how functions like digitalWrite() work.

digitalWrite(13, digitalRead(13));  // inverts the state of an output pin.

Should that not be

digitalWrite(13, !digitalRead(13));  // inverts the state of an output pin.

Rolandchok: what we do in PIC just "portd.f1 = ~portd.f1" for example. it actually makes the code compact with this method.

Compact and incomprehensible, if you like that sort of thing.

digitalWrite(13, !digitalRead(13));  // inverts the state of an output pin.

... is pretty compact too, and more comprehensible.

ok i will try to program using the arduino IDE for now and lets see how it goes thank you so so much for your help guys.

yeah your right the syntax for inverting the pin is "digitalWrite(13,!digitalRead(l13));" it needs the "!".

i think it wont take me much time migrating as im still coding C base.