2018
February Thursday 22

Bookmark and Share

Related Articles...

MILWAUKEE WI Arduino Meet Up Make Space

WANTED: CORE TEAM MEMBER TO HELP START NON-PROFIT GROUP.

WANTED: Angle Investor Start-Up Funding

Large Industrial Zoned Arduino Make Space Acquired!

Email :

COASMailBox @ gmail.com

MILWAUKEE WI Raspberry Pi Meet Up Make Space

WANTED: CORE TEAM MEMBER TO HELP START NON-PROFIT GROUP.

WANTED: Angle Investor Start-Up Funding

Large Industrial Zoned Raspberry Pi Make Space Acquired!

Email :

COASMailBox @ gmail.com

MILWAUKEE WI Internet of Things (IoT) Meet Up Make Space

WANTED: CORE TEAM MEMBER TO HELP START NON-PROFIT GROUP.

WANTED: Angle Investor Start-Up Funding

Large Industrial Zoned Make Space Acquired!

Full Advanced Fabrication Facility, machine Shop, Welding, Electronics Lab Equipment Acquired!

Email :

COASMailBox @ gmail.com

MILWAUKEE WI Machine Repair, & Installation  - Tier 1 Business Support

Machine Technician Mechanic 20+ Years  Personal Experienced In Industrial Factory Machine Servicing, Rebuilding, Installation And Repair - Plus A 35+ Years Experienced Computer Engineer Service Technician Team Ready For Your Outsourced Market Advantage Needs!

Hartung Industrial - Member - CGI Science & Technology Group

Email :

COASMailBox @ gmail.com

2018 February REVIEW

 

Arduino digitalWriteFast
| Gene's Inner Lab, Quick Ref

Internet of Things

2017 | by Gene Casanova

Senior Systems/Network/Internet Engineer


Real World Performance

Arduino library for faster digitalWrite() using direct port manipulation and macro for pin assignment and faster pinMode() and digitalRead().

The 'digitalWrite()' in the Arduino UNO core (16MHz) takes about 6280nS, while 'digitalWriteFast()' port manipulation takes 125nS.

This library makes direct port manipulation easy, by using 'digitalWriteFast()', and a macro will replace it with the approritate port manipulation commands.


Compatibility

Include the "digitalWriteFast.h" file:


Using digitalWriteFast: digitalWriteFast.h

#include <digitalWriteFast.h>

Macro Defintions

digitalWriteFast(pinNum, state)	//	Set or clear pin/port.
pinModeFast(pinNum, mode) 		//	Set pin/port in INPUT or OUTPUT mode.
digitalReadFast(pinNum)			//	Read state of pin or port.

Parameters

pinNum
The number written on the Arduino board.
state
HIGH or LOW
mode
INPUT or OUTPUT

To toggle fast, all the three parameters must be constant, or defined by the macro for compilation.  For example:

#define pinNum 10;	//	Use, instead of this > int pinNum =10;
#const int pinNum 10;	//	Use, instead of this > int pinNum =10;

Setting the parameter as a variable, would cause the macro to return an error during compilation.

This makes sure 'digitalWriteFast' produces faster toggling, and notifies the programmer the specific area where toggling is slow.  Otherwise, use 'digitalWrite'.  Notice, 'digitalWrite' was developed for easy understanding of creating embedded computer code and processing during the learning process in the Arduion learning environment.


Use The Technology Wisely & Keep It Simple

- Cheers!

Gene Casanova


Need More?   Need Help?

Available Tutoring, Cyber Security, & Senoir Full Stack Developer & Programer

CGI Computer Wares | EST 1979

Send E-MailCONTACT: [click]@CGIComputerWares.com