Microcontroller › PIC › PIC Programming Help. Creating a counter but I have some errors in my code
- This topic has 0 replies, 1 voice, and was last updated 9 years, 11 months ago by Liam Porter.
Viewing 1 post (of 1 total)
-
AuthorPosts
-
January 11, 2015 at 11:22 pm #3313Liam PorterParticipant
I am attempting to create a simple counter on a PIC16F628A board that will have two inputs, one to increase value, one to decrease and the values will be displayed on a 7 segment display. I have written my code but when I attempt to compile I get these error codes:
Counter.asm:42:Error[118] Overwriting previous address contents: 0x0000 Counter.asm:63:Warning[202] Argument out of range. Least significant bits used. 35 <0x23>
Can anyone help identify where the problem is?
<code>LIST P=16f84A, R=Dec
__FUSES _XT_OSC & _WDT_OFF & _CP_OFF & _PWRTE_ONinclude “P16f84A.inc”CBLOCK 0x20W_TEMPSTATUS_TEMPCOUNTERFLAGSFILTR1FILTR2ENDC#DEFINE ST_BT1 FLAGS,0#DEFINE ST_BT2 FLAGS,1MIN EQU .0 ;minimum counter valueMAX EQU .15 ;maximum counter valueT_FILTR EQU .255CMCONmovlw 0x07movwf CMCON;resetORG 0x00GOTO startORG 0x04RETFIEDISP7MOVF COUNTER,WANDLW B’0001111′ADDWF PCL,FLAGS;RETLW b’11101110′ ;digit 0RETLW b’00101000′ ;digit 1RETLW b’11001101′ ;digit 2RETLW b’01101101′ ;digit 3RETLW b’00101011′ ;digit 4RETLW b’01100111′ ;digit 5RETLW b’11100111′ ;digit 6RETLW b’00101100′ ;digit 7RETLW b’11101111′ ;digit 8RETLW b’00101111′ ;digit 9RETLW b’10101111′ ;ARETLW b’11100011′ ;BRETLW b’11000110′ ;CRETLW b’11101001′RETLW b’11000111′ ;ERETLW b’10000111′ ;FstartBCF STATUS,RP0MOVLW B’00000111′MOVWF CMCONBSF STATUS,RP0MOVLW B’00000110′MOVWF TRISAMOVLW B’00000000′MOVWF TRISBMOVLW B’10000000′MOVWF OPTION_REGMOVLW B’00000000′MOVWF INTCONBCF STATUS,RP0CLRF PORTACLRF PORTBCLRF FLAGSMOVLW MINMOVWF COUNTERGOTO DISPUPMAINMOVLW T_FILTRMOVWF FILTR1MOVWF FILTR2CHECK_BUTTON1BTFSC PORTA,1 ;is button 1 pressedGOTO BUTTON1_RELEASED;yesDECFSZ FILTR1,FGOTO CHECK_BUTTON1BTFSS ST_BT1GOTO DECGOTO CHECK_BUTTON2BUTTON1_RELEASEDBCF ST_BT1CHECK_BUTTON2BTFSC PORTA,2GOTO BUTTON2_RELEASEDDECFSZ FILTR2,FGOTO CHECK_BUTTON2BTFSS ST_BT2GOTO INCGOTO MAINBUTTON2_RELEASEDBCF ST_BT2GOTO MAINDECBSF ST_BT1MOVF COUNTER,WXORLW MINBTFSC STATUS,ZGOTO MAINDECF COUNTER,FGOTO DISPUPINCBSF ST_BT2MOVF COUNTER,WXORLW MAXBTFSC STATUS,ZGOTO MAININCF COUNTER,FGOTO DISPUPDISPUPCALL DISP7MOVWF PORTBGOTO MAINEND <code> -
AuthorPosts
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.