please can you tell me how to declare an array of bits in CodeWarrior?
'C', in any case, is NOT very 'friendly' to booleans represented as single bits, and even LESS helpful trying to work with a 'array of one-bit booleans' in a bits[x] access fashion.
BUT the Kinetis 'K' family has the ARM bit-banding hardware that DOES allow (the CPU-only!) read and write access to single-bits anywhere in upper-RAM space! BUT I know of NO tools that are 'any help' in using this function. Firstly, you have to make sure the array is allocated in UPPER ram (the half starting at 0x20000000). In general, this means you have to 'make your own allocation' in space you steal from the linker.
So, say I take the top 4K away from the IDE tools (making the end-of-RAM in a 128Kram part 0x2000EFFF), and allocate myself some vars out there:
DIGOUT_bits DIGOUT_map @ 0x2000F000u; //Global storage of the current operational bits
Then a macro of this form will calculate the bit-band-alias address for that SRAM address:
#define BITBAND_SRAM_A(Addr,Bit) (0x22000000u + (((uint32_t)(Addr) - (uint32_t)0x20000000u)<<5) + (((uint32_t)(Bit))<<2))
which you can use, for instance, with a pointer like this:
uint32_t * offset;
offset = (uint32_t *)BITBAND_SRAM_A(&DIGOUT_map,0); //Convert to bit-band address, starting right at the LSB
*offset = 1;
and pointer-math will allow you to index any other bits in that space.
*(offset+3) = 3F;
The net-result of these two 'writes' is for 0x2000F000 to contain the byte 0x09.
The LSB is all you read or write, irrespective of the size of read or write performed.
Another way to get there is to pre-compute the bit-band address for the space you've carved out, and just allocate your 'booleans' out there (manually, of course!) for the compiler to address:
static uint32_t bits @ 0x221E0000u; //Bit-band alias of 0x2000F000, occupies 28-3/8 bytes
..or, alternative syntax: static uint32_t bits @ BITBAND_SRAM_A(0x2000F000, 0);
bits = 1;
printf(" %i %i %i\n",bits,bits,bits);
This is another case of a 'basic ARM function' for which the Kinetis documentation is 'terse' at best! You have to go right to www.arm.com to fetch the operational documentation such as DDI0439C_cortex_m4_r0p1_trm.pdf section 3.7 "Bit-banding".
I think that your post is at the wrong place.
Then I didn't understand your question.
The declaration of an array of bits depends on the programmation language.
If you a programming in C, C++. If you use MQX or not and so on...
If you give me more informations I may help you.
Moving the thread to the right place, thanks for your help Guillaume
give me the right place thank you
Did you fix your problem?
Hi Hectorit's okay thank you
Retrieving data ...