Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Outputting to I/Os in parallel


  • Please log in to reply
4 replies to this topic

#1 xmakina

xmakina

    Member

  • Members
  • PipPip
  • 13 posts

Posted 13 May 2013 - 12:42 PM

Hi,

 

I need to set an 8-bit device. I am using a netduino plus 2. If I want to set DB0 - DB7 to a specific byte, say "45" (hex), how can I set the bit simultaneously instead of setting each bit:

 

I know it can be done like this:

 

db0.write(true);

db1.write(false);

db2.write(true);

db3.write(false);

 

 

db4.write(false);

db5.write(false);

db6.write(true);

db7.write(false);

 

 

but can I set something like this in parallel ?

 

Thanks,

 

xMakina

 



#2 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 13 May 2013 - 02:10 PM

Hi!

 

I have some vague notion of reading somewhere that you could group pins together to form a parallel data bus on the version 2 boards but I can't find that info now and could be that was only a feature of the CPU itself and hasn't been made available to managed code yet. Perhaps someone can correct me on this?

 

So from what I know, the short answer would be no, I don't think there's any parallel bus.

 

...but - there are plenty of different solutions involving some external component. For example, with a shift register you can create a virtually parallel bus using SPI to drive it. You might want to look at the 74F166 which is an 8 bit bidirectional shift register:

 

http://www.nxp.com/d...heet/74F166.pdf

 

Also there's the PCF8574 8 bit quasi-bidirectional I2C I/O expander which is easy to use. Both of these ICs are available in breadboard friendly DIP16 packages.

 

For the latter, I've written a driver class and I2C bus manager that can be found in this post

http://forums.netdui...-and-ir-remote/



#3 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 13 May 2013 - 05:07 PM

You might want to look at the 74F166 which is an 8 bit bidirectional shift register:

 

 

Don't forget the 74HC595 - 8 bit serial to parallel shift register.

Very easy to connect to the SPI bus.

 

Wiki:

http://wiki.netduino...figuration.ashx

http://wiki.netduino...le-74HC595.ashx

 

Paul



#4 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 16 May 2013 - 07:46 AM

A really cool and useful feature of the PCF8574 8 bit I2C I/O Expander is that it is quasi-bidirectional meaning the pins work in both directions without the need for being configured in one direction or the other.

Also, I'm currently working on a driver class for the MCP23S17 which is a 16 bit I/O Expander with SPI interface. With my software, you can use it pin by pin or group pins together to form one or more parallel buses. This chip is also bidirectional and has excellent per pin interrupt handling. I'll be posting the code when done.

#5 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 18 May 2013 - 02:14 AM

Hi xMakina, The best way to do this with Netduino is to use shift register(s) via SPI. The digital pins on the board are optimized for features from non-adjacent MCU pins, rather than for being used as bits in an output byte/word. Chris




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.