ACCESSING PORTS

hi guys, am a beginner in arduino, my doubts will definitely be stupid but kindly help me

can i send a hexa decimal value or decimal to a port and view it through led? the sample codes shows i have to configure each pin n send either high or low bit, i want to access the whole port throgh some commands like portB=H5f of watever, is it possible in an arduino uno?

http://www.arduino.cc/en/Reference/PortManipulation

This wouldn't work:

portB=H5f

This would: PORTB=0x5F

You can dec/increment the value in the port register too:

PORTB++;
PORTB += 10;
PORTB--;

And toggle all bits at once:

PORTB ^= 0xFF;

And pretty much anything you can do with a byte type variable (not quite but most things).

[quote author=Tom Carpenter link=topic=125886.msg946558#msg946558 date=1349515388]

You can dec/increment the value in the port register too:

PORTB++;
PORTB += 10;
PORTB--;

[/quote]

Another entrant: http://www.ioccc.org/

[quote author=Nick Gammon link=topic=125886.msg946639#msg946639 date=1349524875] Another entrant: http://www.ioccc.org/ [/quote] 8)

Or to define a set of macros:

#define setbits(var, bits) var |= (bits)
#define clrbits(var, bits) var &=~(bits)
#define flpbits(var, bits) var ^= (bits)

with that, you can operate on the port (or ddr or any other register for that matter)

setbits(PORTB, (1<<2)); //sets bit2 on portb
clrbits(DDRB, (1<<0)); //bit0 on portb set as input
flpbits(PORTB, (1<<2) | (1<<3)); //flip bit2 and bit3 on portb