Skip to main content
Arduino

Timeline for Arduino read PWM duty cycle value with input (analog / digital)

Current License: CC BY-SA 3.0

11 events
when toggle format what by license comment
Jun 30, 2018 at 11:08 vote accept acs
Apr 13, 2017 at 12:50 history edited Community Bot
replaced http://arduino.stackexchange.com/ with https://arduino.stackexchange.com/
Jan 26, 2017 at 0:42 comment added James Waldby - jwpat7 @acs, Are you unable to follow the links and look at other questions on Arduino stackexchange? In particular, see my answer to question 18183, linked in first line of answer above. That code handles 4 RC inputs and can be adapted for as many as there are pins for. ¶ Note, each of the 3 PCI vectors has 8 pins assigned to it. ISRs can read ports and figure out which bits changed. ¶ I have some 8-RC-inputs code (adaptation of that shown in answer to 18183) that I can post after some more work deadlines; a couple of days from now.
Jan 25, 2017 at 9:39 comment added acs @jwpat7 This link says there are only 3 interrupt vector ==> playground.arduino.cc/Main/PinChangeInterrupt So, how did you do this possible? I couldn't find any solution. Please share your code.
Jan 23, 2017 at 8:34 comment added James Waldby - jwpat7 @acs, ATmega328's have 26 different interrupt vectors. The vectors used in the referenced code are for pin change interrupts, or PCINTs, which use 3 of those vectors. PCINTs are available on 22 of the ATmega328-based-Nano pins, and a similar number on Uno's. Please refer to the code shown in the previous questions -- at the moment I have work deadlines to meet.
Jan 23, 2017 at 8:00 comment added acs Can you share your code instead of links. Also, AtMega328 series have 2 interrupts, Arduino ATmega 2560 series have 7 interrupts. So how can I measure 8 simultaneus PWM signals? arduino.cc/en/Reference/attachInterrupt
Jan 23, 2017 at 1:16 history edited James Waldby - jwpat7 CC BY-SA 3.0
correct in-isr time
Jan 23, 2017 at 0:36 comment added dannyf not a problem. two suggestions: 1) unroll the while loop; 2) use constants rather than variables. and I would also make rcOld a static inside the ISR so the code is more modular. with that, I got the execution time down to 3.4us.
Jan 23, 2017 at 0:18 comment added James Waldby - jwpat7 @dannyf, I was looking at one of the simpler ISRs (single encoder counting) when I wrote that, so will need to edit answer with correct time. Sorry!
Jan 22, 2017 at 22:20 comment added dannyf > takes under a microsecond in the ISR, I find that unlikely. Obviously, I'm not sure which code pieces you were talking about - as they are three of them. but a causal look on them would suggest that it will take more than 16 ticks to execute the body of the ISR - not counting the overhead. As a matter of fact, a little birdie of mine said that it would take close to 8us to execute them on an Uno, :)
Jan 22, 2017 at 21:56 history answered James Waldby - jwpat7 CC BY-SA 3.0

AltStyle によって変換されたページ (->オリジナル) /