Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

pic16f877a assembly langauage code errors

Status
Not open for further replies.

Osama Javed

Newbie level 6
Newbie level 6
Joined
Dec 15, 2012
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Pakistan
Activity points
1,383
I have written a code in assembly language for the Generator autostart and off circuitry. I have tried compiling it in MPLAB but it is giving me so many errors. The code is for PIC16f877a.

Can anyone tell me what to include or what to remove so that my code works fine. I have not included any header file or anything yet.
I am a new user to PIC and MPLAB. Kindly guide me about this.

The code is attached here with this message below:



_main:

;Auto-start.c,4 :: void main()

{
;Auto-start.c,5 :: ADCON1=0x04; // Set all pins as digital I/O
MOVLW 4
MOVWF ADCON1+0
;Auto-start.c,7 :: TRISA=0xff;
MOVLW 255
MOVWF TRISA+0
;Auto-start.c,8 :: TRISB=0x00;
CLRF TRISB+0
;Auto-start.c,10 :: PORTB=0x02;
MOVLW 2
MOVWF PORTB+0
;Auto-start.c,11 :: while(1)
L_main0:
;Auto-start.c,14 :: if(PORTA.B2 && ADC_Read(0)<400)

{
BTFSS PORTA+0, 2
GOTO L_main4
CLRF FARG_ADC_Read_channel+0
CALL _ADC_Read+0
MOVLW 1
SUBWF R0+1, 0
BTFSS STATUS+0, 2
GOTO L__main18
MOVLW 144
SUBWF R0+0, 0
L__main18:
BTFSC STATUS+0, 0
GOTO L_main4
L__main16:
;Auto-start.c,15 :: do{
L_main5:
;Auto-start.c,16 :: PORTB.B0=0;
BCF PORTB+0, 0
;Auto-start.c,17 :: PORTB.B1=0;
BCF PORTB+0, 1
;Auto-start.c,18 :: Delay_ms(500);
MOVLW 6
MOVWF R11+0
MOVLW 19
MOVWF R12+0
MOVLW 173
MOVWF R13+0
L_main8:
DECFSZ R13+0, 1
GOTO L_main8
DECFSZ R12+0, 1
GOTO L_main8
DECFSZ R11+0, 1
GOTO L_main8
NOP
NOP
;Auto-start.c,19 :: }while(ADC_Read(0)<400);
CLRF FARG_ADC_Read_channel+0
CALL _ADC_Read+0
MOVLW 1
SUBWF R0+1, 0
BTFSS STATUS+0, 2
GOTO L__main19
MOVLW 144
SUBWF R0+0, 0
L__main19:
BTFSS STATUS+0, 0
GOTO L_main5
;Auto-start.c,20 :: }
GOTO L_main9
L_main4:
;Auto-start.c,21 :: else if(PORTA.B2 && ADC_Read(0)>=400){
BTFSS PORTA+0, 2
GOTO L_main12
CLRF FARG_ADC_Read_channel+0
CALL _ADC_Read+0
MOVLW 1
SUBWF R0+1, 0
BTFSS STATUS+0, 2
GOTO L__main20
MOVLW 144
SUBWF R0+0, 0
L__main20:
BTFSS STATUS+0, 0
GOTO L_main12
L__main15:
;Auto-start.c,22 :: PORTB.B0=1;
BSF PORTB+0, 0
;Auto-start.c,23 :: PORTB.B1=1;
BSF PORTB+0, 1
;Auto-start.c,24 :: Delay_ms(50000);
MOVLW 2
MOVWF R10+0
MOVLW 252
MOVWF R11+0
MOVLW 77
MOVWF R12+0
MOVLW 203
MOVWF R13+0
L_main13:
DECFSZ R13+0, 1
GOTO L_main13
DECFSZ R12+0, 1
GOTO L_main13
DECFSZ R11+0, 1
GOTO L_main13
DECFSZ R10+0, 1
GOTO L_main13
NOP
NOP
;Auto-start.c,25 :: }
GOTO L_main14
L_main12:
;Auto-start.c,27 :: PORTB.B0=0;
BCF PORTB+0, 0
;Auto-start.c,28 :: PORTB.B1=1;
BSF PORTB+0, 1
;Auto-start.c,29 :: }
L_main14:
L_main9:
;Auto-start.c,30 :: }
GOTO L_main0
;Auto-start.c,31 :: }
L_end_main:
GOTO $+0
; end of _main
 

Attachments

  • Auto-start circuit.txt
    2.7 KB · Views: 69

At least you should include the definitions for the uC you are using.
Example:
list p=16f887a
include <P16f887a.INC>
errorlevel -305,-302
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top