Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

What are the fastest alternatives to calling the Arduino functions digitalread() and digitalwrite()? AVR-specific or chip-specific solutions are acceptable.

share|improve this question

migrated from stackoverflow.com Nov 21 '11 at 23:42

This question came from our site for professional and enthusiast programmers.

2  
Reading this and your last question, it seems like you want to do something pretty quickly. I think giving details on what it is and how fast might be useful. –  Oli Glaser Nov 22 '11 at 1:16
    
@Oli, good idea, thanks. Current project is a tuning system for RC transmitters. It works well, but I would like to make the RC PWM signal decoding efficient so that I can use the same framework for other projects. Here's a writeup on what I have so far: eastbay-rc.blogspot.com/2011/11/… –  Mark Harrison Nov 27 '11 at 2:17

3 Answers 3

This library is a good alternative: http://code.google.com/p/digitalwritefast/

share|improve this answer

Use the ChipKit Uno32. It's much faster than the AVR-based Arduinos. It will also deal with your timing problems.

share|improve this answer
1  
I don't think buying faster hardware is the best answer here, at least not until you've reached the bounds of your current hardware and decided that you need something faster. –  Jon L Nov 22 '11 at 0:42
    
Why the downvotes? He wanted the fastest solution, not just a faster one, which I've provided. Can anyone suggest a faster Arduino-based solution? –  Leon Heller Nov 22 '11 at 1:51
8  
Because the ChipKit is not an arduino, but an arduino compatible platform. This means that although port switching is faster , there is a big likelihood of a rewrite of some libraries. Ethernet, XBee, SD card libraries may not work at all out of the box. Furthermore, Mark specifically asks for alternative function calls of digitalRead/Write, not for a new platform (doh). –  Hans Nov 22 '11 at 8:43
    
No, it's a fine answer... I didn't realize such a thing existed, and at such a price point. Downvoters, follow my lead and upvote... Thanks Leon! –  Mark Harrison Nov 22 '11 at 18:17
1  
Changing hardware is never a good solution. At the very least you miss out on some good learning and will never learn what would be efficient use of the hardware. –  Rick_2047 Nov 25 '11 at 13:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.