Log in

View Full Version : HX711 driver code



povulon
- 24th January 2018, 05:40
Hi

I have 18F452 pic . I want to use HX711 chip with 18F452 . I searched example code on the internet . But I cant find the example code that is written by pic basic

Please help me

Yvesmazzon
- 23rd February 2018, 06:59
Hello Povulon,

Did you had any luck with the HX711 code?
Regards,

Yves

CuriousOne
- 27th April 2021, 10:23
And now I have the same question :D

pedja089
- 27th April 2021, 15:01
You can try this:


Hx711Cnt var Word
I var Byte
GraM var word
GraMM var word
SigN var byte

Symbol dataa = PORTB.2
Symbol clock = PORTB.3
input dataa
output clock

I=0
LoadCellA:
dataa = 1:clock = 0: Hx711Cnt = 0
While dataa = 1 : Wend
For i = 0 To 15
High clock
Hx711Cnt = Hx711Cnt <<1
Low clock
if dataa=1 then Hx711Cnt=Hx711Cnt+1
Next
High clock
Hx711Cnt = Hx711Cnt^32768
gram=32768-Hx711Cnt
'gram=gram-65477' zero
IF gram.15 THEN 'negative values
gram = ~gram + 1
Sign = "-"
else
Sign=" "
ENDIF

disable
gram=gram*11627 'scale values
gramm=div32 10000
enable

LCDOUT $FE, 1
LcdOut $FE,$80, "Tara=",sign,dec(gramm)
pause 100
GoTo LoadCellA
end
EDIT: Not my code, but I helped to make it work...

CuriousOne
- 28th April 2021, 09:39
Thanks, will give it a try!