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.

CCS/BOOSTXL-K350QVG-S1: Coordinates of lcd screen

Part Number: BOOSTXL-K350QVG-S1
Other Parts Discussed in Thread: TM4C123GH6PM

Tool/software: Code Composer Studio

I have interfaced BOOSTXL-K350QVG-S1 with tiva. I have tried examples provided. 

Now I want to display the coordinates of the screen when I touch a particular point. Like in arduino we have getX, getY. Are there any APIs in tiva.

If not how can I get coordinates of any point by touching it?

  • Hi,

      Please refer to the graphic library user's guide for details of all the graphic APIs. Look for the API names ending with the Get, i.e. xxxxxxGet() like GrContexDpyHeightGet() or GrCoontexDpyWidthGet() or others. 

      

    There are more examples under <TivaWare_Installation>/examples/boards/dk-tm4c129x. You can try examples such as calibration, scribble that interacts with the touch screen. 

  • Greetings,

    Sheetal Patil said:
    How can I get coordinates of any point by touching it?

    Much depends upon the presence of a Touch-Screen Controller w/in your Display Kit.   My group will cover (both) cases (those with & without such an external Touch Control IC.)

    I. With a Touch Controller:  We've seen these produce the following outputs:

    • Voltage measured in each of the orthogonal planes
    • Coordinates measured in each plane
    • And sometimes - both voltage & coordinates

    There are many different Touch Controllers - you must properly review the Touch Controller's Manual to discover its output capabilities. 

    II. Without a Touch Controller:  Assuming the API does not satisfy your need:

    • It would be "unusual" for you to output such data to your user.   (w/in the final application)   Thus you must implement a "Special SW Mode" which outputs those coordinates upon the receipt of a "Special Command or hardware signal."   That "Coordinate Display Mode" would then persist until you 'Order it to cease.'
    • Upon a "touch" it is normal for an interrupt to be generated.   While you are w/in the "Coordinate Display Mode" you would provide a unique code path which would "deviate" from the "normal" Touch Operation - and instead output the Touch Coordinates.
    • W/in that interrupt the "raw ADC voltage" of (both) planes can be noted.   (Code should exist which (already) handles that - for both X&Y planes)
    • With the ADC voltage known - that data can then be easily scaled/translated to "Display Coordinate Values"
    • The final job then is to: "Output that coordinate data to a suitable position upon the Display."

    It is likely that a "brief Touch" will produce a transient (very short) ADC voltage detection.   You must insure that your code "Captures & Stores" those voltage readings - so that the remainder of the process "has eased access" to that, Touch-Point  ADC data.

    We are assuming that a "4-wire, resistive Touch-Screen is in play!    These force added HW & SW demands upon the MCU:

    • it is necessary to, "Power one plane at a time - while "reading the ADC" which is connected to the (other) plane during that process
    • upon the above's completion - the 2nd plane is powered & the other (first, now) plane is read

    To clarify - two of the 4 wires tie to ground.   These represent the ground "edge" of each plane.   The 2 remaining Touch-Screen connections must serve two roles:

    • receive power while the other plane is being read
    • then switch to an ADC input

    this process continues - and sometimes multiple readings are obtained & then averaged.   It should be clear that, "Reading the Touch Panel's voltage demands a well thought & executed approach."

    Add-On (not quite an edit) - Crack Staff notes that there are MANY Code Examples which:

    • Configure & then obtains the ADC's Output in its (standard - NON Display Coordinate) form
    • and usually outputs such ADC Data to an attached PC via a UART/ICDI combination.   Now in your case - that may (or may not) prove a successful alternative.   (still requires unique SW development on YOUR part!)
    • Should you reject the "PC's presentation" then you must "Replace" the UART Output application w/what's been outlined (above).

    Our group posted about these "4-wire Touch Panels" a few months earlier - you'd likely benefit from finding & studying that writing...

    The ability to "Read the ADC Voltage and present that to an attached Display" is a great asset - and enjoys VALUE FAR beyond the (limited) "touch panel coordinate detection!"   (thus a more general & improved (i.e. REAL SOLUTION!)

  • Thankyou.

    I tried the toggle led code for touchscreen but the touchscreen is not working. The led does not toggle after touching. Is there a problem with my screen because i have used the demo code.

    My code is getting stucked in WidgetMessageQueueProcess(). The touch is not sensed. Even I tried using a different lcd still the issue remains the same.

  • Which demo are you running? Which LaunchPad are your using?

  • I am running lab10 of Tiva Launchpad workshop. I am using TM4C123GH6PM and lcd is BOOSTXL-K350QVG-S1.

  • Do you have the R9 and R10 resistors removed on your launchPad? If not, you need to remove them in order to work. 

  • I have removed R10 initially when the display was not working. Then I was able to display images. I didn't remove R9.

    I will remove it and try.

  • My issue got solved without removing the R9 resistor. The touch.c file was wrong as it was for different device. I just replaced it and the touchscreen is working now.

    Thanks to all for the advice.

  • I tried to get the coordinates of the screen, when I am touching at upper left corner technically I should get 0,0 but instead I get x=13, y=1

    Even the bottom right corner gives 313,218 which is not correct. Why are the coordinates wrong? Any clue?

    I used touch screen interrupt to get the coordinates.

  • Good that...

    Sheetal Patil said:
    Now I want to display the coordinates of the screen when I touch a particular point.

    Are you stating that your "original goal" (& thread's title - as above) has been achieved?    (somehow - that appears, "Forgotten!")

    And ... if that's so - "How do you switch between "Display Coordinate & Normal Touch" Processing?    (Users are unlikely to "welcome" the Coordinate Display w/each/every "Touch!")

    [edit]  Your latest post & mine just "crossed."

    There should exist a "Calibration Routine" which enables "fine adjustment" of the Touch Screen Coordinate management...   It is (not) unusual for the Touch-Screen's Active Area to exceed the display's pixel field.   Proper software enables you to then, "Capture & Correct" the transmission of "Accurate Screen Coordinates" as you desire.   (i.e. to the Screen or elsewhere...)

  • Hi,

      On my reply on Tue, Feb 18 2020 9:35 AM I recommend examples such as calibrate. Although this is an example developed for the TM4C129 EVM, you can reference it and port to TM4C123.