dword Aliases


+ Reply to Thread
Results 1 to 5 of 5

Thread: dword Aliases135 days old

  1. #1
    Member Jezsmith's Avatar
    Join Date
    Sep 2004
    Posts
    209
    Thumbs Up
    Received: 6
    Given: 2
    Total Downloaded
    930.95 MB

    0 Not allowed!

    Default dword Aliases

    HI,


    I am trying to read a pressure sensor which outputs a 24bit value and capturing it with Buisin and thus placing the recieved bytes in a DWORD
    Code:
        Dim MSBCSB As Dword             ' holds pressure bytes
        Dim OUT_P_LSB As MSBCSB.Byte0   ' Alias unsigned Part1 to the low byte of Dwd
        Dim OUT_P_CSB As MSBCSB.Byte1   ' Alias unsigned Part2 to the 2nd byte of Dwd   
        Dim OUT_P_MSB As MSBCSB.Byte2   ' Alias unsigned Part3 to the 3rd byte of Dwd  
        Dim Part4     As MSBCSB.Byte3   ' Alias unsigned Part3 to the high 4th byte of Dwd
    
       pressure_ready = BusIn Control, $00                       ' read status reg
        
        If  pressure_ready.3 = 1 Then                           ' check ready bit to see if conversion done
            BusIn Control, $01,[OUT_P_MSB, OUT_P_CSB, OUT_P_LSB]  ' get pressure data
            fraction = (OUT_P_LSB >>4)/16.0                      ' returns the fraction bits 4-7 lef shifted
            MSBCSB = MSBCSB >>6 '+ fraction
         EndIf
    I get an error saying OUT_P_MSB does not exists ie byte2. However if i change the variable to a Float it finds byte2

    i am on proton24 1.0.5.9

    any ideas
    regards
    jez
    Last edited by John Drew; 4th June 2019 at 01:24.

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.

  • #2
    Member Jezsmith's Avatar
    Join Date
    Sep 2004
    Posts
    209
    Thumbs Up
    Received: 6
    Given: 2
    Total Downloaded
    930.95 MB

    0 Not allowed!

    Default Re: dword Aliases

    OK,
    i can put a value in byte 0,1, and 3 but not 2
    Code:
    Dim OUT_P_LSB As MSBCSB.Byte0   ' Alias unsigned Part1 to the low byte of Dwd
        Dim OUT_P_CSB As MSBCSB.Byte1   ' Alias unsigned Part2 to the 2nd byte of Dwd   
        Dim OUT_P_MSB As MSBCSB.Byte3   ' Alias unsigned Part3 to the 3rd byte of Dwd
    regards
    jez
    Last edited by John Drew; 4th June 2019 at 01:27.

  • 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
    Administrator John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,755
    Thumbs Up
    Received: 77
    Given: 33
    Total Downloaded
    4.30 GB

    0 Not allowed!

    Default Re: dword Aliases

    I wrapped it in code for you Jez so it's easier to read.
    Use "Go Advanced", highlight your code, then click the hash icon.
    John

  • 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.

  • #4
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,334
    Thumbs Up
    Received: 289
    Given: 138
    Total Downloaded
    1.60 GB

    0 Not allowed!

    Default Re: dword Aliases

    I'm ever so sorry for not replying sooner, as my internet has been dreadful for the past week or so and I could not connect with any reliability, if at all most of the time. :-(

    I've looked at the compiler's source code and that issue has been with the compiler for many years now. LOL Since I added the 64-bit floating point variables quite a while back! It is down to a simple mistake in my boolean multi-part comparison, where I used "&&" instead of "||" when checking some particulars as to whether the variable was suitable for a .Byte2 directive to be added :-) Where "&&" is "And" in the languages of C and C++, and "||" is "Or" within comparisons. It's amazing how a single slight mistake in boolean can cause problems in a program that has hundreds of thousands of lines of code as the compiler does. LOL

    I have it corrected and I'm busy creating an installer for the update. The update also has an addition to the Inc and Dec commands for both Proton and Proton24 where instead of just Inc Variable or Dec Variable, the compiler now has Inc(Variable, Variable or Expression) and Dec(Variable, Variable or Expression). This will increment or decrement by the amount held in the second parameter.

    I've updated the Proton manual, and am currently re-formatting and adding to the Proton24 manual.
    Last edited by top204; 5th June 2019 at 11:18.

  • 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
    Member Jezsmith's Avatar
    Join Date
    Sep 2004
    Posts
    209
    Thumbs Up
    Received: 6
    Given: 2
    Total Downloaded
    930.95 MB

    0 Not allowed!

    Default Re: dword Aliases

    Les,
    Many thanks always appreciate your assistance. Top codin no G
    regards
    jez

  • 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. A clarification about the use of ALIASES
      By wirecut in forum Proton Plus Compiler v3
      Replies: 14
      Last Post: 12th March 2012, 18:52
    2. Array aliases
      By grahamg in forum Proton Plus Compiler v3
      Replies: 6
      Last Post: 8th March 2012, 11:11
    3. Dword help please
      By staffstony in forum Proton Plus Compiler v3
      Replies: 22
      Last Post: 24th February 2007, 07:15
    4. Arrays & Aliases
      By cgriffin in forum Proton Plus Compiler v3
      Replies: 12
      Last Post: 21st October 2006, 00:11
    5. HRSIN and Dword
      By Mark Rodgers in forum Wish List / Product Feedback
      Replies: 0
      Last Post: 25th August 2003, 02:06

    Posting Permissions

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