View Full Version : 16F886 (illegal opcode CONFIG1)
MOUNTAIN747
- 17th January 2013, 21:47
I am adding DT’s INT_INT to an existing and functioning program I assembled with PM. Now using MPASM I am having problems with the config’s.
16F886, MicroCode Studio Plus, MPASM, internal osc @8Mhz
ERROR[122] (illegal opcode CONFIG1)
I found an example by mackrackit from 10JUNE,2010 and tried his example but it failed also.
I’m using:
@ __config _CONFIG1, (_INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF &_LVP_OFF & _CP_OFF)
OSCCON = %01110000
DEFINE OSC 8
I’ve tried with and without the comma (,) after CONFIG1, I’ve tried with and without the brackets, and the error always says “illegal opcode CONFIG1.” I've used CONFIG1 in upper case and lower case, no go!
Its got me stumped,Comments please!
Darrel Taylor
- 17th January 2013, 22:09
Are you sure you have the 16F886 selected in the Microcontroller dropdown box of MicroCode Studio?
MOUNTAIN747
- 17th January 2013, 22:16
16F886 is in the dropdown window! yep!
Darrel Taylor
- 17th January 2013, 23:03
Under View > Compile and Program Options > Assembler tab ...
Is the path above the Find buttons ... C:\Program Files\Microchip\MPASM Suite or C:\Program Files (x86)\Microchip\MPASM Suite for 64-bit systems?
If not, click the Find manually button and point it there.
MicroCode Studio will usually find the wrong path if you have more than one MPASMWIN on your computer.
MOUNTAIN747
- 17th January 2013, 23:16
My path is C:\Program Files\Microchip\MPASM Suite. Yes, I am aware of this Gottcha! I had to deal with it a few years ago. I double checked it to make sure something didn't revert back to the Wrong MPASM. This just doesn't make any since. I even tried to use @config (0x20F4) but that didn't work either. I also checked my spellling four times to make sure... what else?
MOUNTAIN747
- 17th January 2013, 23:22
Darrel, On the assembler tab page, what is INH8XM, INH8XS, and INHX32?
Darrel Taylor
- 17th January 2013, 23:39
Those specify the .HEX file format and should not be changed.
Later versions of MicroCode Studio have removed those options.
Please send me your .LST file after a failed compile.
MOUNTAIN747
- 17th January 2013, 23:57
You'll have to explain how I send it to you. I can't use Private Message.
Darrel Taylor
- 18th January 2013, 00:01
Darrel Taylor
- 18th January 2013, 01:22
Although the line you showed in post #1 had 2 underscores in __config and had a space after the @ sign ...
The .lst file shows that the actual line had only 1 underscore and no space.
It also shows that the __config line in the 16F886.inc file hasn't been commented out.
MOUNTAIN747
- 18th January 2013, 22:06
OK, so once I commented out the __config default line in the PBP INC file it compiled without errors.
As always, Thanks Darrel
Wayne
iboniang
- 29th May 2015, 16:12
HELLO, I HAVE THE SAME PROBLEM YOU HAD SOLVED. PLEASE HELP ME TO COMPILE THIS CODE.
DEFINE OSC 4
@ DEVICE pic16F876
@ DEVICE pic16F876, WDT_OFF
@ DEVICE pic16F876, PWRT_On
@ DEVICE pic16F876, PROTECT_OFF
TRISA=%11111111
TRISB=%00000000
TRISC=%00000000
PORTA=0
PORTB=0
PORTC=0
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 2
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 3
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE CCP1_REG PORTC
DEFINE CCP1_BIT 2
ON INTERRUPT GoTo KESME
ADCON1 = 7
OPTION_REG=%10000010
INTCON=%10100001
TMR0=0
T2CON = %00000110
PR2=124
SYMBOL YUKARI=PORTA.0
SYMBOL ASAGI=PORTA.1
SYMBOL ARTTIR=PORTA.2
SYMBOL AZALT=PORTA.3
SYMBOL JOG=PORTA.4
SYMBOL DUR=PORTA.5
ROLE VAR PORTC.3
LED1 VAR PORTC.1
LED2 VAR PORTC.0
MODS VAR BIT
YON VAR BIT
U VAR BYTE
W VAR BYTE
ADR VAR BYTE
SAYIH VAR BYTE
SAYIL VAR BYTE
SON VAR BYTE
SYC VAR BYTE
SNY VAR BYTE
SAYAC VAR BYTE
DUTY VAR BYTE
I VAR WORD
PERYOT VAR WORD
HAM_DUTY VAR WORD
FREKANS VAR WORD
PAUSE 200
LCDOUT $FE,1
GIRIS:
LCDOUT $FE,$83,"INVERTER"
LCDOUT $FE,$C4,"WITH PWM"
PAUSE 1500
LCDOUT $FE,1
DUTY=0:LED1=0:LED2=1
GOSUB FREKANS_HESAP
GOSUB EKRAN
GOSUB DUTY_YAZ
GOSUB PWM_ON
BASLA:
IF DUTY>0 THEN
IF JOG=0 AND YON=0 THEN
YON=1
SON=DUTY
GOTO SAG
ENDIF
IF JOG=0 AND YON=1 THEN
YON=0
SON=DUTY
GOTO SOL
ENDIF
ENDIF
IF DUR=0 and duty>0 THEN
GOTO DURDUR
ENDIF
GOSUB FREKANS_HESAP
GOSUB DUTY_KONTROL
GOSUB FREKANS_KONTROL
GOTO BASLA
FREKANS_KONTROL:
IF ARTTIR=0 THEN
WHILE ARTTIR=0:WEND
PR2=PR2-1
gosub DUTY_YAZ
IF PR2<5 THEN PR2=5
ENDIF
IF AZALT=0 THEN
WHILE AZALT=0:WEND
PR2=PR2+1
gosub DUTY_YAZ
IF PR2>124 THEN PR2=124
ENDIF
GOSUB EKRAN
RETURN
DUTY_KONTROL:
IF YUKARI=0 THEN
sayac=0
DUTY=DUTY+1
IF DUTY=101 THEN DUTY=100
gosub DUTY_YAZ:GOSUB EKRAN
WHILE YUKARI=0
W=1
IF SAYAC=>50 THEN
W=0:SAYAC=50
DUTY=DUTY+1:GOSUB DELAY
IF DUTY=101 THEN DUTY=100
ENDIF
GOSUB DUTY_YAZ
GOSUB EKRAN
WEND
W=0:SAYAC=0
ELSE
W=0:SAYAC=0
ENDIF
IF ASAGI=0 THEN
sayac=0
DUTY=DUTY-1
IF DUTY=255 THEN DUTY=0
GOSUB DUTY_YAZ
GOSUB EKRAN
WHILE ASAGI=0
W=1
IF SAYAC=>30 THEN
W=0:SAYAC=30
DUTY=DUTY-1:GOSUB DELAY
IF DUTY=255 THEN DUTY=0
ENDIF
GOSUB DUTY_YAZ
GOSUB EKRAN
WEND
W=0
ELSE
W=0:SAYAC=0
ENDIF
RETURN
SAG:
DUTY=DUTY-1:GOSUB DELAY
IF DUTY>100 THEN
ROLE=1:LED1=1:LED2=0
GOTO DUTY_ARTTIR
ENDIF
GOSUB DUTY_YAZ:GOSUB EKRAN
GOTO SAG
DUTY_ARTTIR:
DUTY=DUTY+1:GOSUB DELAY
GOSUB DUTY_YAZ:GOSUB EKRAN
IF DUTY=SON THEN
GOTO BASLA
ENDIF
GOTO DUTY_ARTTIR
DURDUR:
DUTY=DUTY-1:GOSUB DELAY
GOSUB DUTY_YAZ:GOSUB EKRAN
IF DUTY=0 THEN
GOTO BASLA
ENDIF
GOTO DURDUR
SOL:
DUTY=DUTY-1:GOSUB DELAY
IF DUTY>100 THEN
ROLE=0:LED1=0:LED2=1
GOTO DUTY_ARTTIR
ENDIF
GOSUB DUTY_YAZ:GOSUB EKRAN
GOTO SOL
DELAY: 'gecıkme
FOR I=0 TO 255:NEXT
RETURN
DELAY1:
FOR I=0 TO 150:NEXT
RETURN
FREKANS_HESAP:
FREKANS=62500/(PR2+1)
RETURN
DUTY_YAZ:
HAM_DUTY=(PR2+1)*DUTY/25
CCP1CON.4=ham_DUTY.0
CCP1CON.5=HAM_DUTY.1
CCPR1L=HAM_DUTY>>2
return
PWM_ON:
CCP1CON.2=1
CCP1CON.3=1
RETURN
PWM_OFF:
CCP1CON.2=0
CCP1CON.3=0
RETURN
EKRAN:
LCDOUT $FE,$80,"Duty %",#DUTY
IF DUTY<100 THEN
GOSUB HANE_AL1
LCDOUT $FE,ADR,$20
ENDIF
lcdout $fe,$C0,"FREKANS=",#FREKANS
GOSUB HANE_AL2
RETURN
HANE_AL1:
IF DUTY<100 OR DUTY>9 THEN ADR=$88
IF DUTY<10 THEN ADR=$87
RETURN
HANE_AL2:
IF FREKANS>10000 THEN LCDOUT $FE,$CD,"Hz"
IF FREKANS<10000 AND FREKANS>999 THEN LCDOUT $FE,$CC,"Hz "
IF FREKANS<1000 THEN LCDOUT $FE,$CB,"Hz "
RETURN
DISABLE
KESME:
IF W=1 THEN
SAYAC=SAYAC+1
IF SAYAC=101 THEN SAYAC=0
ENDIF
INTCON.2=0
RESUME
ENABLE
END
Archangel
- 29th May 2015, 19:35
HELLO, I HAVE THE SAME PROBLEM YOU HAD SOLVED. PLEASE HELP ME TO COMPILE THIS CODE.
I suggest you first re read this thread
your configs . . .
@ DEVICE pic16F876
@ DEVICE pic16F876, WDT_OFF
@ DEVICE pic16F876, PWRT_On
@ DEVICE pic16F876, PROTECT_OFF
only work with the PB compiler, They DO NOT WORK WITH MPASM
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.