Instant Interrupts and STRINGS-16.PBP in the same program


Closed Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    Dec 2003
    Location
    Storrs, Ct.
    Posts
    91

    Default Instant Interrupts and STRINGS-16.PBP in the same program

    Hello all! Hope everyone had a good Holiday. My question is, can I use Instant Interrupts DT_INTS-18, ReEnterPBP-18 and STRINGS-16 in the same program. I've tried a few times and get several errors.

    symbol not previously defined.(INT_ENTRY_H)
    Found call to Macro in column 1.(GetAddress)
    Duplicate Macro name. (GetAddress)
    1003:symbol not previously defined.(Label)
    1004:symbol not previously defined.(Wout)
    1005:symbol not previously defined.(Label)
    1006:symbol not previously defined.(Wout)
    1007:unmatched ENDM

    Instant Interrupts works great on it's own (blinks an LED) and STRINGS works great on it's own (Hello World and It's Me!) on an LCD, however combined I can't get it to compile without errors.

    MCSP 2.3, PBP 2.45A, MPASM, and Microcode Loader with an 18F2525 @ 20 MHZ

    As always thanks for any help in my up-hill battle thru this learning curve.
    "It will never happen here!" just happened here.
    My thoughts and prayers for Sandy Hook victims and families.

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


    Did you find this post helpful? Yes | No

    Default

    As far as I know, they should work together.

    Those don't look like MPASM error messages, are you sure you have MPASM selected as the assembler?
    <br>
    DT

  3. #3
    Join Date
    Dec 2003
    Location
    Storrs, Ct.
    Posts
    91


    Did you find this post helpful? Yes | No

    Default MPASM checked.

    Yes, under "VIEW", Compile and Program Options, Assembler, a check mark in the Use MPASM box. As I said Darryl they work great on their own just not together. Probably operator error somewhere, I'm just not sure where.

    Thanks for your help.
    "It will never happen here!" just happened here.
    My thoughts and prayers for Sandy Hook victims and families.

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


    Did you find this post helpful? Yes | No

    Default

    Can you post the code?

    I'll take a look and see what's up.
    <br>
    DT

  5. #5
    Join Date
    Dec 2003
    Location
    Storrs, Ct.
    Posts
    91


    Did you find this post helpful? Yes | No

    Default code

    <code>
    '************************************************* ***************
    DEFINE LOADER_USED 1 ' If using bootloader
    DEFINE OSC 20
    DEFINE HSER_RCSTA 90h 'setup receive register
    DEFINE HSER_TXSTA 20h 'setup transmit register
    DEFINE HSER_BAUD 38400 'setup baud rate

    INCLUDE "DT_INTS-18.inc" ' Base Interrupt System
    INCLUDE "ReEnterPBP-18.inc" ' Include if using PBP interrupts

    Addr var word
    Char var byte

    Clear

    goto StartLoop ' Required

    String1:
    @ da "This is a string",0

    AnotherString:
    @ da "Here is another string",0

    '------------GetAddress Macro - Location insensitive -------------------------
    ASM
    GetAddress macro Label, Wout ; Returns the Address of a Label as a Word
    CHK?RP Wout
    movlw low Label
    movwf Wout
    movlw High Label
    movwf Wout + 1
    endm
    ENDASM


    StartLoop ' This loop repeats continuously just as a test.
    @ GetAddress _String1, _Addr ' Get address of String
    gosub StringOut ' Send the String
    hserout [13,10] ' New Line

    @ GetAddress _AnotherString, _Addr ' Get address of String
    gosub StringOut ' Send the String
    hserout [13,10] ' New Line
    pause 500
    goto StartLoop ' Repeat


    StringOut: ' Send the string out via Hserout
    Readcode Addr, Char ' Get a character
    if Char = 0 then StringDone ' Look for Null char, Stop if found
    hserout [Char] ' Send char
    Addr = Addr + 1 ' Point to next character
    goto StringOut ' Continue with rest of the string
    StringDone:
    return


    end
    </code>

    Here it is. Out for dinner for an hour or so. I'll check back later. Thanks again.
    "It will never happen here!" just happened here.
    My thoughts and prayers for Sandy Hook victims and families.

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


    Did you find this post helpful? Yes | No

    Default

    Ah, that helps.

    You haven't defined the Interrupts yet.

    There needs to be a section that looks something like this...
    Code:
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler    INT_INT,  _ToggleLED1,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    @   INT_ENABLE   INT_INT     ; enable external (INT0) interrupts
    That section should be at the top of the program (but after the INCLUDE files), and don't jump over it. It needs to actually execute.

    Then there also needs to be a handler routine...
    Code:
    '---[INT - interrupt handler]---------------------------------------------------
    ToggleLED1:
         TOGGLE LED1
    @ INT_RETURN
    HTH,
    DT

  7. #7
    Join Date
    Dec 2003
    Location
    Storrs, Ct.
    Posts
    91


    Did you find this post helpful? Yes | No

    Default Sorry, wrong version.

    Here's the right one.
    <code>
    '************************************************* ***************
    DEFINE LOADER_USED 1 ' If using bootloader
    DEFINE OSC 20
    DEFINE HSER_RCSTA 90h 'setup receive register
    DEFINE HSER_TXSTA 20h 'setup transmit register
    DEFINE HSER_BAUD 38400 'setup baud rate

    'INCLUDE "DT_INTS-18.inc" ' Base Interrupt System
    'INCLUDE "ReEnterPBP-18.inc" ' Include if using PBP interrupts

    Addr var word
    Char var byte
    led1 var PORTC.0 'heartbeat LED
    Clear

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

    T1CON = $31 ; Prescaler = 8, TMR1ON
    @ INT_ENABLE TMR1_INT ; enable Timer 1 interrupts



    goto StartLoop ' Required

    String1:
    @ da "This is a string",0

    AnotherString:
    @ da "Here is another string",0

    '------------GetAddress Macro - Location insensitive -------------------------
    ASM
    GetAddress macro Label, Wout ; Returns the Address of a Label as a Word
    CHK?RP Wout
    movlw low Label
    movwf Wout
    movlw High Label
    movwf Wout + 1
    endm
    ENDASM


    StartLoop ' This loop repeats continuously just as a test.
    @ GetAddress _String1, _Addr ' Get address of String
    gosub StringOut ' Send the String
    hserout [13,10] ' New Line

    @ GetAddress _AnotherString, _Addr ' Get address of String
    gosub StringOut ' Send the String
    hserout [13,10] ' New Line
    pause 500
    goto StartLoop ' Repeat


    StringOut: ' Send the string out via Hserout
    Readcode Addr, Char ' Get a character
    if Char = 0 then StringDone ' Look for Null char, Stop if found
    hserout [Char] ' Send char
    Addr = Addr + 1 ' Point to next character
    goto StringOut ' Continue with rest of the string
    StringDone:
    return

    '---[INT - interrupt handler]---------------------------------------------------
    ToggleLED1:
    TOGGLE LED1

    @ INT_RETURN


    end
    </code>
    "It will never happen here!" just happened here.
    My thoughts and prayers for Sandy Hook victims and families.

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


    Did you find this post helpful? Yes | No

    Default

    Oh, that helps even more.

    There is a conflict between the two programs.
    DT_INTS also has a GetAddress macro.

    So you can just delete the GetAddress macro in the main program.

    Don't forget to un-comment the include files.
    <br>
    DT

  9. #9
    Join Date
    Dec 2003
    Location
    Storrs, Ct.
    Posts
    91


    Did you find this post helpful? Yes | No

    Default Success!

    As always Darryl, you are "THE MAN".

    Thanks alot...
    "It will never happen here!" just happened here.
    My thoughts and prayers for Sandy Hook victims and families.

  10. #10
    Join Date
    Dec 2003
    Location
    Storrs, Ct.
    Posts
    91


    Did you find this post helpful? Yes | No

    Default Success!

    As always Darryl, you are "THE MAN".

    Thanks alot...
    "It will never happen here!" just happened here.
    My thoughts and prayers for Sandy Hook victims and families.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ronjodu View Post
    As always Darryl, you are "THE MAN".
    See, now why can't "SHE" ever grasp that concept.
    But that's another story.

    Great! Hope the rest of the program works out too.
    <br>
    L8R,
    DT

Members who have read this thread : 0

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