Bit field structure difference between PSoC 1's HiTech Compiler and PSoC3's Keil Compiler
Anonymous
Not applicable
Mar 14, 2011
07:04 PM
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Mar 14, 2011
07:04 PM
Question: While migrating a bit field structure from PSoC Designer project to PSoC Creator project, structure does not work properly. Why it is so?
Answer:
The bit fields must be declared in the opposite order with the Keil compiler; LSB to MSB. Here is an example of the code difference required.
Hi-Tech Compiler:
struct
{
// MSB
unsigned Type : 4;
unsigned TxSeqn : 1;
unsigned Sync : 1;
unsigned RxSeqAckn : 1;
unsigned SingleByteDeviceId : 1;
// LSB
} sHdr;
Keil Compiler:
struct
{
// LSB
unsigned char SingleByteDeviceId : 1;
unsigned char RxSeqAckn : 1;
unsigned char Sync : 1;
unsigned char TxSeqn : 1;
unsigned char Type : 4;
// MSB
} sHdr;
Labels
- Tags:
- psoca 3
Rate this article:
Contributors
-
This widget could not be displayed.Anonymous