Hot!Is there any solution to use long long (64-bit) in XC-8 ?

Page: 123 > Showing page 1 of 3
Author
ice_man
Starting Member
  • Total Posts : 51
  • Reward points : 0
  • Joined: 2013/01/15 07:51:29
  • Location: 0
  • Status: offline
2019/03/22 14:59:08 (permalink)
0

Is there any solution to use long long (64-bit) in XC-8 ?

Hi,
 
I have a question - is there any solution to use long long (64-bit) for 16F1936 in XC-8 ? 
 
Thanks for any help.
 
Best Regards,
Ice
#1

52 Replies Related Threads

    qhb
    Superb Member
    • Total Posts : 9673
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 15:18:12 (permalink)
    +1 (1)
    Yes, upgrade to version XC8 2.05
    The release notes for that version say it is now available for enhanced mid range devices.
    #2
    ice_man
    Starting Member
    • Total Posts : 51
    • Reward points : 0
    • Joined: 2013/01/15 07:51:29
    • Location: 0
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 15:25:04 (permalink)
    0
    Thank for reply, I have v4.05 XC8 know, that mean I can use long long as 64-bit's ? Declaration for example: volatile unsigned long long temp;  is enaugh or Do I need st yet ?
     
     
    #3
    qhb
    Superb Member
    • Total Posts : 9673
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 15:28:07 (permalink)
    +2 (2)
    No such version as "4.05"
    Are you confusing the MPLABX version with the XC8 version?
     
    #4
    ice_man
    Starting Member
    • Total Posts : 51
    • Reward points : 0
    • Joined: 2013/01/15 07:51:29
    • Location: 0
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 15:32:45 (permalink)
    0
    You have right - my mistake ;), 4.05 is MPLAB ver not XC8.  Thanks for help :).
    It is enaugh to use: volatile unsigned long long temp;  ? Or do I need more to possiblity use 64-bits not 32 ?
    post edited by ice_man - 2019/03/22 15:56:49
    #5
    NKurzman
    A Guy on the Net
    • Total Posts : 17155
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 16:00:55 (permalink)
    +1 (1)
    Which PIC are you using?
    volatile unsigned long temp = 32 bits.
    volatile unsigned long long temp = 64 bits.
    volatile?? do you plan to use this in an interrupt?  There may be a lot of overhead.
     
    #6
    Ivan Cenov
    Super Member
    • Total Posts : 279
    • Reward points : 0
    • Joined: 2003/11/07 12:36:51
    • Location: Bulgaria
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 16:01:21 (permalink)
    +1 (1)
    You may have to upgrade MPLAB X to the last version too so as to use XC8 2.05
    post edited by i_cenov - 2019/03/22 16:03:42
    #7
    ice_man
    Starting Member
    • Total Posts : 51
    • Reward points : 0
    • Joined: 2013/01/15 07:51:29
    • Location: 0
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 16:05:11 (permalink)
    0
    NKurzman
    Which PIC are you using?
    volatile unsigned long temp = 32 bits.
    volatile unsigned long long temp = 64 bits.
    volatile?? do you plan to use this in an interrupt?  There may be a lot of overhead.
     


    pic 16f1936,  I'll change function in program and I neednt use specifier volatile. 
    #8
    davekw7x
    Entropy++
    • Total Posts : 1692
    • Reward points : 0
    • Joined: 2012/01/16 12:01:07
    • Location: Left Coast, USA
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 16:12:38 (permalink)
    +1 (1)
    ice_man
    I have a question - is there any solution to use long long (64-bit) for 16F1936 in XC-8 ?

    [Edit]
    64-bit ints work for your chip with XC8 version 2.05 in C99 mode.
    I regret the following:
    [/Edit]
    No.
    64-bit integers are available for PIC18 devices using XC8 version 2.0x with C99 mode.  Type is "long long"  or "unsigned long long" or, if you include <stdint.h>, you can declare them as int64_t or uint64_t, respectively
     
    64-bit ints are not available in XC8 for PIC16 devices.
     
    Regards,

    Dave
    post edited by davekw7x - 2019/03/22 16:38:48

    Sometimes I just can't help myself...
    #9
    ice_man
    Starting Member
    • Total Posts : 51
    • Reward points : 0
    • Joined: 2013/01/15 07:51:29
    • Location: 0
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 16:16:26 (permalink)
    0
    davekw7x
    ice_man
    I have a question - is there any solution to use long long (64-bit) for 16F1936 in XC-8 ?

    No.
    64-bit integers are available for PIC18 devices using XC8 version 2.0x with C99 mode.  Type is "long long"  or "unsigned long long" or, if you include <stdint.h>, you can declare them as int64_t or uint64_t, respectively
     
    64-bit ints are not available for PIC16 devices.
     
    Regards,

    Dave


    ok, why Mr. ghb said that it's possible if I install 2.05 xc8 ?


    So there is no way to make any change and use xc8 with 16f1936 and long long (64 bit)???
    #10
    davekw7x
    Entropy++
    • Total Posts : 1692
    • Reward points : 0
    • Joined: 2012/01/16 12:01:07
    • Location: Left Coast, USA
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 16:34:55 (permalink)
    +1 (1)
    ice_man
    davekw7x
    64-bit ints are not available for PIC16 devices.

    ok, why Mr. ghb said that it's possible if I install 2.05 xc8 ?


    So there is no way to make any change and use xc8 with 16f1936 and long long (64 bit)???


    Because mr qhb knows what he is talking about, and I made a mistake.
     
    My experience was with XC8 version 2.00.  With version 2.05, in C99 mode "long long" gives 64-bit integers for a PIC16F1939.
     
    Tested with MPLABX version 1.55, XC8 version 2.05.
     
    Sorry about my previous error.
     
    Regards,

    Dave
    post edited by davekw7x - 2019/03/22 16:39:34

    Sometimes I just can't help myself...
    #11
    ice_man
    Starting Member
    • Total Posts : 51
    • Reward points : 0
    • Joined: 2013/01/15 07:51:29
    • Location: 0
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 16:41:14 (permalink)
    0
    davekw7x
    ice_man
    davekw7x
    64-bit ints are not available for PIC16 devices.

    ok, why Mr. ghb said that it's possible if I install 2.05 xc8 ?


    So there is no way to make any change and use xc8 with 16f1936 and long long (64 bit)???


    Because mr qhb knows what he is talking about, and I made a mistake.
     
    My experience was with XC8 version 2.00.  With version 2.05, in C99 mode "long long" gives 64-bit integers for a PIC16F1939.
     
    Tested with MPLABX version 1.50, XC8 version 2.05.
     
    Sorry about my previous error.
     
    Regards,

    Dave




    Ok, no problem,so can I use long long 64bit in mplab 4.05 and xc8 2.05 for 16f1936 ? I ask because multiply
    some long long variable for example 900000000000 * 128 give bad result. I suppose something is wrong .Maybe I need change mode if it's possible ?
    post edited by ice_man - 2019/03/22 16:48:08
    #12
    NKurzman
    A Guy on the Net
    • Total Posts : 17155
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 17:11:15 (permalink)
    +1 (1)
    give bad result? how do you know it is Bad?  is your Old version of MPLabX telling you it is bad?  Or are you using some other method?
    #13
    ice_man
    Starting Member
    • Total Posts : 51
    • Reward points : 0
    • Joined: 2013/01/15 07:51:29
    • Location: 0
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 17:15:32 (permalink)
    0
    NKurzman
    give bad result? how do you know it is Bad?  is your Old version of MPLabX telling you it is bad?  Or are you using some other method?


     
    I use calculator ;), that simple :). I wrote procedure which check result, I know what result need to be (use calculator) present. Program give wrong result.
    #14
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3118
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 17:19:06 (permalink)
    0
    Multiplying 64bit numbers together will take forever.
    Even a 64bit left shift of 7 will take ages. (Post #12)
     
    If using a lot of 64bit math then consider a 16bit or 32bit chip.
     
     

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #15
    ice_man
    Starting Member
    • Total Posts : 51
    • Reward points : 0
    • Joined: 2013/01/15 07:51:29
    • Location: 0
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 17:25:14 (permalink)
    0
    Gort2015
    Multiplying 64bit numbers together will take forever.
    Even a 64bit left shift of 7 will take ages. (Post #12)
     
    If using a lot of 64bit math then consider a 16bit or 32bit chip.
     
     


    It was example with 128, there could be 9,45,129. Problem is in bad result. I use a few operation with variable over 32 bits. There is no way to use in simple program 16 or 32 bit chip :).
    #16
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3118
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 17:27:14 (permalink)
    0
    Is it essential to use 64bit math?

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #17
    ice_man
    Starting Member
    • Total Posts : 51
    • Reward points : 0
    • Joined: 2013/01/15 07:51:29
    • Location: 0
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 17:30:45 (permalink)
    0
    Gort2015
    Is it essential to use 64bit math?


    Gort2015
    Is it essential to use 64bit math?


    Yes, I need multiply (0- 999999999999)*(0-65535), there are a few that operation, but I need use it, there is no the other way.


    #18
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3118
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 17:50:19 (permalink)
    0
    Speed is not an issue?

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #19
    NKurzman
    A Guy on the Net
    • Total Posts : 17155
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Is there any solution to use long long (64-bit) in XC-8 ? 2019/03/22 17:51:05 (permalink)
    +1 (1)
    Define "wrong", Define "bad Result" and how you are determining it is wrong?
    900000000000 * 128 gives what?
    #20
    Page: 123 > Showing page 1 of 3
    Jump to:
    © 2019 APG vNext Commercial Version 4.5