Hello,
i experiencing problem with code execution in Keil and CCS. I've connected to tiva adxl345 sensor, and i'm receiving interrupt on one of the pins and read the interrupt status register. Baseding on this value perform actions. Problem is really strange, in debug mode i can see the value of int_source which is 0x83 form most of the time. But i can see that this line is performed if (int_source && 0x20){
UARTprintf("\033[7;5H Double TAP"); }
. Which is totaly strange and it shouldn't work like that. Can you tell me form which point to start with ? What's more, i inject during debug mode other value to int_source ex. 0x10 so line with turning on diode works but for uC comparing 0x10 with 0x20 is equal..
Here's my code:
volatile unsigned short int_source=0;
void IntGPIOC(void){
ADXL345_READ(ADXL345_INT_SOURCE_REG, &int_source);
UARTprintf("\033[6;5H %d ",int_source);
if (int_source & 0x80){
ADXL345_READ_XYZ_REG(&axis[0],&axis[1],&axis[2],&axis[3]); // odczyt rejestrow akcelerometru
accel[0]=((axis[1]&0xFF00)|(axis[0]&0xFF)); // wylliczanie wartosci rejestrów
accel[1]=((axis[2]&0xFF00)|(axis[1]&0xFF)); // X Y Z.
accel[2]=((axis[3]&0xFF00)|(axis[2]&0xFF)); }
if (int_source && 0x20){
UARTprintf("\033[7;5H Double TAP"); }
if (int_source && 0x10){
ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_6, GPIO_PIN_6); status_value|=0; } //ustawienie statusu
if (int_source && 0x08){
ROM_GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_6, 0); status_value|=1;
adxl345_sleep_read_counter=systick_counter;
if (adxl345_sleep_read_counter>=750){ adxl345_sleep_read_counter=250-(1000-adxl345_sleep_read_counter); //calculating value of systick for reading adxl345 in sleep mode 4 times per sec
}
else {adxl345_sleep_read_counter+=250;}
}
GPIOIntClear(GPIO_PORTC_BASE, GPIO_PIN_4|GPIO_PIN_5 | GPIO_PIN_6|GPIO_PIN_7 );
}