We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Good moorning,
i would like question you if you know some library or configuration, to use in uVision with the Cortex M family, bit-type variable instance of having a minimal byte unit.
My object is get a eight bit from a byte. Someone like this:
Example 1 struct { int1 irxif; //CAN BUS Error Message Received Interrupt Flag bit int1 wakif; //CAN BUS Activity Wake-up Interrupt Flag bit int1 errif; //CAN BUS Error Interrupt Flag bit int1 txbnif; //Mode 0: CAN Transmit Buffer 2 Interrupt Flag bit //Mode 1,2: CAN Transmit Flag Interrupt bit int1 txb1if; //CAN Transmit Buffer 1 Interrupt Flag bit int1 txb0ef; //CAN Transmit Buffer 0 Intettupr Flag bit int1 rxbnif; //Mode 0: CAN Receive Buffer 1 Interrupt Flag bit //Mode 1,2: CAN Receive Buffer Interrupts Flag bit int1 rxb0if; //Mode 0: CAN Receive Buffer 0 Interrupt Flag bit //Mode 1:UNIPLEMENTED //Mode 2:FIFO Watermark Interrupt Flag bit } PIR5; Example 2 union{ struct{ union{ struct{ int1 interrupt_receive; int1 fifo_mode; int1 enable; int1 bits_14_mode; int1 int_source_readed; int1 void678:3; }; unsigned int8 registro; }REG_CTRL_FLG; union{ struct{ unsigned int REG_CTRL_TIMEH; unsigned int REG_CTRL_TIMEL; }; unsigned int16 REG_CTRL_TIME; }; unsigned int threshold; //Testing AXIS_STRUCT data_axis; AXIS_EXTEND_STRUCT data_full_axis; }register_acelerometer; unsigned int register[3]; }ACELEROMETER;
Thank you very much for you help and time.
Kinds Regards.
You mean something like this:
http://www.keil.com/pack/doc/cmsis/Core/html/unionxPSR__Type.html
Many (most?) of the vendor peripheral libraries do this sort of thing ...
you could put that byte in a bit bamded region. and then use the chip's built-in bit banding feature to access each individul bit, using hardware instead of code.
www.keil.com/.../armcc_chr1359124215562.htm
http://www.keil.com/forum/20028/question-using-bit-variables/