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.

Trying to use qs-logger demo in LM4f232 Evaluation

I am trying to use the qslogger demo in LM4f232 Evaluation. What I am doing is I created a function:

void display_float(unsigned int s,unsigned int t,unsigned int u,unsigned int v,unsigned int w,unsigned int x)
{
s=s+0x30;                        //convert each digit to equivalent ASCII value
t=t+0x30;
u=u+0x30;
v=v+0x30;
w=w+0x30;
x=x+0x30;


UART0_DR_R =x;
while((UART0_FR_R & ~(1<<5))==0);
UART0_FR_R =UART0_FR_R & ~(1<<5);
DelayMs1(100);

UART0_DR_R =w;
while((UART0_FR_R & ~(1<<5))==0);
UART0_FR_R =UART0_FR_R & ~(1<<5);
DelayMs1(100);

UART0_DR_R =v;
while((UART0_FR_R & ~(1<<5))==0);
UART0_FR_R =UART0_FR_R & ~(1<<5);
DelayMs1(100);

UART0_DR_R =u;
while((UART0_FR_R & ~(1<<5))==0);
UART0_FR_R =UART0_FR_R & ~(1<<5);
DelayMs1(100);

UART0_DR_R ='.';
while((UART0_FR_R & ~(1<<5))==0);
UART0_FR_R =UART0_FR_R & ~(1<<5);
DelayMs1(100);

UART0_DR_R =t;
while((UART0_FR_R & ~(1<<5))==0);
UART0_FR_R =UART0_FR_R & ~(1<<5);
DelayMs1(100);

UART0_DR_R =s;
while((UART0_FR_R & ~(1<<5))==0);
UART0_FR_R =UART0_FR_R & ~(1<<5);
DelayMs1(100);


UART0_DR_R ='\r';
   while((UART0_FR_R & ~(1<<5))==0);
   UART0_FR_R =UART0_FR_R & ~(1<<5);
   DelayMs1(100);
//usart_send_data('\r');
}

This function I am trying to call from  (in acquire.c)

static void
ProcessDataItems(tLogRecord *pRecord)
{


    DelayMs1(10000);
    display_float(1,2,3,4,5,6);
    tabspace();

    DelayMs1(10000);
    display_float(1,1,1,1,1,1);
    tabspace();

    DelayMs1(10000);

    display_float(2,2,2,2,2,2);
    DelayMs1(10000);



}




As you can see I have called this function three times:

   DelayMs1(10000);
    display_float(1,2,3,4,5,6);
    tabspace();

    DelayMs1(10000);
    display_float(1,1,1,1,1,1);
    tabspace();

    DelayMs1(10000);

    display_float(2,2,2,2,2,2);
    DelayMs1(10000);
 
 




But when I see the result in teraterm, I find it only prints values from two calls:

6543.21  1111.11

Why I am not getting out put from the third call which should print 2222.22


The defintions of tabspace() others are given below:


void tabspace()
{
      UART0_DR_R ='\t';
       while((UART0_FR_R & ~(1<<5))==0);
       UART0_FR_R =UART0_FR_R & ~(1<<5);
       DelayMs1(1);
}
void enter()
{
    UART0_DR_R ='\r\r';
       while((UART0_FR_R & ~(1<<5))==0);
       UART0_FR_R =UART0_FR_R & ~(1<<5);
       DelayMs1(1);
}
void DelayMs1(unsigned int count)
{  // mSec Delay 11.0592 Mhz
   unsigned int i;                      // Keil v7.5a
   while(count) {
       i = 115;                          // 115        exact value
               while(i>0)
               i--;
       count--;
   }
}


Please advice what is wrong here ?


 

  • Hi Uzair, your code appear as not TIVA related than C programming skill.
    Example you got was very complex and need to be fully understood before try modify.
    Some of your code appear really strange as from cut and paste from other unrelated processor:
    void DelayMs1(unsigned int count)
    { // mSec Delay 11.0592 Mhz
    unsigned int i; // Keil v7.5a
    while(count) {
    i = 115; // 115 exact value
    while(i>0)
    i--;
    count--;
    }
    }

    This code has no sense and forever got cut out by compiler or prefetch of TIVA too.
    If not wiped out by compiler, this code never wait 1mSec but few uS, TIVA is not an 8 bit like AVR I assume you got from, MSP at lowest frequency is more faster, TIVA load loop into prefetch and burn immediately. To be sure delay work use timer instead.
  • Thank you so much Roberto Romano for reply...

    I have edited my question to give you precisely what i am trying to do.


    can you please tell me about timer function which i should use?
    Is there any example for timer usage?

  • Of course, from TIVAWare examples you got original code there are timers examples too and how to use them.

    My first attempt was simply point to C programming, but I don't see nothing specify what is the intent of program nor we can understand what mean this:
    void display_float(unsigned int s,unsigned int t,unsigned int u,unsigned int v,unsigned int w,unsigned int x)
    {
    s=s+0x30; //convert each digit to equivalent ASCII value
    t=t+0x30;
    u=u+0x30;
    v=v+0x30;
    w=w+0x30;
    x=x+0x30;

    Imho it is a programming error and can work just if some preprocessing was splitting digit of value.. but why do that when we simply can use itos or printf or sprintf to directly print float or print to a string with format?

    while((UART0_FR_R & ~(1<<5))==0);
    UART0_FR_R =UART0_FR_R & ~(1<<5);
    are you sure this can belong to TIVA? Are some macro before?
  • Roberto Romano said:
    what is the intent of program nor we can understand what mean this:
    void display_float(unsigned int s,unsigned int t,unsigned int u,unsigned int v,unsigned int w,unsigned int x)
    {
    s=s+0x30; //convert each digit to equivalent ASCII value
    t=t+0x30;
    u=u+0x30;
    v=v+0x30;
    w=w+0x30;
    x=x+0x30;

    Hi Roberto,

    Suspect there are language, inadequate search/review of MCU manual/examples, and C coding issues - all rolled together. Unexplained is why the supplied demo program proves insufficient - it's worked fine for many, here...

    That said - those 6 variables (above) likely have 0x30 added so that the (likely) decimal value "n" becomes 0x3n.  This is usually required by character based Lcd modules so that numerals may be directly displayed. (i.e. sending 4 to such display will not cause a "4" to display - sending 0x34 will yield that "4."  However - as poster employs OLED - which is w/out ASCII char. generator - his intention (as you've stated) is hard to fathom... (unless his font table is ASCII based - then indeed that "4" font image would most likely appear @ font table location 0x34.)

    As you/I know - poster's request is too broad to be properly or fully answered.  KISS has been sacrificed to (likely) youthful "hope/enthusiasm" which so often works against poster goals/desires...  Devil (always) "in the details" - which most always demands serious thought/consideration...

  • Hi CB1, just to understanding between us, qs-logger is c++ style written object oriented too. This appear as a too far to understand to beginner and also require me and I think you too a long time to grasp how it work.
    It don't use conventional serial line but as required by this application type use USB Serial hi speed again buffered and object oriented structured approach.
    I don't understand from where come that code nor what is sense when sprintf(strvar,"value is %fn.d",floatvarname); can do all this job with more efficience and style too.
    Again if this forum intent is to broadserve also beginner a C beginner section is a MUST where is not OT to TIVA they can feel themselves more free to ask and can be served on level required.
    THIS HAS TO BE TIVA related discussion not a school for teaching free C intermixed by other processors imported code and asking to make it working.
    I insist slit and assign job to was propendant to.
    I appreciate a lot Luis I think is learning a lot, I don't appreciate Markel is failing a lot!!!
    Beginner question sometimes are good to read a part of manual and learn about if we don't know, we discover a lot of missing information from Datasheet (Thank a lot Amit, you are very precious to this) but all these got dispersed in an inform mass of useless question. So again I insist this one can be best served in an unspecialized C learning where someone can go to help and think find all is JUST C related not TIVA.

     Remember my post about 129 code when I ported to 123? sometimes examples are written to an unusable level nor they are usable other than they are.

    http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/379538

  • Roberto Romano..

    Yes it can belong to TIVA.

    And i want to get serial data on teraterm for which i have called three functions.
    i.e.

    DelayMs1(10000);
    display_float(1,2,3,4,5,6);
    tabspace();

    DelayMs1(10000);
    display_float(1,1,1,1,1,1);
    tabspace();

    DelayMs1(10000);

    display_float(2,2,2,2,2,2);
    DelayMs1(10000);

    You can see in display_float(), I am trying to fill in the registers with values I have received.

    Now I am trying to use timers as suggested by you to work correctly with delay.

    I also want to clarify that I do not need the output on OLED, but just on terraterm.

  • Roberto Romano..

    As you suggested me to use sprintf(), i used this but still i am not able to see data on srial terminal.

    static void
    ProcessDataItems(tLogRecord *pRecord)
    {

    unsigned int abc = 0x100;
    char arr[10];

    sprintf((char *)arr, "%d", abc);
    puts((char *)arr);
    }

    Where i am getting wrong.
    Can you please tell me how can i use sprintf() for my solution.
    Thanks..
  • uzair zaidi said:
    Can you please tell me how can i use sprintf() for my solution.

     Dear Uzair, I am so sorry but I don't know nothing about your solution as I bet none other than you if you have clear in mind know what are you doing.

     So I cannot help more than I try'd to do in our best way.

    uzair zaidi said:
    Where i am getting wrong.

     Many fold primary lack of C programming and TIVA library.

     To print to uart you need uartprintf and relative library included, I don't know what are you doing nor where you got that code seems of another processor.

    uzair zaidi said:
    sprintf((char *)arr, "%d", abc);
    puts((char *)arr);

     This is declaration use is different:

    sprintf(arr,"%d",abc);

    puts(arr); // this can work if console is defined

    uartputs(arr);

    or uartprintf("%s",arr);

     but this case

    uartprintf("%d",abc);

    do same

     Your programming level is beginner so this is more programming than TIVA.