16F886 (illegal opcode CONFIG1)


Closed Thread
Results 1 to 13 of 13
  1. #1
    Join Date
    Jan 2009
    Location
    Alabama,USA
    Posts
    219

    Default 16F886 (illegal opcode CONFIG1)

    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!

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: 16F886 (illegal opcode CONFIG1)

    Are you sure you have the 16F886 selected in the Microcontroller dropdown box of MicroCode Studio?
    DT

  3. #3
    Join Date
    Jan 2009
    Location
    Alabama,USA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Re: 16F886 (illegal opcode CONFIG1)

    16F886 is in the dropdown window! yep!

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: 16F886 (illegal opcode CONFIG1)

    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.
    DT

  5. #5
    Join Date
    Jan 2009
    Location
    Alabama,USA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Re: 16F886 (illegal opcode CONFIG1)

    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?

  6. #6
    Join Date
    Jan 2009
    Location
    Alabama,USA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Re: 16F886 (illegal opcode CONFIG1)

    Darrel, On the assembler tab page, what is INH8XM, INH8XS, and INHX32?
    Last edited by MOUNTAIN747; - 17th January 2013 at 23:26.

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: 16F886 (illegal opcode CONFIG1)

    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.
    DT

  8. #8
    Join Date
    Jan 2009
    Location
    Alabama,USA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Re: 16F886 (illegal opcode CONFIG1)

    You'll have to explain how I send it to you. I can't use Private Message.

  9. #9
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: 16F886 (illegal opcode CONFIG1)

    DT

  10. #10
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: 16F886 (illegal opcode CONFIG1)

    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.
    DT

  11. #11
    Join Date
    Jan 2009
    Location
    Alabama,USA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Re: 16F886 (illegal opcode CONFIG1)

    OK, so once I commented out the __config default line in the PBP INC file it compiled without errors.

    As always, Thanks Darrel

    Wayne

  12. #12
    Join Date
    May 2015
    Posts
    1


    Did you find this post helpful? Yes | No

    Default Re: 16F876 (illegal opcode pic16f876)

    HELLO, I HAVE THE SAME PROBLEM YOU HAD SOLVED. PLEASE HELP ME TO COMPILE THIS CODE.
    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
    Last edited by Archangel; - 29th May 2015 at 19:31.

  13. #13
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Re: 16F876 (illegal opcode pic16f876)

    Quote Originally Posted by iboniang View Post
    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
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. Illegal upcode
    By lerameur in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 10th November 2011, 23:31
  2. Extra I2CWRITE opcode at beginning of *.hex file
    By tturpin in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th May 2011, 03:13
  3. NTVDM CPU has encountered illegal instruction
    By Sanddune in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 19th June 2009, 04:01
  4. 16f886
    By Larry in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 4th November 2008, 16:57
  5. 16f886
    By hvacrtech in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 27th May 2008, 05:06

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts