manoj soorya
Member
How is it compile? Can some one can do that make the hex file?
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.
You are in a hard place.I am using MPlab 8.33. Its support MPASMWIN 5.31.... This source not run on MPASMWIN 5.31. Got error.
No. The code I posted is not just for reference, it does function and you can use it as the basis for a source file you can build with your MPLAB tools. But I did make this more difficult for you by posting the list file output from the assembly rather than the source file.Hi Dan
Is it Just a reference only?
OK.... I Got it. Thank you so much for your hard work.
3 - To test how committed you are to learning how to write assembly language programs.
list n=0, c=150, r=dec
; File: main.asm
; Target: PIC12F675
; Created: 2018-02-23
; Author: Dan1138
;*********************************************************************
; ___ ___
; VDD ->|1 U 8|<- VSS
; LED1 <>|2 7|<> LED3
; LED2 <>|3 6|<> LED4
; SW1n ->|4 5|<> LED5
; ¯¯¯¯¯¯¯
; PIC12F675
;
;*********************************************************************
;
; If the switch is Press and hold (My timer output is enable for 1 Minute minimum) either Press, all LED will be ON.
; After 1 Second, LED 1 Turn Off,
; After 2 Second, LED 2 Turn Off
; After 4 Second, LED 3 Turn Off
; After 6 Second, LED 4 Turn Off
; After 8 Second, LED 5 Turn Off.
;
; (5 LED is used for Manual Timer selection for the Motor will Enable..)
;
;*********************************************************************
; See: https://www.electro-tech-online.com/threads/fish-feeder-idea-help-regards.153045/
;*********************************************************************
#include <p12f675.inc>
LIST
;==========================================================================
; MPASM PIC12F675 processor include
;
; (c) Copyright 1999-2013 Microchip Technology, All rights reserved
;==========================================================================
LIST
errorlevel -302 ; suppress banksel warni ng messages
__CONFIG _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON & _CP_OFF & _CPD_OFF
#define TIMER0_INTERRUPTS_PER_SECOND D'4000'
#define LED1 GPIO,5
#define LED2 GPIO,4
#define LED3 GPIO,0
#define LED4 GPIO,2
#define LED5 GPIO,1
#define SW1n GPIO,3
ISR_DATA udata_shr 0x20
WREG_save res 1
STATUS_save res 1
TIMER_DATA udata_shr
IntsInOneSecond res 2
Seconds res 1
RESET_CODE CODE 0x000
goto Start
ISR_CODE CODE 0x004
movwf WREG_save
movf STATUS,W
movwf STATUS_save
btfsc INTCON,TMR0IE
btfss INTCON,TMR0IF
goto ISR_Exit
bcf INTCON,TMR0IF
movlw 256-250+3
addwf TMR0,F
movlw -1
addwf IntsInOneSecond,F
skpc
addwf IntsInOneSecond+1,F
skpnc
goto ISR_Exit
movlw HIGH(TIMER0_INTERRUPTS_PER_SECOND-1)
movwf IntsInOneSecond+1
movlw LOW(TIMER0_INTERRUPTS_PER_SECOND-1)
movwf IntsInOneSecond
incf Seconds,F
ISR_Exit:
movf STATUS_save,W
movwf STATUS
swapf WREG_save,F
swapf WREG_save,W
retfie
START_CODE CODE
Start:
btfsc STATUS,RP0
goto OscillatorCalibrationFailed
banksel OSCCAL
call GetOSCCAL
movwf OSCCAL
OscillatorCalibrationFailed:
banksel ANSEL
clrf ANSEL
clrf TRISIO
movlw B'11011111'
movwf OPTION_REG
banksel INTCON
clrf INTCON
clrf GPIO
movlw 0x07
movwf CMCON
movlw HIGH(TIMER0_INTERRUPTS_PER_SECOND-1)
movwf IntsInOneSecond+1
movlw LOW(TIMER0_INTERRUPTS_PER_SECOND-1)
movwf IntsInOneSecond
clrf Seconds
clrf TMR0
movlw 256-250+3
addwf TMR0,F
bsf INTCON,TMR0IE
bsf INTCON,GIE
AppStart:
clrf GPIO
AppLoop:
btfsc SW1n
goto AppLoop
bcf INTCON,TMR0IE
movlw HIGH(TIMER0_INTERRUPTS_PER_SECOND-1)
movwf IntsInOneSecond+1
movlw LOW(TIMER0_INTERRUPTS_PER_SECOND-1)
movwf IntsInOneSecond
clrf Seconds
movlw B'00110111' ; LED1-5 on
movwf GPIO
bsf INTCON,TMR0IE
AppTimeout:
movf Seconds,W
xorlw D'1'
skpnz
goto LED1_off
xorlw D'1'^D'2'
skpnz
goto LED2_off
xorlw D'2'^D'4'
skpnz
goto LED3_off
xorlw D'4'^D'6'
skpnz
goto LED4_off
xorlw D'6'^D'8'
skpnz
goto LED5_off
xorlw D'8'
sublw D'8'
skpc
goto WaitForButtonUp
CheckSwitch:
btfsc SW1n
goto AppStart
goto AppTimeout
;
;
;
WaitForButtonUp:
btfsc SW1n
goto AppStart
goto WaitForButtonUp
;
;
;
LED1_off:
movlw B'00010111' ; LED1 off
movwf GPIO
goto CheckSwitch
LED2_off:
movlw B'00000111' ; LED1-2 off
movwf GPIO
goto CheckSwitch
LED3_off:
movlw B'00000110' ; LED1-3 off
movwf GPIO
goto CheckSwitch
LED4_off:
movlw B'00000010' ; LED1-4 off
movwf GPIO
goto CheckSwitch
LED5_off:
movlw B'00000000' ; LED1-5 off
movwf GPIO
goto CheckSwitch
OSCCAL_CODE CODE 0x3ff
GetOSCCAL:
end
[end code]
is it okey, Dan?
This is in essence a test of your experience.
And this is the simulation LOG on Proteus. Simulation working 100% as I suggest.
https://image.ibb.co/f8fsFx/11.jpg
Is this OK on real Hardware?
3 - To test how committed you are to learning how to write assembly language programs.