Hello,
I have tried to use a touch screen with a microcontroller MK53DN512CMD10, i'm trying to configure the hardware. It's connected as shown on the table.
TOUCH-SCREEN | MICROCONTROLLER PIN NAME |
---|---|
CS | PTC9 |
RST | PTC10 |
D/C | PTC11 |
WR | PTC12 |
RD | PTC13 |
DB0 | PTC0 |
DB1 | PTC1 |
DB2 | PTC2 |
DB3 | PTC3 |
DB4 | PTC4 |
DB5 | PTC5 |
DB6 | PTC6 |
DB7 | PTC7 |
Y+ | ADC1_DM1/ OP1_DM0 |
Y- | PGA1_DP/ ADC1_DP0/ ADC0_DP3 |
X+ | PGA1_DM/ ADC1_DM0/ ADC0_DM3 |
X- | ADC1_SE16/ OP1_OUT/ CMP2_IN2/ ADC0_SE22/ OP0_DP2/ OP1_DP2 |
LED-A | DAC0_OUT/ CMP1_IN3/ ADC0_SE23/ OP0_DP4/ OP1_DP4 |
And i maded this configuration so far:
#define D4DLCD_CS | 9 |
#define D4DLCD_DC | 11 |
#define D4DLCD_WR | 12 | // WRITECLOCK | |
//#define D4DLCD_WR_PORT | PTED | // WRITECLOCK | |
//#define D4DLCD_WR_DDR | PTEDD | // WRITECLOCK |
#define D4DLCD_RD | 13 | // READCLOCK |
//#define D4DLCD_RD_PORT | PTED | // READCLOCK |
//#define D4DLCD_RD_DDR | PTEDD | // READCLOCK |
#define D4DLCD_RESET | 10 |
/*********** Power macros - for modification uncoment and modify ***********/
// Define void macros, because TWR-K60 board doesn't use RESET pin
#define D4DLCD_INIT_RESET | SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;\ |
CONFIG_PIN_FUNCTION(C,10,1);\ | |
OUTPUT(C,10) |
#define D4DLCD_ASSERT_RESET WRITE_PIN(C,10,0);
#define D4DLCD_DEASSERT_RESET WRITE_PIN(C,10,1);
// Define void macros, because
#define D4DLCD_INIT_CS | SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;\ |
CONFIG_PIN_FUNCTION(C,9,1);\ | |
OUTPUT(C,9) |
#define D4DLCD_ASSERT_CS WRITE_PIN(C,9,0);
#define D4DLCD_DEASSERT_CS WRITE_PIN(A,9,1);
// Define void macros, because
#define D4DLCD_INIT_DC | SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;\ |
CONFIG_PIN_FUNCTION(C,11,1);\ | |
OUTPUT(C,11) |
#define D4DLCD_ASSERT_DC WRITE_PIN(C,11,0);
#define D4DLCD_DEASSERT_DC WRITE_PIN(C,11,1);
// Define void macros, because
#define D4DLCD_INIT_RD | SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;\ |
CONFIG_PIN_FUNCTION(C,13,1);\ | |
OUTPUT(C,13) |
#define D4DLCD_ASSERT_RD WRITE_PIN(C,13,0);
#define D4DLCD_DEASSERT_RD WRITE_PIN(C,13,1);
// Define void macros, because
#define D4DLCD_INIT_WR | SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;\ |
CONFIG_PIN_FUNCTION(C,12,1);\ | |
OUTPUT(C,12) |
#define D4DLCD_ASSERT_WR WRITE_PIN(C,12,0);
#define D4DLCD_DEASSERT_WR WRITE_PIN(C,12,1);
#define D4DLCD_INIT_DATA | SIM_SCGC5 |= SIM_SCGC5_PORTC_MASK;\ |
CONFIG_PIN_FUNCTION(C,0,1);\ | |
OUTPUT(C,0);\ | |
CONFIG_PIN_FUNCTION(C,1,1);\ | |
OUTPUT(C,1);\ | |
CONFIG_PIN_FUNCTION(C,2,1);\ | |
OUTPUT(C,2);\ | |
CONFIG_PIN_FUNCTION(C,3,1);\ | |
OUTPUT(C,3);\ | |
CONFIG_PIN_FUNCTION(C,4,1);\ | |
OUTPUT(C,4);\ | |
CONFIG_PIN_FUNCTION(C,5,1);\ | |
OUTPUT(C,5);\ | |
CONFIG_PIN_FUNCTION(C,6,1);\ | |
OUTPUT(C,6);\ | |
CONFIG_PIN_FUNCTION(C,7,1);\ | |
OUTPUT(C,7);\ | |
OUTPUT_ALL(C) |
#endif /* __D4DLCDHW_GPIO8080_8B_CFG_H */
I try to run my code and got stuck on the next function at the d4dlcdhw_common.c file:
static void Cpu_Delay100US(unsigned short us100)
{
unsigned int i;
while((us100--)){
for(i=0; i < (MCU_BUS_CYCLES_100US/10); i++)
{// 10 cycles delay
asm("NOP");
asm("NOP");
asm("NOP");
}
}
}
¿Is my configuration correct?
¿how do i configure the adc for the touch-screen?
¿how do i use the DAC output for the backlight ?
I will apreciate a lot your help !!!!!
Regards
已解决! 转到解答。
Hello Alberto,
I saw that there is another thread with the same question D4D library troubles using a touch-screen LCD / MK53DN512CMD10 microcontroller, I will be answering there, is that OK?
Best regards,
Earl.
Hi Earl,
Thanks for your answer. I'm using a touchscreen model NHD-1.8-128160EF-CTXI-T and yes i'm migrating form another project.
I left the link of the datasheet below.
Regards
Alberto
http://www.newhavendisplay.com/specs/NHD-1.8-128160EF-CTXI.pdf
Hello Alberto,
I saw that there is another thread with the same question D4D library troubles using a touch-screen LCD / MK53DN512CMD10 microcontroller, I will be answering there, is that OK?
Best regards,
Earl.