RadioLocman.com Electronics ru
Advanced Search +
  

02-14-2010

PIC diode tester

Manolis Xenias

This is a simple use of the PIC 16F84 about a diode tester.

Test procedure : We set «1» to PB0 and «0» to PB3. If diode is ok and opens, then at PA0 we have «1». If PA0 is «0», then the the diode has problem. With the program we manage what the PIC will do in each situation . If PA0 is «1», green led lights wich means that the diode is OK and if PA0 is «0» red led is lighting and the diode is problematic

PIC diode tester

Test continuous as follows: We give «0» at PB0 and «1» to PB3. If diode is OK and opens, then at PA0 is «1». If PA0 is «0», then diode has problem. If PA0 is «1», green led lights that means that diode is OK and if PA0 is «0» the red diode is lights that means the the diode is problematic.

Source Code

        LIST P=16F84, F=INHX8M
        INCLUDE 'PICREG.EQU'
REG1 	EQU 	0CH
REG2 	EQU 	0DH
	MOVLW	B'11111001'
	MOVWF	PORTB
	MOVLW	FFH
	MOLWF	PORTA
	ORG 	0FH
START	BSF	PORTB,0
	BCF	PORTB,3
	BTFSS	PORTA,0
	GOTO	ELEGXOS
	MOVLW	B'00000010'
	MOVWF	PORTB
	GOTO	START
ELEGXOS	MOVLW	B'00000100'
	MOVWF	PORTB
	BCF	PORTB,0
	BSF	PORTB,3
	BTFSS	PORTA,0
	GOTO	ELEGXOS2
	MOVLW	B'00000010'
	MOVWF	PORTB
ELEGXOS2MOVLW	B'00000100'
	MOVWF	PORTB

Slices ↓
Radiolocman facebook Radiolocman twitter Radiolocman google plus