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.

TM4C123GH6PM: Inputting data into Kentec display from outside world

Part Number: TM4C123GH6PM

Hello,

So I have been working with the kentec display for the last couple of months. It has been a challenge, and I have slowly made progress with it. I am trying to get values from the outside like a measure of rpm of a bike, and try to display it to the screen. I have done the lab 10 example that was provided, and got that to work. Now I am not sure how to get something from the outside world to display on the screen. Does anyone have any example labs or ideas as to how to start doing something like this? 

Thanks,

Mike

  • If you have completed LAB 10, you know how to display information on the Kentec display. Are you asking, how to measure the RPM of a bicycle with a TM4C123G? There are many ways, but the most common is to use a Hall effect sensor mounted to the frame of the bike and wired to the TM4C and a magnet mounted on the wheel. The output of the Hall effect sensor is connected to a timer input. (It may need filtering, buffering, or level translating depending on the sensor you use.) The TM4C can then measure the time from one pass of the magnet to the next. From that number it can calculate RPM, and knowing the diameter of the wheel, can calculate speed.

  • Hello,

    yes thats what we are doing to get the rpm measurements. I am just confused as how I can take that measurement and display it on the screen. I got other things to display on the screen, but i am not sure how i am going to get the rpm measurement to display on the screen.

    Thanks
  • I am not sure which part you don't understand. You display the number with GrStringDraw() or GrStringDrawCentered() just like in workshop 10. You can convert the number into a string with sprintf(). Is your question how to convert the timer capture value into a RPM value?
  • If poster can (robustly) install one magnet to the wheel - adding 3 more (90° apart) will "4x increase" (both) Speed Accuracy & Resolution!

  • During Lab 10 they never really said much about getting data from the outside world. I never used the string commands. So would i take the value I get from the RPM and place it in the () of GrStringDraw? That's the part I dont understand is how to write the code correctly for the display. Am i making the data stored from the timer a variable, and then placing it with the GrStringDraw?

    Thanks,

    Michael Winter

  • Assuming you calculated the RPM and store it as an integer, you could pass it to a subroutine like this:

    #include "stdio.h"
    PrintRPM(uint32_t rpm, tContext *pContext)
    {   char string[40];
    
        sprintf(string,"RPM: %d\0",rpm);
        GrContextFontSet(pContext, &g_sFontCm18);
        GrContextForegroundSet(pContext, ClrSilver);
        GrStringDraw(pContext, string, -1, 0, 50, 0);
    }
    

  • HI bob,

    Thanks for the code I have been trying to use it. I was just curious as to where i place it. Should this be in main or outside? Also when i ran the code i did not see anything show on the screen. Do i need to add any other code besides my RPM input in order to have a figure show up?

    Thanks,

    Michael Winter 

  • Hello,

    I am also getting this error when i am trying to combine my timer code and the display code. The timer code was built on an older version, and the display was built on the newest one. I am getting this error when building it. 

    these are my headers as well

    I thought that these all matched up correctly 

    thanks,

    Michael Winter 

  • Hello Bob,

    I have been trying to get this code to work for the past couple weeks now, and it is not displaying anything to the screen. I have it set up like you have above, and its not working. I have this function to be displaying on a canvas. will it not work if i have it set up for a canvas this way? The only value i am getting on the canvas is "D." I am not sure why this is happening.

    Thanks,
    Michael Winter