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.

How to Read a string from Hyperterminal?



We are using LM4F232H5qd microcontroller from Tiva series.i want to receive a string(group of characters,typically 5)
from hyperterminal using USB.i am able to read a single character but i could not read string.
May i know how to read more than one character from Hyperterminal.looking forward for your quick response.
  • Dear sir, I suppose you need grasp more about what is the scope of forum and why none is here at your service for free...
    next time try use google insert these word: "c String read"
    www.programiz.com/.../c-strings
  • Dear Roberto,
    i am sorry if my question sounds trivial to you.but my question is not to read a string in C.i am using LM4F232H5QD microcontroller from Tiva series for my application and the communication is based on USB.so far i have displayed my output to hyperterminal using USBBufferWrite() method.For reading data from hyperterminal to my application, i am able to read a single character using USBBufferRead() method.But i wanted to read more than a single character and store that into a buffer inside.could you please help me out on this?
  • Hello John,

    You would need to use USBBufferDataAvailable to find out how many bytes of data are there in the buffer and then use the same to call strcpy using USBBufferRead into a single string

    Regards
    Amit
  • john krishna yaragorla said:
    i am sorry if my question sounds trivial to you.but my question is not to read a string in C.i am using LM4F232H5QD microcontroller from Tiva series for my application and the communication is based on USB.so far i have displayed my output to hyperterminal using USBBufferWrite() method.For reading data from hyperterminal to my application, i am able to read a single character using USBBufferRead() method.But i wanted to read more than a single character and store that into a buffer inside.could you please help me out on this?

     Hi John, Sorry but from your original writing too many detail where missing and that was my perceived setup.

     Amit Answer addressed your issue?

     If not please can you give more detailed wording about what you expect and what you are getting instead? If not a problem some lines of code where problem arises can be of help too.

  • Dear Roberto,

         Thanks for understanding my concern.presently i am busy with working on another project due to that i have not tried Amit's suggestion.i will update the status of the problem after i try his suggestions.

  • Dear Amit,
    i couldn't try your suggestions as i am busy with some other work.
    In a mean while i am struck with another problem,i didn't want to start the new discussion for that small problem,that is why i am asking here.

    We are using LM4F232H5QD microcontroller from Tiva series.

    i am initializing a two dimensional array of floats at the beginning of my program.i am using that array later in my program(my objective is to make iterative updations to that array).But the problem is that array is having the values which are different from what i have initialized even before i attempt to update that array.

    i have put breakpoint and checked just after i run the code values are getting changed.How compiler is changing the values initialized by me without i modify them in my code?
  • Hello John,

    First of all LM4F is not the TM4C series. They are still considered Stellaris device class.

    When do the value get updated, did you check with breakpoints to the code that does so? Is there some other buffer which is overwriting the 2 dimensional array?

    Regards
    Amit
  • Hello Amit,

    yes i have checked with breakpoints.No other buffer is overwriting the array.

    The values are getting updated even before i use the array in my code.this behaviour i observed by putting breakpoints before the first use of that array in my code.

  • A couple of possibilities

    What you wrote in code and what you think wrote are different.
    Your breakpoint occurs before initialization, there is some leeway on when the compiler performs initialization.
    You are examining an area different than you are initialization.
    You are compiling as C++ but expecting C behaviour or vice versa.


    OK, I went over a couple.

    Robert