This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28388D: How to compare two signed numbers?

Part Number: TMS320F28388D

Good afternoon.

Tell me how you can compare two signed numbers in C language?

int32_t res;
int32_t mass_U300[16];
int32_t norm_u300v = 0x7F68;

uint8_t detection_v (void) {

for (i = column_1; i <= column_4; ++i) {
    res = mass_U300[i];

			if ( res >  norm_u300v ) {
				erro_u300v = 0x2; //above normal
			} else if (res < ((int32_t)0x303A) ) {
				erro_u300v = 0x1; //below normal
			
			} else{
			    erro_u300u = 0;
			}
}
			
	return erro_u300v;
}

the value of mass_U300 changes depending on the execution of the program.

why does the function always return erro_u300v = 0x2 ?
the first condition is always satisfied.

  • Hello Sergey,

    Can you step through your code in CCS without any optimizations and show me the Expressions view for those two variables at runtime? I want to see what values they're comparing (you should be able to compare signed integers normally, there should be no problem with that).

    Best regards,

    Omer Amir