Problem with ASM IRQ using FSR0 on PIC18F252


Closed Thread
Results 1 to 11 of 11

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Hi Jan,

    Those variables aren't working the way you think. For instance:

    TMR1ON VAR BIT
    TMR1ON = T1CON.0

    Creates a separate BIT variable, and then puts the value of T1CON.0 in it. It doesn't assign T1CON.0 the the name TMR1ON.

    Try doing it this way.

    TMR1ON VAR T1CON.0
    TMR1IF Var PIR1.0
    TMR1IE VAR PIE1.0
    TMR1IP VAR IPR1.0
    IPEN VAR RCON.7<br><br>
    DT

  2. #2
    jmen's Avatar
    jmen Guest


    Did you find this post helpful? Yes | No

    Talking working!

    I´m realy a fool! I changed the wrong variable declaration to aliases as you suggested - now it´s working!!
    thanks a lot, you´ve saved my life!!
    Another short question...
    When i have declared a variable as word - how do I assign a value like 1000 to it or better a value from anoter variable or constant?

    In PBP I would do:
    <pre>resetValue CON 1000
    counter = resetValue</pre>
    or:
    <pre>resetValue VAR WORD
    resetValue = 1000
    counter = resetValue</pre>
    In ASM: ??
    <pre>MOVFF _resetValue, _counter</pre>
    You see I´m a real beginner in ASM :-(

    regards,
    Jan

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


    Did you find this post helpful? Yes | No

    Default

    Hey, don't worry about it Jan. I think I made the same mistake in the beginning.

    To move 1 word var to another using movff might look like this ...

    MOVFF _resetValue, _counter
    MOVFF _resetValue+1, _counter+1

    but that will only work with 2 variables. movff won't work with constants.

    The easiest way to copy things from 1 place to another is using the MOVE?xx macro's. Take a look at this post for more info.

    https://www.picbasic.co.uk/forum/showthread.php?p=2009

    The MOVE?xx macro's will take care of all the bank switching (if required) the same way that PBP does it. <br><br>
    DT

Similar Threads

  1. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 22:14
  2. PBP, ASM and LST files
    By HenrikOlsson in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th January 2010, 13:43
  3. Problem using ASM instruction
    By ewandeur in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd April 2008, 15:26
  4. pic18f252 hserout problem
    By edysan in forum Serial
    Replies: 4
    Last Post: - 16th June 2006, 20:46
  5. problem with asm interrupt
    By servo260 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 20th December 2004, 17:02

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