Skip to content

Conversation

WestfW
Copy link
Contributor

@WestfW WestfW commented Nov 26, 2018

Also extend the Example to actually store the read result so that
this can be confirmed. Add some if() statements to demonstrate
that the new code doesn't incease the execution time of the
common "test" of a pin.

See http://forum.arduino.cc/index.php?topic=581534.0

  //get pin state of pin PIN
  pin = digitalReadFast(PIN);  // save a proper high/low value
 1bc:   83 b1           in      r24, 0x03       ; 3
 1be:   82 fb           bst     r24, 2
 1c0:   88 27           eor     r24, r24
 1c2:   80 f9           bld     r24, 0
 1c4:   89 83           std     Y+1, r24        ; 0x01

  // demonstrate optimization of tests
  if (digitalReadFast(PIN) == HIGH) {
 1c6:   1a 99           sbic    0x03, 2 ; 3
    digitalWriteFast(PIN, LOW);
 1c8:   2a 98           cbi     0x05, 2 ; 5
  }
  if (digitalReadFast(PIN) == LOW) {
 1ca:   1a 9b           sbis    0x03, 2 ; 3
    digitalWriteFast(PIN, HIGH);
 1cc:   2a 9a           sbi     0x05, 2 ; 5

Extend Example to actually store the read result so that
this can be confirmed.  Add some if() statements to demonstrate
that the new code doesn't incease the execution time of the
common "test" of a pin.
@awatterott awatterott merged commit c55963e into watterott:master Nov 26, 2018
@awatterott
Copy link
Member

Hello Bill,
Thank you for the information and patch.
PS:
We have disabled the issue reporting on most of our projects, because otherwise people are asking support questions there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants