Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1
    Join Date
    Jul 2009
    Posts
    23


    Did you find this post helpful? Yes | No

    Default

    Hello dave
    Ok, I found all my files I need however I am using PicBasic Pro Compiler Ver. 2.46. (I'm one of those poor saps that lost his receipt and cannot upgrade.)
    When I compile it works but trying to build using MPLAB I get a masive amount of errors. Here is the code.

    ************************************************** **************
    '* Name : UNTITLED.BAS *
    '* Author : Bill Bubel *
    ' *
    '* Date : 7/31/2009 *
    '* Version : 1.0 *
    '* Notes : *
    '* : *
    '************************************************* ***************
    ; Initialize your hardware first.

    INCLUDE "DT_INTS-18.bas" ' Base Interrupt System
    INCLUDE "ReEnterPBP-18.bas" ' Include if using PBP interrupts
    DEFINE OSC 4 'Define the Osc to 4 MHz

    asm
    bsf OSCCON, SCS1 ; 1x = Internal Block
    bcf OSCCON, SCS0 ; 00 = Primary Oscillator (20Mhz?)
    bsf OSCCON, IRCF2 ; 111=8000 110=4000 101=2000
    bsf OSCCON, IRCF1 ; 100=1000 011=0500 010=0250
    bcf OSCCON, IRCF0 ; 001=0125 000=0032
    MSTABLE010 btfss OSCCON, IOFS
    bra MSTABLE010 ; wait until Oscillator is stable
    endasm
    LED1 VAR PORTB.2
    DutyCycle VAR BYTE

    TotalCount CON 50000
    ONcount VAR WORD
    OFFcount VAR WORD

    ASM
    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    INT_Handler TMR1_INT, _ToggleLED1, PBP, yes
    endm
    INT_CREATE ; Creates the interrupt processor
    ENDASM

    T1CON = $00 ; Prescaler = 1:1, TMR OFF
    @ INT_ENABLE TMR1_INT ; enable Timer 1 interrupts

    Main:
    FOR DutyCycle = 0 TO 255 ; Ramp up
    GOSUB SetDutyCycle
    PAUSE 5
    NEXT DutyCycle

    FOR DutyCycle = 254 TO 1 STEP -1 ; Ramp down
    GOSUB SetDutyCycle
    PAUSE 5
    NEXT DutyCycle
    GOTO Main


    SetDutyCycle:
    ONcount = TotalCount*/DutyCycle
    OFFcount = TotalCount - ONcount
    IF DutyCycle = 0 THEN
    T1CON.0 = 0 ; turn off timer
    LOW LED1 ; idle LOW
    ELSE
    T1CON.0 = 1 ; timer on if DutyCycle > 0
    ENDIF
    RETURN

    DISABLE DEBUG
    '---[TMR1 - interrupt handler]------------------------------------------------
    @Timer1 = TMR1L ; map timer registers to a word variable
    Timer1 VAR WORD EXT

    ToggleLED1:
    IF LED1 THEN
    LOW LED1
    T1CON.0 = 0 ; stop the timer
    Timer1 = OFFcount ; Load OFF count
    T1CON.0 = 1 ; start timer
    ELSE
    HIGH LED1
    T1CON.0 = 0 ; stop the timer
    Timer1 = ONcount ; Load ON count
    T1CON.0 = 1 ; start timer
    ENDIF
    @ INT_RETURN
    ENABLE DEBUG

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by wbubel View Post
    Hello dave
    The name's Darrel.

    however I am using PicBasic Pro Compiler Ver. 2.46. (I'm one of those poor saps that lost his receipt and cannot upgrade.)
    It works fine with PBP 2.46

    When I compile it works but trying to build using MPLAB I get a masive amount of errors.
    Then don't use MPLAB if it works when you compile.
    <br>
    DT

  3. #3
    Join Date
    Jul 2009
    Posts
    23


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    The name's Darrel.


    It works fine with PBP 2.46


    Then don't use MPLAB if it works when you compile.
    <br>
    Sorry Darrel about calling you dave.

    I can compile but not Build. I use a IDC2 with MPLAB to run the PIC 18F1220. I use Microcode studio to write code and compile it to create a .asm file for MPLAB to build.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Dave here

    in MCS -view-program options-assembler tab. Check the box for using MPASM. The hex will be created when you compile with MCS.

    You do not need to start MPLAB. MCS will start MPASM for you.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jul 2009
    Posts
    23


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Dave here

    in MCS -view-program options-assembler tab. Check the box for using MPASM. The hex will be created when you compile with MCS.

    You do not need to start MPLAB. MCS will start MPASM for you.
    Dave
    I am using MPASM.

    Code:
     ; Initialize your hardware first.
    
    INCLUDE "DT_INTS-18.bas"     ' Base Interrupt System
    INCLUDE "ReEnterPBP-18.bas"     ' Include if using PBP interrupts
    DEFINE OSC 4  'Define the Osc to 4 MHz
         
    asm
                bsf      OSCCON, SCS1        ; 1x = Internal Block
                bcf      OSCCON, SCS0        ; 00 = Primary Oscillator (20Mhz?)
                bsf      OSCCON, IRCF2       ; 111=8000  110=4000  101=2000
                bsf      OSCCON, IRCF1       ; 100=1000  011=0500  010=0250
                bcf      OSCCON, IRCF0       ; 001=0125  000=0032
    MSTABLE010 btfss    OSCCON, IOFS
                bra      MSTABLE010           ; wait until Oscillator is stable
    endasm
    LED1       VAR PORTB.2
    DutyCycle  VAR BYTE
    
    TotalCount CON 50000
    ONcount    VAR WORD
    OFFcount   VAR WORD
    
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   TMR1_INT,  _ToggleLED1,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    T1CON = $00                ; Prescaler = 1:1, TMR OFF
    @ INT_ENABLE  TMR1_INT     ; enable Timer 1 interrupts
    
    Main:
        FOR DutyCycle = 0 TO 255           ; Ramp up
            GOSUB  SetDutyCycle
            PAUSE  5
        NEXT DutyCycle
    
        FOR DutyCycle = 254 TO 1 STEP -1   ; Ramp down
            GOSUB  SetDutyCycle
            PAUSE  5
        NEXT DutyCycle
    GOTO Main
    
    
    SetDutyCycle:
        ONcount = TotalCount*/DutyCycle
        OFFcount = TotalCount - ONcount
        IF DutyCycle = 0 THEN
            T1CON.0 = 0    ; turn off timer
            LOW  LED1      ; idle LOW
        ELSE
            T1CON.0 = 1    ; timer on if DutyCycle > 0
        ENDIF 
    RETURN
    
    DISABLE DEBUG
    '---[TMR1 - interrupt handler]------------------------------------------------
    @Timer1 = TMR1L             ; map timer registers to a word variable
    Timer1 VAR WORD EXT
    
    ToggleLED1:
        IF LED1 THEN
            LOW LED1
            T1CON.0 = 0         ; stop the timer
            Timer1  = OFFcount  ; Load OFF count
            T1CON.0 = 1         ; start timer
        ELSE
            HIGH LED1
            T1CON.0 = 0         ; stop the timer
            Timer1  = ONcount   ; Load ON count
            T1CON.0 = 1         ; start timer
        ENDIF
    @ INT_RETURN
    ENABLE DEBUG
    This code produces errors when I attempt to Build
    Last edited by wbubel; - 31st July 2009 at 21:38.

  6. #6
    Join Date
    Jul 2009
    Posts
    23


    Did you find this post helpful? Yes | No

    Default

    Here is the errors I get
    Code:
    Clean: Deleting intermediary and output files.
    Clean: Deleted file "C:\Pic Programs\Blink i.mcs".
    Clean: Done.
    Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p18F1220 "Blink i.asm" /l"Blink i.lst" /e"Blink i.err"
    Warning[230] C:\PBP\18F1220.INC 20 : __CONFIG has been deprecated for PIC18 devices.  Use directive CONFIG.
    Warning[230] C:\PBP\18F1220.INC 21 : __CONFIG has been deprecated for PIC18 devices.  Use directive CONFIG.
    Warning[230] C:\PBP\18F1220.INC 22 : __CONFIG has been deprecated for PIC18 devices.  Use directive CONFIG.
    Warning[230] C:\PBP\18F1220.INC 23 : __CONFIG has been deprecated for PIC18 devices.  Use directive CONFIG.
    Error[105]   C:\PIC PROGRAMS\BLINK I.ASM 204 : Cannot open file (Include File "BLINKI~2.MAC" not found)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 219 : Found label after column 1. (DDISABLE?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 227 : Found label after column 1. (GOTO?L)
    Error[122]   C:\PIC PROGRAMS\BLINK I.ASM 227 : Illegal opcode (_OVER_DT_INTS_18)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 231 : Found label after column 1. (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 369 : Found label after column 1. (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 374 : Found label after column 1. (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 392 : Found label after column 1. (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 397 : Found label after column 1. (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 696 : Found label after column 1. (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 701 : Found label after column 1. (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 714 : Found label after column 1. (ENDASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 714 : Address label duplicated or different in second pass (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 719 : Found label after column 1. (ASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 719 : Address label duplicated or different in second pass (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 758 : Found label after column 1. (ENDASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 758 : Address label duplicated or different in second pass (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 763 : Found label after column 1. (ASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 763 : Address label duplicated or different in second pass (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 782 : Found label after column 1. (ENDASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 782 : Address label duplicated or different in second pass (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 787 : Found label after column 1. (ASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 787 : Address label duplicated or different in second pass (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 793 : Found label after column 1. (ENDASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 793 : Address label duplicated or different in second pass (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 798 : Found label after column 1. (ASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 798 : Address label duplicated or different in second pass (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 852 : Found label after column 1. (ENDASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 852 : Address label duplicated or different in second pass (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 857 : Found label after column 1. (ASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 857 : Address label duplicated or different in second pass (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 914 : Found label after column 1. (ENDASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 914 : Address label duplicated or different in second pass (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 919 : Found label after column 1. (ASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 919 : Address label duplicated or different in second pass (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 969 : Found label after column 1. (ENDASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 969 : Address label duplicated or different in second pass (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 974 : Found label after column 1. (ASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 974 : Address label duplicated or different in second pass (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1044 : Found label after column 1. (ENDASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 1044 : Address label duplicated or different in second pass (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1049 : Found label after column 1. (ASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 1049 : Address label duplicated or different in second pass (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1126 : Found label after column 1. (ENDASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 1126 : Address label duplicated or different in second pass (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1131 : Found label after column 1. (ASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 1131 : Address label duplicated or different in second pass (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1224 : Found label after column 1. (ENDASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 1224 : Address label duplicated or different in second pass (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1229 : Found label after column 1. (LABEL?L)
    Error[122]   C:\PIC PROGRAMS\BLINK I.ASM 1229 : Illegal opcode (_OVER_DT_INTS_18)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1232 : Found label after column 1. (DENABLE?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1237 : Found label after column 1. (DDISABLE?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 1237 : Address label duplicated or different in second pass (DDISABLE?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1244 : Found label after column 1. (GOTO?L)
    Error[122]   C:\PIC PROGRAMS\BLINK I.ASM 1244 : Illegal opcode (_OverReEnterH)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1248 : Found label after column 1. (LABEL?L)
    Error[122]   C:\PIC PROGRAMS\BLINK I.ASM 1248 : Illegal opcode (_SavePBP_H)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1251 : Found label after column 1. (CMPNE?TCL)
    Error[122]   C:\PIC PROGRAMS\BLINK I.ASM 1251 : Illegal opcode (PB01)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1267 : Found label after column 1. (ASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 1267 : Address label duplicated or different in second pass (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1277 : Found label after column 1. (ENDASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 1277 : Address label duplicated or different in second pass (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1315 : Found label after column 1. (ASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 1315 : Address label duplicated or different in second pass (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1335 : Found label after column 1. (ENDASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 1335 : Address label duplicated or different in second pass (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1340 : Found label after column 1. (ASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 1340 : Address label duplicated or different in second pass (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1395 : Found label after column 1. (ENDASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 1395 : Address label duplicated or different in second pass (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1402 : Found label after column 1. (LABEL?L)
    Error[122]   C:\PIC PROGRAMS\BLINK I.ASM 1402 : Illegal opcode (L00001)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1406 : Found label after column 1. (ASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 1406 : Address label duplicated or different in second pass (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1409 : Found label after column 1. (ENDASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 1409 : Address label duplicated or different in second pass (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1414 : Found label after column 1. (LABEL?L)
    Error[122]   C:\PIC PROGRAMS\BLINK I.ASM 1414 : Illegal opcode (_RestorePBP_H)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1417 : Found label after column 1. (CMPNE?TCL)
    Error[122]   C:\PIC PROGRAMS\BLINK I.ASM 1417 : Illegal opcode (PB01)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1433 : Found label after column 1. (ASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 1433 : Address label duplicated or different in second pass (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1443 : Found label after column 1. (ENDASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 1443 : Address label duplicated or different in second pass (ENDASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1481 : Found label after column 1. (ASM?)
    Error[116]   C:\PIC PROGRAMS\BLINK I.ASM 1481 : Address label duplicated or different in second pass (ASM?)
    Warning[207] C:\PIC PROGRAMS\BLINK I.ASM 1501 : Found label after column 1. (ENDASM?)
    
    (rest of errors deleted)
    Halting build on first failure as requested.
    BUILD FAILED: Fri Jul 31 16:45:07 2009

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    OK, so you have MCS set up to use MPASM. You are not using MPLAB.

    Can you post your current config settings? Copy the Inc file. And can you post all of the errors you ar getting?

    I may have missed something before.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I do not really like the way you are doing the configs.
    Have you read this?
    http://www.picbasic.co.uk/forum/showthread.php?t=543
    if you set the configs in your program you will need to comment out the correct lines in the Inc.
    Dave
    Always wear safety glasses while programming.

  9. #9
    Join Date
    Jul 2009
    Posts
    23


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    OK, so you have MCS set up to use MPASM. You are not using MPLAB.

    Can you post your current config settings? Copy the Inc file. And can you post all of the errors you ar getting?

    I may have missed something before.
    I am using MPLAB for Building

    Here is a copy of the config file

    Code:
    ;****************************************************************
    ;*  18F1220.INC                                                 *
    ;*                                                              *
    ;*  By        : Leonard Zerman, Jeff Schmoyer                   *
    ;*  Notice    : Copyright (c) 2004 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 01/27/04                                        *
    ;*  Version   : 2.45                                            *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            "Error: PM does not support this device.  Use MPASM."
            NOLIST
        else
            LIST
            LIST p = 18F1220, r = dec, w = -311, f = inhx32
            INCLUDE "P18F1220.INC"  ; MPASM  Header
            __CONFIG    _CONFIG1H, _IESO_OFF_1H & _FSCM_OFF_1H & _INTIO2_OSC_1H
            __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
            __CONFIG    _CONFIG3H, _MCLRE_ON_3H
            __CONFIG    _CONFIG4L, _LVP_OFF_4L
            NOLIST
        endif
            LIST
    EEPROM_START	EQU	0F00000h
    BLOCK_SIZE	EQU	8
    Last edited by wbubel; - 3rd August 2009 at 14:18.

Similar Threads

  1. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  2. DT instant interrupts with mister_e keypad
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th November 2008, 20:02
  3. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 20:48
  4. Keypad and DT's Instant Interrupts
    By Homerclese in forum General
    Replies: 11
    Last Post: - 27th April 2007, 06:32
  5. Replies: 1
    Last Post: - 1st November 2006, 03:11

Members who have read this thread : 6

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

Tags for this Thread

Posting Permissions

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