>>>>> "  Surya" == Surya P Kommareddy <[EMAIL PROTECTED]> writes:

  Surya> ===================================
  Surya> .......in RT_MODULE.C
  Surya> ...
  Surya> RTIME sampf;
  Surya> outb(dat, LPT_PORT);
  Surya> sampf=rt_get_time();                // store it in a variable
  Surya> rtf_put(1, &sampf, sizeof(sampf));        // put the variable in a FIFO
  Surya> ...
  Surya> ..
  Surya> =====================================
  Surya> ..........IN US_APP.C
  Surya> ...
  Surya> ..
  Surya> RTIME sampff;
  Surya> unsigned long low_word;        // declare low_word and high_word
  Surya> unsigned long high_word;

  Surya> read(rcv, &sampff, sizeof(sampff));   // read the data from the FIFO
  Surya> low_word= low_word | sampff;    // extract the low_word
  Surya> sampff= sampff>>32;        // shift by 32 bits
  Surya> high_word= high_word | sampff;        // extract the high_word


The low_word and high_word are not initialized in your use, so OR-ing
with them provides random data.

I think what you want here is probably this:

    read(rcv, &sampff, sizeof(sampff));         // read the data from the FIFO

    low_word= sampff;                           // Extract the low_word

    sampff >>= (sizeof(unsigned long) * 8);     // shift by the number 
                                                // of bits in the low-order
                                                // half of sampff
                                                // (zero filling the
                                                // high-order half)

    #if 0
    /* The above line could be simplified for a known 32-bit machine as: */
    sampff >>= 32;
    #endif

    high_word= sampff;                          // extract the high_word

----------------------------------------------------------------------

"How do you give Microsoft the benefit of the doubt when you know that
if you throw it into a room with truth, you'd risk a matter/anti-matter
explosion?"
                                                Nicholas Petreley


Derrell Lipman / Ham: N1YDI / Grumman Tiger, N28860 / http://InventionCity.com

 - Civil Air Patrol:
   Major Derrell Lipman
   Commander, LtCol Frank Pocher Minute Man Squadron, MAWG;
   Mission Pilot; Air/Ground Ops Director; Ground Team Leader
   Communications Unit Director; Patriot 461
   http://minute-man.mawg.cap.gov
--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/

Reply via email to