Getbit troubles


+ Reply to Thread
Results 1 to 7 of 7

Thread: Getbit troubles1003 days old

  1. #1
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,415
    Thumbs Up
    Received: 48
    Given: 40
    Total Downloaded
    3.45 GB

    0 Not allowed!

    Default Getbit troubles

    Proton24 1.0.4.4
    Device is 24HJ128GP502

    Should GetBit work with 32 bit Dwords? I am having trouble:

    ACC_dword = %01010101010101010101010101010101

    For ix = 0 To 31
    bitty = GetBit ACC_dword, ix
    HRSOut Dec ix, " ", Bin1 bitty, "\r\n"
    Next
    Stop

    Bitty is always printed as "1". If I change bit 0 of ACC_dword to 0, bitty is always printed as "0".


    Charlie

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,599
    Thumbs Up
    Received: 341
    Given: 162
    Total Downloaded
    1.99 GB

    0 Not allowed!

    Default Re: Getbit troubles

    There is a slight problem with using a bit as the assignment with Getbit. It's been corrected and I'll upload a patch, but the simple workaround is to change the "Bitty" variable into a byte type.

    This is not a problem with PIC24 devices because they have quite a lot of RAM, and actually, sometimes, handle byte variables better than bit types.

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,415
    Thumbs Up
    Received: 48
    Given: 40
    Total Downloaded
    3.45 GB

    0 Not allowed!

    Default Re: Getbit troubles

    Many thanks Les, space is not a problem. It drove me nuts until I realised what was causing the trouble.
    On an unrelated feature of ram, can we use all the 52K that some dspic33 devices have as general ram?

    Charlie

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,599
    Thumbs Up
    Received: 341
    Given: 162
    Total Downloaded
    1.99 GB

    0 Not allowed!

    Default Re: Getbit troubles

    Yes, but the 16-bit device architecture only allows 8K of RAM, so indirect mechanisms come into place for all RAM access over 8K, and the compiler must use several mnemonics instead of only 1. i.e. Load the address of the RAM into a Wx register, then operate indirectly with the address. This is invisible to the end user, but it will increase code size.

    For example, to decrement a byte variable by 2 in normal RAM, the mnemonic is:

    Dec2.b pVariable

    However, if pVariable is above address 8192, the mnemonics become:

    Mov.w #pVariable,W0 ' Place the 16-bit address of pVariable into WREG0
    Dec2.b [W0],[W0] ' Dec2 the contents of the address

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,415
    Thumbs Up
    Received: 48
    Given: 40
    Total Downloaded
    3.45 GB

    0 Not allowed!

    Default Re: Getbit troubles

    The reason I ask is because I could make good use of a 52Kbyte ram. At the moment I am accessing an external sram using SHIN, SHOUT and an on-board ram is bound to be a lot quicker, even with indirect access. But if I substitute a 52Kbyte ram device type in my program, Proton says that I have used 11250 bytes from a possible 32K. I would have expected it to say 52K?

    thanks for the help.
    Charlie

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,599
    Thumbs Up
    Received: 341
    Given: 162
    Total Downloaded
    1.99 GB

    1 Not allowed!

    Default Re: Getbit troubles

    What device Charlie? Check it's PPI file and you'll see the amount of RAM. Alter this if required. I wrote a program that semi-auto creates the PPI files from Microchip information. However, recently, Microchip are hiding data from the end user, and they generally get things wrong anyway, so hence the semi-auto create. However, there are so many devices, I can't always examine each value in the PPI file for every devices, as there is only me doing it. So anomalies in the values do creep in.

    The Proton24 compiler auto arranges all your variables within the device's RAM, and places arrays at the highest location, because they are generally accessed with indirection, so using the higher RAM for storage will have no issues. Famous last words. LOL

  12. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #7
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,415
    Thumbs Up
    Received: 48
    Given: 40
    Total Downloaded
    3.45 GB

    0 Not allowed!

    Default Re: Getbit troubles

    Cheers Les!

  14. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. [SOLVED !] Anomaly with GetBit
    By Maxim in forum Proton 24
    Replies: 10
    Last Post: 10th May 2017, 12:13
  2. Variable size limits using GetBit
    By glenlivet in forum Proton Plus Compiler v3
    Replies: 6
    Last Post: 17th September 2016, 20:15
  3. Button troubles
    By chuckieboy in forum Proton Plus Compiler v3
    Replies: 6
    Last Post: 27th August 2012, 14:53
  4. ADC troubles again
    By chuckieboy in forum Proton Plus Compiler v3
    Replies: 37
    Last Post: 3rd January 2009, 16:52
  5. 16F506 Troubles
    By Gary Brooks in forum Proton Plus Compiler v3
    Replies: 9
    Last Post: 10th July 2007, 19:46

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts