I've been using the UNO for some time now, and I wanted an upgrade to the Arduino 101, because for my project, the bigger speed and an inbuilt accelerometer and gyroscope come in handy.
Now for the UNO setting a pin HIGH and LOW using digitalWrite was quite slow. For my UNO it took about 12 ~ 16 microseconds. The Arduino 101 has improved this a lot, by needing only 4 microseconds to complete the task. But still I wonder:
Is it possible to change the state of a pin of the Arduino 101 without using digitalWrite?
On the UNO I used the PINB bit to set a pin HIGH or LOW, and to read from if the pin is HIGH or LOW. is there a similar bit on the 101?
My apologies for thread necromancy! Is this still the most efficient way to check pin status? Or will we get a 101 equivalent of port register macros? I'm doing some high speed pulse counting, which at first sounds like a good job for hardware interrupts, but I don't want all the interrupt overhead.
Essentially I need to look at the bits for two pins, and with a switch case for 01, 10, 11 increment a couple counters. This is something like 10 or 12 instructions total, so it seems a huge waste to blow 100+ cycles just handling interrupts. I'd rather loop around as fast as possible, just checking those bits. I'd expected to do this with PINB and bitmasking, but pins_arduino.h for core 1.0.5 doesn't have those macros yet.
The AVR macros will never be there (since the architecture is completely different ) but you can take a look how fast pin operation are handled in the OneWire port for Curie module (OneWire/OneWire.h at master · PaulStoffregen/OneWire · GitHub)
facchinm:
The AVR macros will never be there (since the architecture is completely different ) but you can take a look how fast pin operation are handled in the OneWire port for Curie module (OneWire/OneWire.h at master · PaulStoffregen/OneWire · GitHub)
Thank you for your reply! OneWire does look very efficient, certainly more economical than using a hardware interrupt. I have been looking at this and, unless I am being naive and missing something, should be able to figure out the address for the PinDescription struct array. Then, knowing the size of each struct, I can step through the address space and look directly at the pins I care about, as well as the bits for their HIGH/LOW status. Do you think this is reasonable?
I have emailed maker-info@intel.com asking for the datasheets but I am not holding my breath!