On Oct 6, 2006, at 9:53 AM, Martin Peach wrote:
Georg Holzmann wrote:
Hallo!
As far as steppers go it would be nice to have arduino commands
for steppers. It looks like the existing pduino firmware code can
only change one pin at a time, it would be nice to have a
parallel digital pin command with a mask like set_digital_outs (int output_pattern, int mask) so the set bits in mask would be
changed, at the same time, according to output_pattern and the
zero bits would be unaffected.AFAIR it is like this - only that the output bits are splitted in
2 halfs (7 lower and 7 higher bits) ...In the Pd_firmware.pde code the pins are set on at a time even if
the data is sent as two bytes:for(i=0; i<7; ++i) { mask = 1 << i; if( (digitalPinStatus & mask) && !(pwmStatus & mask) ) { digitalWrite(i, inputData & mask); } }
I am definitely open to suggestions as to how to make the code work
better. I've been focused on the protocol design, so little
optimization has happened. In this case, its not quite as simple as
just getting the byte from the serial port and writing it to the
ports. If a PWM is running, then you don't want to write to that
port, that's what pwmStatus is doing.
From what I read about the functions that write a byte at a time to
the digital pins, you have to have all of the pins set to OUTPUT in
order to use them. But I could be wrong.
.hc
Terrorism is not an enemy. It cannot be defeated. It's a tactic.
It's about as sensible to say we declare war on night attacks and
expect we're going to win that war. We're not going to win the war
on terrorism. - retired U.S. Army general, William Odom