I used another one and the same result.
This pin is not connected yet so outer components don't interfere.
Here's the whole code. It is a POT command replacement that fits to my circuit (RC = 420 µs). Normally Wert is replaced by Wert2's contents.
If you are not german, you should understand it anyway(Wert means value, Zaehler = counter, Gelb = yellow and Gruen = green)...
Code:
Define OSC 8
Variablen:
PORTA=0
TRISA=0
CMCON=7
TRISB = 0
PORTA = 0
;VRCON = $20
Gruene_LED VAR PORTB.5
Gelbe_LED VAR PORTB.4
ADCWert VAR WORD
Erster_Wert VAR WORD
Zweiter_Wert VAR WORD
Zaehler VAR WORD
Zahl VAR BYTE
;Interrupts
INTCON = 0
Start:
Zahl = 0
FOR Zahl = 1 TO 4
High Gelbe_LED
Pause 167
Low Gelbe_LED
Pause 307
NEXT Zahl
GOSUB Wert
Erster_Wert = ADCWert
WRITE 0, Erster_Wert.BYTE0
WRITE 1, Erster_Wert.BYTE1
Pause 2931
Zahl = 0
FOR Zahl = 1 TO 4
High Gruene_LED
Pause 167
Low Gruene_LED
Pause 307
NEXT Zahl
GOSUB Wert
Zweiter_Wert = ADCWert
WRITE 2, Zweiter_Wert.BYTE0
WRITE 3, Zweiter_Wert.BYTE1
Pause 2791
IF Erster_Wert = Zweiter_Wert THEN
High Gelbe_LED
Pause 3140
Low Gelbe_LED
Pause 2010
ENDIF
IF Erster_Wert <> Zweiter_Wert THEN
High Gruene_LED
Pause 3140
Low Gruene_LED
Pause 2010
ENDIF
GOTO Start
Wert:
HIGH PORTA.3
PAUSE 5000
LOW PORTA.3
RETURN
Wert2:
ADCWert = 0
Trisa.3 = 0
High Porta.3
Pause 243
Trisa.3 = 1 ;Vertrauscht
WHILE Porta.3 = 1
ADCWert = ADCWert + 1
WEND
Zaehler = 600 - ( (600 / 1200) * ADCWert)
Pauseus Zaehler
RETURN
END
Which thread are you referring to ?
Bookmarks