Shop OBEX P1 Docs P2 Docs Learn Events
HX711 Driver (My first PASM code!) — Parallax Forums

HX711 Driver (My first PASM code!)

Hello all. I've been playing with the propeller 1 off and on for many years now and PASM always seemed like complete wizardry to me. I'm currently involved in a project where I need to read load cells and found the HX711 breakout modules online for cheap, but there didn't seem to be a driver for the propeller yet. The communication protocol for the HX711 seemed simple enough so I decided to give it a shot in PASM and was able to produce a working result!

I'd like to share it with others and get it posted to the OBEX, but wanted to see if there was any constructive criticism first.

Comments

  • JonnyMacJonnyMac Posts: 8,923
    edited 2022-04-29 00:43

    I wrote a Spin1 object for the HX711 for a work project, and then translated it to the P2 where I converted the Spin1 SPI code to inline PASM2. You might find it interesting. What you'll note about PASM2 is that it's much more concise than PASM1.

  • See my post here for any filtering ideas ....

    https://forums.parallax.com/discussion/comment/1520585/#Comment_1520585

    I designed a load cell combiner around the HX711 that communicated in "MODBUS" style packets to a main controller.

  • @JonnyMac

    Very cool. I have yet to experiment with the P2, but the inline PASM seems like a huge benefit. Forgive my ignorance, but it looks like the bit-banging is happening in the spin code after the PASM, if so, what does that chunk of PASM afford you?

    @"Beau Schwabe"

    That's a pretty board, and I will certainly look to use that filtering if I need better sensitivity and response time. Are the MODBUS packets being generated on that board?

  • JonnyMacJonnyMac Posts: 8,923
    edited 2022-04-29 14:31

    Forgive my ignorance, but it looks like the bit-banging is happening in the spin code after the PASM, if so, what does that chunk of PASM afford you?

    That section is commented out -- it was my reference for writing the PASM2 code above it. That PASM2 code is doing the work in that method.

  • That section is commented out -- it was my reference for writing the PASM2 code above it. That PASM2 code is doing the work in that method.

    Of course it is. I would have noticed that had I looked at it in the prop tool instead of notepad.

  • @msg558 said:
    @"Beau Schwabe"
    That's a pretty board, and I will certainly look to use that filtering if I need better sensitivity and response time. Are the MODBUS packets being generated on that board?

    Thanks... Yes the response packets are generated on that board since it is operating as a slave. The request packets are generated on another board acting as the master.
    On the slave board there is a 16F15323 programmed in pure assembly that talks to the HX711 and listens/responds to the MODBUS requests. There are about 10 different request commands that it processes.

Sign In or Register to comment.