Discovering PIC 16F18446 - TOGGLE "ASM WARNING - Invalid RAM location"


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,656


    Did you find this post helpful? Yes | No

    Default Re: Discovering PIC 16F18446 - TOGGLE "ASM WARNING - Invalid RAM location"

    substituting LATx registers for PORTx registers in pbp high level command statements will not work as you might hope
    it can introduce subtle and difficult to diagnose bugs, it also will never set the TRISx registers in the manner those statements expect

    Do I have to care about this warning?
    only if you want your code to work correctly

    see this
    https://www.picbasic.co.uk/forum/sho...1-OWOUT-Glitch
    Last edited by richard; - 18th February 2024 at 10:04.
    Warning I'm not a teacher

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,144


    Did you find this post helpful? Yes | No

    Default Re: Discovering PIC 16F18446 - TOGGLE "ASM WARNING - Invalid RAM location"

    Since the introduction of LAT registers, I cannot remember where I read it, maybe it was in Melabs either help file or this forum, we had to use LAT instead of PORT registers.

    Οn some PIC it will not work properly.

    But I have not found an explanation on this matter.

    Ioannis
    Last edited by Ioannis; - 18th February 2024 at 19:55.

  3. #3
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Discovering PIC 16F18446 - TOGGLE "ASM WARNING - Invalid RAM location"

    Quote Originally Posted by richard View Post
    ...only if you want your code to work correctly
    Who wouldn't?

    At this point, it's just about blinking that LED.

    But after that, how will I be able to avoid any such kind of "mistakes"?

    Please, please don't answer "Easy! Just rfm!!!"

    For week-ends hobbyist like me, is it better to stay with more "modest" PICs and/or always use workarounds like instead of:
    Code:
    TOGGLE LATB.6
    PAUSE 500
    ...I should choose to stay with:
    Code:
    LATB.6 = 1
    PAUSE 500
    LATB.6 = 0
    PAUSE 500
    Roger

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,656


    Did you find this post helpful? Yes | No

    Default Re: Discovering PIC 16F18446 - TOGGLE "ASM WARNING - Invalid RAM location"

    For week-ends hobbyist like me, is it better to stay with more "modest" PICs and/or always use workarounds like instead
    it has nothing to do with with the pic chip at all. its simply incorrect usage of the pbp high level commands

    Please, please don't answer "Easy! Just rfm!!!
    did you even look at the link i suggested ? i don't know why i bother



    all pbp "high level" commands that set a pin direction use a fixed offset to get to the tris reg
    it simply will not work correctly from a LATx offset [serout , serout2, toggle,high,low,i2cread........................... ....... ie all of them

    PORTx + offset always equals the TRISx register, LATx + offset does not equal the TRISx register ever

    if you don't believe my then look at the lst file generated by your code

    Code:
    TOGGLE LATB.6
    PAUSE 500
    is improper use

    Code:
    TOGGLE PORTB.6
    PAUSE 500
    is proper use


    Code:
    LATB.6 = 1
    PAUSE 500
    LATB.6 = 0
    PAUSE 500
    is proper use

    Code:
    latb.6=!latb.6
    PAUSE 500
    is proper use
    Warning I'm not a teacher

Similar Threads

  1. How to do the "SerIN" and "SerOut " for the usb ?
    By vicce67 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 13th March 2015, 02:01
  2. Replies: 0
    Last Post: - 14th November 2013, 03:32
  3. Replies: 3
    Last Post: - 15th October 2012, 08:06
  4. PBP 2.6/MPLab 8.33 ASM "COD" error message
    By reddog24 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 3rd December 2009, 20:09
  5. Adding data to an "array" in ASM
    By The Master in forum Off Topic
    Replies: 11
    Last Post: - 22nd November 2009, 03:21

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