You can try this:
Code:
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...
Bookmarks