Hi All
I'm just starting out with PIC programming and try calling assembly from c,here is some error i dont know how to solve ,can someone help me, one is asm file ,another is c file
Executing: "D:\MCC18\mpasm\MPASMWIN.exe" /q /p18F4620 "asm.asm" /l"asm.lst" /e"asm.err" /o"asm.o" /d__DEBUG=1 /d__MPLAB_DEBUGGER_ICD2=1
Warning[205] D:\STEPPERMOTOR\ASM.ASM 1 : Found directive in column 1. (INCLUDE)
Warning[205] D:\STEPPERMOTOR\ASM.ASM 2 : Found directive in column 1. (CODE)
Warning[203] D:\STEPPERMOTOR\ASM.ASM 9 : Found opcode in column 1. (MOVLW)
Warning[203] D:\STEPPERMOTOR\ASM.ASM 10 : Found opcode in column 1. (DECF)
Warning[203] D:\STEPPERMOTOR\ASM.ASM 11 : Found opcode in column 1. (BNZ)
Warning[203] D:\STEPPERMOTOR\ASM.ASM 13 : Found opcode in column 1. (RETURN)
Warning[205] D:\STEPPERMOTOR\ASM.ASM 15 : Found directive in column 1. (GLOBAL)
Warning[205] D:\STEPPERMOTOR\ASM.ASM 16 : Found directive in column 1. (END)
Executing: "D:\MCC18\mpasm\MPASMWIN.exe" /q /p18F4620 "D:\WSC\steppermotor\ButtonPress.asm" /l"ButtonPress.lst" /e"ButtonPress.err" /o"ButtonPress.o" /d__DEBUG=1 /d__MPLAB_DEBUGGER_ICD2=1
Error[124] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 2 : Illegal argument (expected 0, 1, 2, or +|-<message number>)
Warning[205] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 6 : Found directive in column 1. (INCLUDE)
Warning[205] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 9 : Found directive in column 1. (EXTERN)
Warning[205] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 10 : Found directive in column 1. (CODE)
Error[128] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 31 : Missing argument(s)
Error[128] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 39 : Missing argument(s)
Error[128] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 50 : Missing argument(s)
Warning[205] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 56 : Found directive in column 1. (GLOBAL)
Warning[205] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 57 : Found directive in column 1. (END)
Halting build on first failure as requested.
I'm just starting out with PIC programming and try calling assembly from c,here is some error i dont know how to solve ,can someone help me, one is asm file ,another is c file
Code:
INCLUDE "p18f4620.inc"
EXTERN SW2,ButtonState
CODE
asm_ButtonPress
ButtonPress
movlw high DebounceStates
movwf PCLATH
movf ButtonState,w
andlw 0x03
addlw low DebounceStates
btfsc STATUS,C
incf PCLATH,f
movwf PCL
DebounceStates
goto DebounceState0
goto DebounceState1
goto DebounceState2
goto DebounceState1
DebounceState0 ; Wait for a Button Press
bcf STATUS,C
btfsc SW2
goto EndDebounceState0
incf ButtonState,f
bsf STATUS,C
EndDebounceState0
return
DebounceState1
btfss SW2
goto EndDebounceState1
incf ButtonState,f
clrf TMR1L
clrf TMR1H
bcf PIR1,TMR1IF
EndDebounceState1
bcf STATUS,C
return
DebounceState2
btfss SW2
decf ButtonState,f
btfsc PIR1,TMR1IF
clrf ButtonState
bcf STATUS,C
return
GLOBAL asm_ButtonPress
END
Code:
#include <p18f4620.h>
#include"define.h"
#define SW2 PORTAbits.RA4
#pragma config OSC=INTIO67
#pragma config WDT=OFF
#pragma config LVP=OFF
#pragma config DEBUG=ON
#pragma config FCMEN=OFF
#pragma config IESO=OFF
#pragma config PWRT=OFF
#pragma config BOREN=OFF
#pragma config BORV=3
#pragma config WDTPS=1
#pragma config MCLRE=ON
#pragma config LPT1OSC=OFF
#pragma config PBADEN=OFF
#pragma config CCP2MX=PORTC
unsigned char State,Index,Mode,StepModeScaler,
Counter, Speed,ButtonState ;
void ButtonPress(void);
void InitializeBoardConfig(void)
{
TRISCbits.TRISC2=0; //make rc2 ccp1 output
TRISD=0xB; //make RD2 RD4-RD7 output
OSCCONbits.IRCF0=1;
OSCCONbits.IRCF1=1;
OSCCONbits.IRCF2=1; //SET internal oscillator to 8 MHZ
ADCON1=0b01010000; //Fosc/16
//enable AN0
PR2=0x3F; //31.2 kHz PWM
T0CON=0; //1:2 prescaler for TMR0
TRISD=0b00000000;
TRISC=0; //turn off windings
ADCON0=0b00000001; // left justified, AN0 selected, module
CMCON=7; //turn off comparators
CCPR1L=0;
CCPR2L=0;
CCP1CON=0b00001100; //pwm mode
CCP2CON=0b00001100;
T2CONbits.TMR2ON=1; //turn on Timer 2
T1CONbits.TMR1ON=1; //turn on Timer 1char
State=0; //initialize motor state pointer and duty cycle
Index = 0; //index pointer
Mode = 0;
ADRESH =0;
StepModeScaler =1;
Counter = 1;
Speed= 0;
ButtonState =0;
}
// Main - Choose motor mode//
void T0Delay()
{
T0CON=0x0;
TMR0H=0xF3;
TMR0L=0xC8;
T0CONbits.TMR0ON=1;
while (INTCONbits.TMR0IF==0);
T0CONbits.TMR0ON=0;
INTCONbits.TMR0IF=0;
}
extern void asm_timed_delay (unsigned char);
extern void asm_ButtonPress();
void main(void)
{
InitializeBoardConfig();
if( INTCONbits.TMR0IF==1)
INTCONbits.TMR0IF=0;
else
asm_ButtonPress();
Mode++;
asm_timed_delay (0x80);
}
Executing: "D:\MCC18\mpasm\MPASMWIN.exe" /q /p18F4620 "asm.asm" /l"asm.lst" /e"asm.err" /o"asm.o" /d__DEBUG=1 /d__MPLAB_DEBUGGER_ICD2=1
Warning[205] D:\STEPPERMOTOR\ASM.ASM 1 : Found directive in column 1. (INCLUDE)
Warning[205] D:\STEPPERMOTOR\ASM.ASM 2 : Found directive in column 1. (CODE)
Warning[203] D:\STEPPERMOTOR\ASM.ASM 9 : Found opcode in column 1. (MOVLW)
Warning[203] D:\STEPPERMOTOR\ASM.ASM 10 : Found opcode in column 1. (DECF)
Warning[203] D:\STEPPERMOTOR\ASM.ASM 11 : Found opcode in column 1. (BNZ)
Warning[203] D:\STEPPERMOTOR\ASM.ASM 13 : Found opcode in column 1. (RETURN)
Warning[205] D:\STEPPERMOTOR\ASM.ASM 15 : Found directive in column 1. (GLOBAL)
Warning[205] D:\STEPPERMOTOR\ASM.ASM 16 : Found directive in column 1. (END)
Executing: "D:\MCC18\mpasm\MPASMWIN.exe" /q /p18F4620 "D:\WSC\steppermotor\ButtonPress.asm" /l"ButtonPress.lst" /e"ButtonPress.err" /o"ButtonPress.o" /d__DEBUG=1 /d__MPLAB_DEBUGGER_ICD2=1
Error[124] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 2 : Illegal argument (expected 0, 1, 2, or +|-<message number>)
Warning[205] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 6 : Found directive in column 1. (INCLUDE)
Warning[205] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 9 : Found directive in column 1. (EXTERN)
Warning[205] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 10 : Found directive in column 1. (CODE)
Error[128] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 31 : Missing argument(s)
Error[128] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 39 : Missing argument(s)
Error[128] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 50 : Missing argument(s)
Warning[205] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 56 : Found directive in column 1. (GLOBAL)
Warning[205] D:\WSC\STEPPERMOTOR\BUTTONPRESS.ASM 57 : Found directive in column 1. (END)
Halting build on first failure as requested.