I use ADS7843in my scheme. When I working with it, there were problems: at some moment the pin PENIRQ stops working (does not respond to touch press).
I use ATmega88PA and Mikroc Pro for AVR. The code for the conversion is as follows:
<program>
char Xpos_MSB, Xpos_LSB, Ypos_MSB, Ypos_LSB;
char buffer1, buffer2, buffer3, buffer4;
main()
{
while(1)
{
if (Peirq_bit == 0)
{
Chip_Select=0;
SPI1_Write(0b11010000); //X
Xpos_MSB = SPI1_Read(buffer1);
Xpos_LSB = SPI1_Read(buffer2);
SPI1_Write(0b10010000); //Y
Ypos_MSB = SPI1_Read(buffer3);
Ypos_LSB = SPI1_Read(buffer4);
Chip_Select=1;
}
}
}
</program>
Connection beyween LCD and ADS7843, ADS7843 and ATmega is made correctly.
The SPI is initialized as required by the ADS7843 datasheet (CPOL=0, CPHA=0).
The problem is the following, if I leave the processing of only X in the code or only Y then everything works.
Example:
...
Chip_Select=0;
SPI1_Write(0b11010000); //X
Xpos_MSB = SPI1_Read(buffer1);
Xpos_LSB = SPI1_Read(buffer2);
// SPI1_Write(0b10010000); //Y
// Ypos_MSB = SPI1_Read(buffer3);
// Ypos_LSB = SPI1_Read(buffer4);
Chip_Select=1;
...
But if I do them one by one, then after the first transformation the pin PENIRQ stops working. Help me please.