Manipulating and Viewing Bits in Crossworks and Crossconnect

Comments

1 comment

  • Avatar
    Darcy Williams

    Thousands of individual bits?  Yep, it supports display of "bool" without a problem but in actual fact the compiler treats this as a uint8 anyway so you're not saving on memory.

    Another option, but not the nicest, would be to use a bit fields structure.  Have a read: http://en.wikipedia.org/wiki/Bit_field

    My preference is is to use the enum method at the bottom.  This doesn't allow easy viewing though but is a nice way to do it without hundres of #defines

    Given the large memory of the device you're going to, best bet might be to use a struct of uint8_t's (or bools, same thing)

    &hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,
    &hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFE,&hFE,&hFE,
    &hFC,&hF8,&hF8,&hF0,&hC0,&h00,&h00,&h00,&h00,&h00,&h00,&hFF,&hFF,&hFF,&hFF,&hFF,
    &hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,
    &hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&h00,&h00,&h00,
    &h00,&h00,&h00,&h01,&h03,&h07,&h0F,&h1F,&h3F,&h7F,&hFF,&hFF,&hFF,&hFF,&hFF,&hFE,
    &hFC,&hF8,&hF0,&hE0,&hC0,&h80,&h00,&h00,&h00,&h00,&h00,&h80,&hC0,&hE0,&hF0,&hF8,
    &hFC,&hFE,&hFF,&hFF,&hFF,&hFF,&hFF,&h7F,&h3F,&h1F,&h0F,&h07,&h03,&h01,&h00,&h00,
    &hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hF0,&hF0,&hF0,&hF0,&hF0,&hF0,
    &hF0,&hF0,&hF0,&hF0,&hF0,&hF0,&hF0,&hF0,&hF0,&hF0,&hF9,&hFF,&hFF,&hFF,&hFF,&hFF,
    &hFF,&hFF,&hFF,&h7F,&h1F,&h00,&h00,&h00,&h00,&h00,&h00,&hFF,&hFF,&hFF,&hFF,&hFF,
    &hFF,&hFF,&hFF,&hFF,&hFF,&hF0,&hF0,&hF0,&hF0,&hF0,&hF0,&hF0,&hF0,&hF0,&hF0,&hF0,
    &hF0,&hF0,&hF0,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,
    &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h01,&h03,&h07,&h0F,&h1F,
    &h3F,&h7F,&hFF,&hFF,&hFF,&hFF,&hFF,&hFE,&hFE,&hFE,&hFF,&hFF,&hFF,&hFF,&hFF,&h7F,
    &h3F,&h1F,&h0F,&h07,&h03,&h01,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,
    &hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&h0F,&h0F,&h0F,&h0F,&h0F,&h0F,
    &h0F,&h0F,&h0F,&h0F,&h1F,&h3F,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hF3,
    &hC3,&h81,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&hFF,&hFF,&hFF,&hFF,&hFF,
    &hFF,&hFF,&hFF,&hFF,&hFF,&h07,&h07,&h07,&h07,&h07,&h07,&h07,&h07,&h07,&h07,&h07,
    &h07,&h07,&h07,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,
    &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h80,&hC0,&hE0,&hF0,&hF8,
    &hFC,&hFE,&hFF,&hFF,&hFF,&hFF,&h7F,&h3F,&h3F,&h3F,&h7F,&hFF,&hFF,&hFF,&hFF,&hFE,
    &hFC,&hF8,&hF0,&hE0,&hC0,&h80,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h00,
    &hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&h00,&h00,&h00,&h00,&h00,&h00,
    &h00,&h00,&h00,&h00,&h00,&h00,&h00,&h01,&h03,&h0F,&h1F,&h7F,&hFF,&hFF,&hFF,&hFF,
    &hFF,&hFF,&hFF,&hFC,&hF8,&hF0,&hC0,&h00,&h00,&h00,&h00,&hFF,&hFF,&hFF,&hFF,&hFF,
    &hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,
    &hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&hFF,&h00,&h00,&h00,
    &h00,&h00,&h00,&h80,&hC0,&hE0,&hF0,&hF8,&hFC,&hFE,&hFF,&hFF,&hFF,&hFF,&h7F,&h3F,
    &h1F,&h0F,&h07,&h03,&h01,&h00,&h00,&h00,&h00,&h00,&h00,&h00,&h01,&h03,&h07,&h0F,
    &h1F,&h3F,&h7F,&hFF,&hFF,&hFF,&hFF,&hFE,&hFC,&hF8,&hF0,&hE0,&hC0,&h80,&h00,&h00
    0
    Comment actions Permalink

Please sign in to leave a comment.