Pages: [1] 2   Go Down
Author Topic: Why no byte I/O?  (Read 672 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm mystified about why the Arduino API doesn't include easy commands to control individual byte-wide I/O ports?  Don't people need to control several bits simultaneously rather than twiddle bits individually?  I don't mind reading the Atmel data books to find info about control registers, shared pins, and so on, but how do I send a byte to a register to control a byte-wide port if there's no register-control operation?  Apologies if I have missed something obvious. --Jon (potential Arduino Due user) 
Logged

California
Offline Offline
Faraday Member
**
Karma: 88
Posts: 3368
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
God Member
*****
Karma: 17
Posts: 723
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The sad thing on the 328 is that none of the registers are 8 pins wide.  So if you need to parallel in a whole byte it will take at least two registers, a bitshift, an OR operation, and most likely a couple of ANDs.
Logged

Copenhagen, Denmark
Offline Offline
Edison Member
*
Karma: 32
Posts: 1204
Have you testrun your INO file today?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The sad thing is none of the ports are 1 bit wide. You have to read and mask and so on. smiley-wink
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The sad thing on the 328 is that none of the registers are 8 pins wide.  So if you need to parallel in a whole byte it will take at least two registers, a bitshift, an OR operation, and most likely a couple of ANDs.

Port D is a full byte wide in the 328 isn't it?

https://spreadsheets.google.com/pub?key=rtHw_R6eVL140KS9_G8GPkA&gid=0

Lefty
Logged

UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The sad thing on the 328 is that none of the registers are 8 pins wide.  So if you need to parallel in a whole byte it will take at least two registers, a bitshift, an OR operation, and most likely a couple of ANDs.

Port D is a full byte wide in the 328 isn't it?

https://spreadsheets.google.com/pub?key=rtHw_R6eVL140KS9_G8GPkA&gid=0

Lefty
So is port B, but two are normally used for the crystal.

The Arduino doesn't need to provide facilities to deal with a whole byte I/O as the chip does it for you, using the PORTB or PORTD Special Function Registers.
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

Worst state in America
Offline Offline
God Member
*****
Karma: 32
Posts: 792
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The sad thing on the 328 is that none of the registers are 8 pins wide.  So if you need to parallel in a whole byte it will take at least two registers, a bitshift, an OR operation, and most likely a couple of ANDs.

Not true. PORTD is UNO pins 7 thru 0. Granted, using pins 1 and 0 screws up serial communications, but an 8 bit full port IS available if needed.

Logged

Gentlemen may prefer Blondes, but Real Men prefer Redheads!

Offline Offline
Faraday Member
**
Karma: 61
Posts: 2874
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nobody seems to be interested in traditional parallel communications anymore,   and there doesn't seem
to be much call for it.
Logged

UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Nobody seems to be interested in traditional parallel communications anymore,   and there doesn't seem
to be much call for it.
That's because serial communications is so fast now, and parallel communications just takes up too much room.

The only place now in a modern PC where parallel communication is "normal", is in the memory, and that is a mixture of parallel and serial (DDR, etc).
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

Worst state in America
Offline Offline
God Member
*****
Karma: 32
Posts: 792
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Nobody seems to be interested in traditional parallel communications anymore,   and there doesn't seem
to be much call for it.

Try interfacing to a graphics LED or LCD to a microcontroller. Serial interface is so slow you can watch the pixels pour onto the screen - one at a time.
Logged

Gentlemen may prefer Blondes, but Real Men prefer Redheads!

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25840
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Which do you want to give up?
Fast updates, or at least nine nine of your precious pins?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Worst state in America
Offline Offline
God Member
*****
Karma: 32
Posts: 792
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Which do you want to give up?
Fast updates, or at least nine nine of your precious pins?

Depends on what I'm doing. If I need decent graphics performance, I'll use the pins......
Logged

Gentlemen may prefer Blondes, but Real Men prefer Redheads!

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25840
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If I need decent graphics performance, I don't use a slow microcontroller.  smiley
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Worst state in America
Offline Offline
God Member
*****
Karma: 32
Posts: 792
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If I need decent graphics performance, I don't use a slow microcontroller.  smiley

LOL! We can go back and forth on this all day.......

Logged

Gentlemen may prefer Blondes, but Real Men prefer Redheads!

UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If I need decent graphics performance, I don't use a slow microcontroller.  smiley
If I need decent graphics performance, I use a PIC24FJ256DA210 - it has 3 built-in graphics co-processors and a dedicated LCD / TFT interface.
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

Pages: [1] 2   Go Up
Jump to: