Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#include "p16F628.inc" ; This includes PIC16F628 definitions for the MPASM assembler
__CONFIG _CP_OFF & _WDT_ON & _PWRTE_ON & _RC_OSC
ORG 0x000
GOTO Init
ORG 0x004
GOTO Main
Init
BSF 03H, 5 ; go to bank 1
movlw 0X00
movwf PORTA ; porta all output
movlw 0XFF
movwf PORTB ; portb all input
clrw
bcf 03H,5 ; return to bank 0
bsf PORTA,4 ; Turn on Operation LED
btfss PORTB,3 ; If PortB,3 (Upper Sensor) = high
bcf PORTA,0 ; Turn off Refill Systems
btfss PORTB,3 ; If PortB,3 (Upper Sensor) = high
bcf PORTA,3 ; Turn off Refill LED
btfss PORTB,3 ; If PortB,3 (Upper Sensor) = high
bcf PORTA,2 ; Turn off Warn LED
goto Main
Main
btfss PORTB,2 ;if port B,2 = low
bsf PORTA,3 ;Activate Warn LED
btfss PORTB,3 ;if port B,2 = low
bcf PORTA,4 ;Deactivate Operation LED
btfss PORTB,3 ;if port B,2 = low
bsf PORTA,2 ;Activate Refill LED
btfss PORTB,3 ;if port B,2 = low
bsf PORTA,0 ;Activate Refill Relay
btfsc PORTB,2 ;if port B,2 = high
btfsc PORTB,3 ;if port B,3 = high
bcf PORTA,0 ;Deactivate Refill Relay
btfsc PORTB,3 ;if port B,3 = high
bcf PORTA,2 ;Deactivate Refill LED
btfsc PORTB,3 ;if port B,3 = high
bcf PORTA,3 ;Deactivate Warn LED
btfsc PORTB,3 ;if port B,3 = high
bsf PORTA,4 ;Activate Operation LED
goto Main
But , how do we convert this file to hexa file. which software to use.
I can't see how it compiles correctly as your config line is wrong. _RC_OSC is not valid and should probably be _INTRC_OSC_NOCLKOUT for the internal oscillator. You also need to turn off the comparators (put 7 into CMCON).
Mike.
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _BODEN_OFF &_INTRC_OSC_NOCLKOUT & _MCLRE_ON & _LVP_OFF
ERRORLEVEL -302
Do the debouncing in code, it's mostly a simple delay.
Rather than insert a delay, you "poll" the inputs and use a register as a "flag file" to detect the condition of the switch(es). This allows you to use a display at a later date and not create any flashing on the display.