I'm working with a device that has an array of 102 sensors(link here). For each low-high transition detected on one of its inputs, it outputs an analog level according each sensor respectively. Once this occurs 102 times, you must wait a short period and can then begin again.

I was thinking of using a timer interrupt to generate each transition and sample the data into an array using the ADC, but am wondering if there is a better way to achieve this using an onboard peripheral (that wouldn't use up as many MCU clock cycles) . I am using a PIC32MX450 currently, but can change MCU if need be.

  • \$\begingroup\$ Which PIC32? There are thousands models from this family of uC. But I guess that all of them have DMA controller that allow to read ADC and store result somewhere in memory automatically. \$\endgroup\$ – Jakub Rakus Jun 29 '16 at 21:06
  • \$\begingroup\$ PIC32MX450 which does have DMA. I didn't realise it could be used to read ADC and store result to memory \$\endgroup\$ – Harry Wright Jun 29 '16 at 22:09
  • \$\begingroup\$ "needs to synchronously clock in analog data" ... synchronously with what, exactly? \$\endgroup\$ – Dave Tweed Jun 30 '16 at 2:09
  • 1
    \$\begingroup\$ What do you mean by "clocking in analog data"? You can clock a CPU, clock a D flip-flop, but you don't clock data. Do you mean "sample analog data when there is a transition on an input pin"? or "sample analog data regularily"? This is unclear as it is. \$\endgroup\$ – dim Jun 30 '16 at 7:47
  • \$\begingroup\$ apologies, I mean the MCU is controlling a clock pin. Every time this pin transitions from low to high the part I'm working with outputs the analog level of the next sensor which I need to sample and store in an array. \$\endgroup\$ – Harry Wright Jun 30 '16 at 9:09

The closest would be an SPI output (SCK, MOSI) from the micro, and writing 0x80 (MSB out) as the first byte, and 0x00 as the subsequent bytes to generate this pattern. You would probably have to tie the SCK back to an input on the micro to trigger the adc on each clock.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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