12F683 _CONFIG problem


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

    Default 12F683 _CONFIG problem

    Started what I thought would be a quick turnaround to build a board to capture pulses from a rain gage and send to a master board. PicProto8 board and a 12F683 should do nicely. Why do things always have to get complicated? I want to use DT's to catch the pulses so I am assembling with MPASM.
    PROBLEM wiith compiler error _CONFIG. Nothing I have done will clear the error. Things are compileng fine on other devices.

    Error[122]c:\phpprog\wkfolder\12F683-1.asm 97:illegal opcode (_HS_OSC)
    Error[122]c:\phpprog\wkfolder\12F683-1.asm 97:illegal opcode (_CPD_OFF)

    DT's are commented out until first compile of simple code.

    Items check of for this type of problem.
    1. Does drop down minue display correct PIC? check!
    2. Does Assembler point to C:\Program Files\Microchip\MPASM Suite? check!
    3. Are config setting the same as in the MPASM INC file? check!

    I also tried commiting out PBP\12F683.INC config line as was Darrels advise on a simular issue years ago, no help.
    What have I missed?

    Wayne

    Code:
    asm
    _CONFIG _HS_OSC & _MCLRE_OFF & _WDT_OFF & _PWRTE_OFF   
    _CONFIG _CPD_OFF & _BOD_ON & _IESO_OFF & _FCMEN_OFF 
    endasm
    ;=================    
    ;include "DT_INTS-14"
    ;include "ReEnterPBP"
    ;Include "MODEDEFS.BAS"  ; Include for Shiftin/out modes
    ;================= 
    ;     wsave  Var byte $20 SYSTEM
    ;     wsave1 var byte $A0 SYSTEM
         define OSC 20
         OPTION_REG = %01000000    ;Option register p.14DS  bit6-rising edge
         OSCCON =%00000000         ;External Res p.22DS
         ANSEL  = 0                ;All pins set to digital I/O     p.35datasheet
         CMCON0 = 7                ;comparators off
         VRCON  = 0
         ADCON0 = 0
         GPIO=   %00000000         
         TRISIO= %00001100         ;sets GPIO.2 AND GPIO.3 as input others outputs     
         IOC=    %00001100           ;interrupt on change on GPIO2 and GPIO3
         WDTCON= %01001            ;WDT control
         INTCON= %10001000         ;Interrupt control - GPIO Change Interrupt Enable p.15DS
    ;=================      
    ;Variables
        Avar    VAR BYTE   ;general variable
        Bvar    VAR BYTE   ;general variable
        Cvar    var byte   ;general variable
    ;GPIO actioins    
        LED          var GPIO.0 ;general I/O - output
      TX             var GPIO.1 ;Send all data to master unit - Output
      Raincount    var GPIO.2 ;counts rain in 1/10 inch per pulse -input
      Sendnow     var GPIO.3 ;input post to send data out after - input
    ; Gpio4&5 on resonator
    ;================= 
    ;ASM
    ;INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
    ;        INT_Handler    INT_INT,  _MyISR,   PBP,  yes 
    ;    endm                          
    ;    INT_CREATE    ; Creates the interrupt processor
    ;ENDASM    
    ;@ INT_ENABLE   INT_INT  
    ;=================  
    Start: 
        HIGH    LED
        pause   100
        low     LED
        pause   100
        goto start
        end
    Last edited by MOUNTAIN747; - 29th August 2020 at 01:14. Reason: Edit-minor errors

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,517


    Did you find this post helpful? Yes | No

    Default Re: 12F683 _CONFIG problem

    Try indenting the _CONFIG... lines between ASM and ENDASM.

    /Henrik.

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383


    Did you find this post helpful? Yes | No

    Default Re: 12F683 _CONFIG problem

    also is it

    _CONFIG or __CONFIG.


    also

    trying to place config on two lines that way will lead to overwrite error/warning

    at least in pbp3 not sure about dinosaur versions
    Warning I'm not a teacher

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


    Did you find this post helpful? Yes | No

    Default Re: 12F683 _CONFIG problem

    thanks for responding. So I tried all above suggestions with no luck.

    IF (CODE ON ONE LINE)
    Code:
    asm
    _CONFIG _HS_OSC & _MCLRE_OFF & _WDT_OFF & _PWRTE_OFF & _CPD_OFF & _BOD_ON & _IESO_OFF & _FCMEN_OFF    
    endasm
    THEN iLLEGAL OPCODE (_HS_OSC) Character after Config illegal

    IF
    Code:
    asm
    _CONFIG, _HS_OSC & _MCLRE_OFF & _WDT_OFF & _PWRTE_OFF & _CPD_OFF & _BOD_ON & _IESO_OFF & _FCMEN_OFF    
    endasm
    THEN ILLEGAL CHARACTER (,) Character after Config illegal, with or without space after (,)

    IF
    Code:
    @_CONFIG, _HS_OSC & _MCLRE_OFF & _WDT_OFF & _PWRTE_OFF & _CPD_OFF & _BOD_ON & _IESO_OFF & _FCMEN_OFF
    THEN ILLEGAL CHARACTER (,)

    IF space after @ then Illegal opcode (_CONFIG)

    If i turn off MPASM assembler it WILL assemble OK. looks like interrupts will have to be in ASM is I can't get this worked out. Oh well, I need the practice.

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: 12F683 _CONFIG problem

    Why are you putting the pic config stuff in the assembler code sections?

    Here is one of my 12F683 configs..

    It should be right at the start of the program.

    Code:
    #config
     __config _FCMEN_ON & _IESO_ON & _BOD_OFF & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_OFF & _WDT_OFF & _INTOSCIO
    #ENDCONFIG   
    
    DEFINE OSC 8			'Set PicBasic Pro processor speed to 8 Mhz (Must match oscillator value)
    
    INTCON = %10001000		'Internal oscillator  
    OSCCON = %01110101		'Sets internal osc to 8 Mhz (Default) and stable 
    CMCON0 = %00000111		'Comparators off
    TRISIO = %00101011		'Set Pins GPIO.0, GPIO.1 GPIO.3 & GPIO.5 as inputs
    ANSEL  = %00000000		'No Analog Inputs
    OPTION_REG = %01111111	'Global Enable Weak Pull Ups
    WPU    = %00000011		'Weak Pull Ups Enabled on GPIO.0 & 1

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: 12F683 _CONFIG problem

    I had to once, find the '683' INC or MAC file referred to by the assembler, look at the way the configs are expected in those files. I had to change my code to match the referenced/expected format/characters

  7. #7


    Did you find this post helpful? Yes | No

    Default Re: 12F683 _CONFIG problem

    I've never seen it done like that before and I also use DT stuff and 16f83...

  8. #8
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: 12F683 _CONFIG problem

    Plus to the above, you still had one underscore instead of the correct two.

    Ioannis

  9. #9


    Did you find this post helpful? Yes | No

    Default Re: 12F683 _CONFIG problem

    I have used the following header for the 12F683 many times and never encountered any compiling problems. Try it.

    CMCON0 = 7 'comparators off
    ANSEL = 0 'all inputs digital, the adcin command automatically converts it to analog
    DEFINE OSCCON_1K 1 ' Set OSCCAL for 1K device to accurize osc
    OSCCON = %01110111 'Set osc to 8MHZ 12F683. Normally I leave this line out to default to 4MHZ
    @ DEVICE MCLR_ON, INTRC_OSC_NOCLKOUT, WDT_ON, BOD_OFF, PWRT_ON, PROTECT_ON

    START:

  10. #10
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: 12F683 _CONFIG problem

    I think you refer to an ancient version of PBP.

    Now we do not use this @ DEVICE MCLR_ON.....

    Current versions use this syntax:

    Code:
    #config
     __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _BOD_OFF & _MCLRE_ON & _CP_OFF 
    #endconfig
    Ioannis

  11. #11


    Did you find this post helpful? Yes | No

    Default Re: 12F683 _CONFIG problem

    Yes it is old. I think it's version 2.65 or something.

Similar Threads

  1. 12F683 Light Dimmer Problem (SOLVED)
    By DavyJones in forum General
    Replies: 19
    Last Post: - 24th July 2020, 23:59
  2. PIC 12F683 and DS18B20 problem
    By slash819 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 28th February 2012, 19:31
  3. 12F683 Logic Output Problem?
    By shockwave in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 25th February 2012, 20:48
  4. _config set change for pic12f683
    By nbrucew in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 20th March 2010, 02:03
  5. 12F683 GPIO.3 problem
    By ozarkshermit in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 30th October 2009, 09:43

Members who have read this thread : 2

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