Pages: [1] 2   Go Down
Author Topic: Why no byte I/O?  (Read 600 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: 82
Posts: 3123
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
God Member
*****
Karma: 10
Posts: 651
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: 25
Posts: 1143
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: 331
Posts: 16523
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: 92
Posts: 3969
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

Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Replacement for the Arduino IDE: UECIDE - Proper serial terminal, graphing facilities, plugins, overhauled internals.
Java isn't bad in itself, but it has enabled morons to write programs.

Worst state in America
Offline Offline
God Member
*****
Karma: 23
Posts: 665
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

Offline Offline
Edison Member
*
Karma: 28
Posts: 2045
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: 92
Posts: 3969
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

Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Replacement for the Arduino IDE: UECIDE - Proper serial terminal, graphing facilities, plugins, overhauled internals.
Java isn't bad in itself, but it has enabled morons to write programs.

Worst state in America
Offline Offline
God Member
*****
Karma: 23
Posts: 665
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

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 239
Posts: 24371
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: 23
Posts: 665
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

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 239
Posts: 24371
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: 23
Posts: 665
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

UK
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3969
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

Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Replacement for the Arduino IDE: UECIDE - Proper serial terminal, graphing facilities, plugins, overhauled internals.
Java isn't bad in itself, but it has enabled morons to write programs.

Pages: [1] 2   Go Up
Jump to: