12/29/2015

Three phase latching relay programming for PIC Microcontroller 16f873A

During on condition i need to check the continuity of relay contacts. For that i gave +5v supply to the relay contacts output of this contact is given to microcontroller 25th pin. If the relay contact is working, I will increase the relay test count and this count should written into the EEPROM.I f relay contact is not working microcontroller should wait until the contact works.


TEST BSF PORTB,2 ;Set Turn off Relay
CALL DELAY
BCF PORTB,2 ;Clear Turn off Rly
CALL DELAY
CALL DELAY
CALL DELAY
CLRF PORTB
BSF PORTB,1 ;Set Turn on Rly
CALL DELAY
BCF PORTB,1 ;Clear Turn on Rly
CALL DELAY
CALL DELAY
CALL DELAY
MOVF PORTB,W
MOVWF CTAT_STATUS
BTFSS CTAT_STATUS,4
GOTO $-3
MOVLW 01H
MOVWF DATA_EE_ADDR
CALL READ
MOVWF DATA_TCNTL
MOVLW 00H
MOVWF DATA_EE_ADDR
CALL READ
MOVWF DATA_TCNTH
INCFSZ DATA_TCNTL,1
GOTO STORE
INCFSZ DATA_TCNTH,1
GOTO STORE
STORE MOVF DATA_TCNTL,W
MOVWF DATA_EE_DATA
MOVLW 01H
MOVWF DATA_EE_ADDR
CALL WRITE
MOVF DATA_TCNTH,W
MOVWF DATA_EE_DATA
MOVLW 00H
MOVWF DATA_EE_ADDR
CALL WRITE
GOTO TEST


If the code do not work on the application then follow the instructions connect ground to relay contact and check for 0 in program also have a pull up for Microcontroller pin for current program go for pull down resistor that should solve your problem.

No comments:

Post a Comment

Interfacing LCD With Arduino Microcontroller

In this tutorial we are going to  interface a  Liquid Crystal Display (LCD)  with Arduino Microcontroller .  Liquid Crystal Display are us...