Forum Rule: Always post complete source code & details to reproduce any issue!

Search:

Type: Posts; User: defragster

Search: Search took 0.02 seconds.

  1. The compiler likely will take away any clear /2...

    The compiler likely will take away any clear /2 or /4 and program as a shift, and if not the CPU can do integer divisions in a single cycle AFAIK - so not worth worrying over the difference ... what...
  2. It all depends on the reception and measure of...

    It all depends on the reception and measure of the analog values in the system for how it actually works out to get better reading on two more bits ... so only you can test this ... i.e. YMMV

    But...
  3. Awesome the unrolled loop shows promise! Are the...

    Awesome the unrolled loop shows promise! Are the 8 averages on 10 or more bits of resolution?

    It is global variables that are evil ... because that is the easiest thing to do - though can be made...
  4. No that would be an added setting. Not sure if...

    No that would be an added setting. Not sure if that changes the speed when doing the non-repeating reads here - but may only affect the continuous type? Easy to test with a couple of loops with the...
  5. Wish there were one or more of your sensors set...

    Wish there were one or more of your sensors set up here so I could see. Never looked this close at it before - and only from the code end. Not sure of the effect on the reading with the fast...
  6. Indeed - need to account for the extra bits. 12...

    Indeed - need to account for the extra bits. 12 bit Conversion takes a tad longer so ideally the 10th bit less jumpy with right shift of 2 or divided by 4. Then treat the same as the 10 bit samples....
  7. Pre-Processor is just text replacement as used. ...

    Pre-Processor is just text replacement as used. It can take 'param' letters for use - but that not done there as I just wanted to be able to put in code or if commented - take out that "someWork"...
  8. adc_pins[] array reference indexing like in the...

    adc_pins[] array reference indexing like in the for(i=0... ) code when unrolled added processor cycles - it seemed because 'i' was no longer an active variable stored in a register.

    ...
  9. Enjoy ... These are test code : #define...

    Enjoy ...

    These are test code : #define someWork and someWork_Global
    and any use or ref of waitCnt

    And this and any of the vars are just for measuring and limiting output to 1/sec:


    if...
  10. Just coded that in place - where someWork and...

    Just coded that in place - where someWork and someWork_Global are just placeholders for timing measure:


    #define someWork_Global { delayNanoseconds(3500);} // Delay waiting for first data to...
  11. That someWork delayMicroseconds() was to get some...

    That someWork delayMicroseconds() was to get some measure of the amount of time available to do "Work" without affecting the actual throughput of the reading. With that active watch the reads per...
  12. Indeed that code can be tweaked - as noted last...

    Indeed that code can be tweaked - as noted last post was avg(1) and running 133,386 reads of 10 pins per second.

    Changing to this:

    ///// ADC0 ////
    adc->adc0->setAveraging(2); ...
  13. The last code I have here was asking for 12 bit...

    The last code I have here was asking for 12 bit ADC reads - with 1 avg - not sure if that gives a more stable 10 bit value? It takes longer - but with the dual read improvement it offset the longer...
  14. Have fun. The prior loop code is decent -...

    Have fun. The prior loop code is decent - unrolling minimally better as the core. Not sure it can go faster given two ADC's with both in use.

    Just make sure to do the error check - at least in...
  15. Yes, during the wait for one set of readings -...

    Yes, during the wait for one set of readings - which are a time fixed by the resolution and any averaging of the values - there is a block of time now available while the hardware is busy.

    Anyhow...
  16. instead of 2nd code post #61: for (i

    instead of 2nd code post #61:


    for (i<pins) {
    start read
    do something - if data from prior read
    read next data
    }
  17. The start read and return in post #61 :...

    The start read and return in post #61 : adc->startSynchronizedSingleRead
    >> then do calc from prior read
    then get values
    ... repeat

    Would give time as done to ask for more averaging - and...
  18. Multiple sensors will give different readings by...

    Multiple sensors will give different readings by nature and location in the drum head - and more overhead to read them and reduce to a meaningful value.

    I just bumped the above fastest yet code to...
  19. code with some testing outside the post editor...

    code with some testing outside the post editor ... - there was a !Not missing in the while() - and the use of ADC func()'s perhaps ... below is actually faster than last posted by another 10K per...
  20. Subtle change for error check...

    <REPLACING ABOVE> Subtle change for error check still finds error but not every cycle - takes out some overhead - 3.2K more reads per second.

    ADC1: Wrong pin
    P#24: 13854508.00V <P#25:...
  21. THANKS >> @jonr: That's the answer - it is...

    THANKS >> @jonr: That's the answer - it is working where the prior scheme was hanging something - and the GDB didn't help me see where ...

    >> updated to post #55
  22. Updating prior p#28 sample to use that paired...

    Updating prior p#28 sample to use that paired 'startSingleRead' it completes ONCE and then quits ... ???
    adjustments haven't helped yet - including checking for ADC errors:

    ...
  23. @KurtE points to the more efficient - it seems -...

    @KurtE points to the more efficient - it seems - use of twin ADC's - as long as the pins are ordered so the ADC can see the pin given in hardware.
  24. Yes, posted code has that line commented out -...

    Yes, posted code has that line commented out - uncomment it and it reads the 8 pins 26K times per second. Not sure where 8 came from on this end ... if it is 10 - add two more analogs to that array...
  25. easy to test with provided timing with cyccnt. ...

    easy to test with provided timing with cyccnt. Seems they would be better as unint32_t at the cost of 24 bytes of memory.

    But the majority of time will be spent in the adc reading - so saving one...
  26. That code as noted started as the named installed...

    That code as noted started as the named installed generic sample, the #ifdef code is specific adjustment depending on what board is in use.

    At build time the specific Teensy 'Board' will define...
  27. I just doubled my ADC experience :) Not sure any...

    I just doubled my ADC experience :) Not sure any other examples or methods provide for reading an array of ADC pins, seemed I saw this once - so stopped looking when I found it.

    Here's a quick...
  28. Look at the ADC library included in TeensyDuino...

    Look at the ADC library included in TeensyDuino Installer: pedvide.github.io/ADC/docs/Teensy_4_html/namespace_a_d_c__settings.html
    > there may be a better example with more tricks
    > maybe 12 bits...
  29. @KurtE's example shows no diff in timing or...

    @KurtE's example shows no diff in timing or values if using local or glabal variables.

    This edit shows that it can do two things in the same time:


    G 33335 2280707264
    L 33335 2280707264
    ...
  30. In order to assign that bool a compare is needed?...

    In order to assign that bool a compare is needed? And then testing the 'extra' bool? That may not save anything depending how and where tested?

    As @KurtE notes - best to get it working properly...
  31. using ARM_DWT_CYCCNT: uint32_t myTime =...

    using ARM_DWT_CYCCNT:


    uint32_t myTime = ARM_DWT_CYCCNT;
    // do someting
    myTime = ARM_DWT_CYCCNT - myTime -2; // ARM_DWT_CYCCNT can wrap in use - but the uint32_t math will return the proper...
Results 1 to 31 of 31