• AVR Freaks

Hot!Can't get an incremental operator to work on 16F18857.

Author
d2willys
New Member
  • Total Posts : 10
  • Reward points : 0
  • Joined: 2019/08/08 12:29:18
  • Location: 0
  • Status: offline
2020/05/21 10:22:42 (permalink)
0

Can't get an incremental operator to work on 16F18857.

I have been trying to get a simple increment by 1 to work. I have tried x++, but the XC8 does not support this. I try x+1 and it works on the same code, but in a 16F886. It will not work on a 16F18857. Is there something I am doing wrong using the 1.42 version of XC8? Could it be that this part is going into sleep, and how do I take it out of sleep? I thought the reprogramming of the part automatically resets to be out of sleep.
#1

9 Replies Related Threads

    1and0
    Access is Denied
    • Total Posts : 10780
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Can't get an incremental operator to work on 16F18857. 2020/05/21 10:31:13 (permalink)
    +1 (1)
    d2willys
    I have been trying to get a simple increment by 1 to work. I have tried x++, but the XC8 does not support this. I try x+1 and it works on the same code, but in a 16F886. It will not work on a 16F18857. Is there something I am doing wrong using the 1.42 version of XC8? Could it be that this part is going into sleep, and how do I take it out of sleep? I thought the reprogramming of the part automatically resets to be out of sleep.

    Post your code. Why not update XC8 to the latest?
     
    #2
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11820
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: Can't get an incremental operator to work on 16F18857. 2020/05/21 12:46:27 (permalink)
    +1 (1)
    The PIC will not go to sleep unless you tell it to.
    #3
    crosland
    Super Member
    • Total Posts : 1939
    • Reward points : 0
    • Joined: 2005/05/10 10:55:05
    • Location: Warks, UK
    • Status: online
    Re: Can't get an incremental operator to work on 16F18857. 2020/05/21 12:51:31 (permalink)
    +4 (4)
    d2willysI have tried x++, but the XC8 does not support this.

    Don't be silly, of course it does.
     
    Post the code that does not work. ALL the code.
    #4
    ric
    Super Member
    • Total Posts : 27022
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: Can't get an incremental operator to work on 16F18857. 2020/05/21 13:26:42 (permalink)
    +2 (2)
    As above, of course it works.
    The failure here is more likely to be how you are checking if it worked, which has not been revealed.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #5
    pcbbc
    Super Member
    • Total Posts : 1691
    • Reward points : 0
    • Joined: 2014/03/27 07:04:41
    • Location: 0
    • Status: offline
    Re: Can't get an incremental operator to work on 16F18857. 2020/05/21 13:37:31 (permalink)
    +4 (4)
    I’m going to have a random guess as to why it might not be working...
    x = x++;

    #6
    dan1138
    Super Member
    • Total Posts : 3496
    • Reward points : 0
    • Joined: 2007/02/21 23:04:16
    • Location: 0
    • Status: offline
    Re: Can't get an incremental operator to work on 16F18857. 2020/05/21 16:29:30 (permalink)
    0
    pcbbc
    I’m going to have a random guess as to why it might not be working...
    x = x++;



    I wonder what the compiler would do with this:
     x = x++,x;

    #7
    mlp
    boots too small
    • Total Posts : 913
    • Reward points : 0
    • Joined: 2012/09/10 15:12:07
    • Location: previously Microchip XC8 team
    • Status: offline
    Re: Can't get an incremental operator to work on 16F18857. 2020/05/22 15:18:45 (permalink)
    0
    dan1138
    pcbbc
    I’m going to have a random guess as to why it might not be working...
    x = x++;



    I wonder what the compiler would do with this:
     x = x++,x;


    I'm pretty sure that it's still UB - there's a sequence point between the two subexpressions on the RHS, but no sequence point between the RHS and the LHS.

    Mark (this opinion available for hire)
    #8
    ric
    Super Member
    • Total Posts : 27022
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: Can't get an incremental operator to work on 16F18857. 2020/05/22 15:48:08 (permalink)
    0
    The OP last logged on two hours ago, but I suspect they are not going to contribute any further to this topic...
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #9
    1and0
    Access is Denied
    • Total Posts : 10780
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Can't get an incremental operator to work on 16F18857. 2020/05/22 16:02:45 (permalink)
    0
    ric
    The OP last logged on two hours ago, but I suspect they are not going to contribute any further to this topic...

    Yup, I saw OP was online earlier. :(
     
     
    dan1138
     
    I wonder what the compiler would do with this:
     x = x++,x;


    As said, this is UB. I think it probably will generate an INCF. Also, the = operator has precedence over the comma operator. ;)
     
    #10
    Jump to:
    © 2020 APG vNext Commercial Version 4.5