RobTillaart / HX711

Arduino library for HX711 24 bit ADC used for load cells and scales.
MIT License
86 stars 29 forks source link

Fast processor read() delay #46

Closed palmerr23 closed 8 months ago

palmerr23 commented 8 months ago

Thanks for the library, it works well!

To answer the question embedded in the code at line 135 in the cpp file, you do not need the delayMicroseconds(1) for a Pico running at 240MHz (PD_SCK is 500nS) in _shiftIn( ) or read( ).

The delay( ) treatment should probably be the same in both places.

It would be useful, however to have an option, as a Teensy 4 and other processors running at > 500MHz are likely to need them in both read( ) and _shiftIn( ).

  while (m > 0)
  {
    //  delayMicroSeconds(1) needed for fast processors?
    digitalWrite(_clockPin, HIGH);
    if(_fast_processor)
    delayMicroseconds(1);
    digitalWrite(_clockPin, LOW);
    if(_fast_processor)
    delayMicroseconds(1);
    m--;
  }

BTW, I tested the B input and it seems fine.

A pull request will be forthcoming.

I hope this is useful.

RobTillaart commented 8 months ago

Thanks for this feedback, Definitely useful to hear.

RobTillaart commented 8 months ago
RobTillaart commented 8 months ago

@palmerr23 HX711 & HX711_MP released Again thanks for your addition / feedback