**0**

Hi, Iam making a load indicator with HX711.My Problem is with negetive numbers and minus sign.Iam using 4 digit seven segment display.fourth display is dedicated to minus sign.By my code i get values blinking on seven segment display.Minus sign also blinks.Negetive value does not go below -009,it hangs up here then i have to restart my hardware.below is my code.Code:Device = 16F877AXtal = 20 TRISA=%00000011 TRISB=0 TRISD=%11110000 TRISC=%00010000 Dim DG As Byte Dim DIGIT As Byte Dim n As Float Dim countt As Byte Dim cnt As Word Dim dg1 As Byte Dim dg2 As Byte Dim DG3 As Byte Dim dg4 As Byte Dim telbit As Byte Dim telbitt As Byte Dim teller As Byte Dim coun As SWord Dim i As Byte Dim gram As Float Dim adjval As Float Dim disval As Float Symbol ADDO = PORTC.4 Symbol ADSK = PORTC.5 Symbol TARE PORTD.4 Symbol UP PORTD.5 Symbol DOWN PORTD.6 Symbol SETT PORTD.7 MAIN: If n<0 Then GoSub NEGETIVE ;minus sign ADDO=1 ;hx711 code ADSK=0 coun=0 While ADDO=1:Wend For i= 0 To 23 ADSK=1 coun=coun<<1 ADSK=0 If ADDO =1 Then Inc coun Next i ADSK=1 coun=coun^0x800000 gram=8388608-coun gram=gram/100 n=gram ADSK=0 GoSub ZERO GoSub DISPLAY GoSub DIGITCALC GoTo MAIN ZERO: If TARE=1 Then adjval=gram EndIf disval=gram-adjval n=disval GoSub DISPLAY GoSub DIGITCALC GoTo MAIN NEGETIVE: ;minus sign DG=%01000000 PORTB=DG PORTD.3=1 DelayUS 1000 PORTD.3=0 GoSub DISPLAY GoSub DIGITCALC GoTo MAIN DISPLAY: ;breaking digits into 4 display For countt=0 To 99 'PORTB=dg1 'PORTD.3=1 'DelayUS 100 'PORTD.3=0 PORTB=dg2 PORTD.2=1 DelayUS 100 PORTD.2=0 PORTB=DG3 PORTD.1=1 DelayUS 100 PORTD.1=0 PORTB=dg4 PORTD.0=1 DelayUS 100 PORTD.0=0 Next countt Return '________________________________________________________________ '__________________________________________________________________________ DIGITCALC: ;data to each display ones,tens,hundred,thousands DIGIT=0 'LP1: 'If n<1000 Then DS1 'n=N-1000 'DIGIT=DIGIT+1 'GoTo LP1 'DS1: 'GoSub FND 'dg1=DG DIGIT=0 LP2: If n<100 Then DS2 n=N-100 DIGIT=DIGIT+1 GoTo LP2 DS2: GoSub FND dg2=DG DIGIT=0 LP3: If n<10 Then DS3 n=N-10 DIGIT=DIGIT+1 GoTo LP3 DS3: GoSub FND DG3=DG 'DG3=128 | dg DIGIT=n GoSub FND dg4=DG Return '__________________________________________________________________________ '__________________________________________________________________________ FND: ;data for each segment. FND0: ;zero If DIGIT>0 Then FND1 DG=%00111111 GoTo FNDEND FND1: ;one If DIGIT>1 Then FND2 DG=%00000110 GoTo FNDEND FND2: ;two If DIGIT>2 Then FND3 DG=%01011011 GoTo FNDEND FND3: ;three If DIGIT>3 Then FND4 DG=%01001111 GoTo FNDEND FND4: ;four If DIGIT>4 Then FND5 DG=%01100110 GoTo FNDEND FND5: ;five If DIGIT>5 Then FND6 DG=%01101101 GoTo FNDEND FND6: ;six If DIGIT>6 Then FND7 DG=%01111100 GoTo FNDEND FND7: If DIGIT>7 Then FND8 ;seven DG=%00000111 GoTo FNDEND FND8: ;eight If DIGIT>8 Then FND9 DG=%01111111 GoTo FNDEND FND9: DG=%01100111 ;nine FNDEND: Return '_____________________________