|
![]() Keil 8051 Tools
![]() C construct for Carry Flag?
|
| next newest topic | next oldest topic |
| Author | Topic: C construct for Carry Flag? |
|
chuckcar Member |
Hello, I'd like to see if an addition set the carry flag? Does Keil support such a processor dependent thing? IP: Logged |
|
chuckcar Member |
OK, I see that there is a CY flag. Yes I understand all the implications and tradeoffs. Preach away if you must. IP: Logged |
|
worknhard9062 Member |
I take you at your word when you say you understand the implications and tradeoffs, so no preaching ![]() All of the processor flags are defined in Keil header files and therefore available to individually test. My only concern would be that the compiled code between the action and the flag test might do something to affect the flag. I would carefully examine the assembly language output from the compiler to verify your code will do as you intend. Happy programming. ------------------ IP: Logged |
|
hero_hont New Member |
ok you. do math calculation. I decide to limit the integer to 8 bits. If it exceeds 0xFF, then Carry flag should be set. C++ Compiler does not have the feature. I believe that it can be done to use if keyword. For example unsigned char Low_Byte = 0xFF; Low_Byte++; // Use IF to detect Carry
unsigned short Low_Byte = 0xFF; Low_Byte++; Thanks... ------------------ IP: Logged |
|
vanmierlo Member |
I decide to limit the integer to 8 bits. Why would you do that if you need 16 bit integers anyway? Low_Byte++; // Use IF to detect Carry Easy, check if Low_Byte == 0. IP: Logged |
All times are CT (US) | next newest topic | next oldest topic |
![]() |
|
Have you seen our MCU Knowledge Base?