Main Site Documentation

Setting or reading multiple digital outputs at the same time


I’m a newb to FEZ / .NETMF so please be kind.

I want to set multiple digital outputs at the same time. At a minimum I need to set 4 outputs at the same time. In USBizi.Pin I see the individual pin defintions however I don’t see anything in the namespaces that groups them at a higher level (perhaps into bytes)? I need to have as little jitter as possible across a group when I set them. (Yes, I could use a latch but that’s extra chips I don’t really want). Same issue for inputs (reading multiple inputs as a group so they are sampled at the same time).
I feel like I’ve missed something obvious here.


We have “Register” class that gives you access to internal processor. You can use it to set multiple IOs.

Also, on next release coming soon, we have added parallel class to you can set 8 IOs at once.

How are you planning on using this?


In the new parallel class to come, will it be possible to also read 8 IOs at once? If possible, will be be possible to get an interrupt when any of the bits change?

Would be useful for building a logic analyzer.


You can read all at once but no interrupts. That will be too application specific. We mainly added it for parallel displays


A parallel display (4 bit or 8 bit) is an Ok example of what I will be doing. My application however won’t have a /Wr ot /Strobe signal to latch the data. Groups of 4 outputs will directly provide the BCD inputs to a TTL chip. Basically I’m porting a design from PIC16 to .NETMF; on PIC16 I can write directly to PORTA, PORTB etc, each being 8 bits wide.


Displays, or any system for that matter, do not care if all bits are set at once or not. What matters is the state of the pins when write signal is strobed.

What is nice about this new implementation is the much higher speeds.


As I said before, in this edge case I don’t have a strobe or latch signal, so the jitter is important to me. What stood out to me was the contrast with other embeeded controllers. With the PIC series I can write directly to an 8 bit port (PORTA = 0x3F), the PIC will latch all eight bits at the same time on the output pins. I can also write to the pins individually (PORTA.PIN0 = 0; PORTA.PIN1 = 1;) this create the jitter I am trying to avoid. I see the individual outputs pins exposed in the CLR; I didn’t see the Bytes / or Words exposed at the next level up. Another example here is reading the 2 outputs from a rotary encoder; in my purely software implementation I need to sample the two bits at the same time so I can accuratly see the phase delta between the pins (so I know which whay it is turning), having to read the pins serially can introduce error. (This is why Grey Code only changes one bit at a time when it’s pysically encoded, this removes potential jitter between the bits).


This is nothing special. Our processors can write up to 32pins at once :slight_smile: