Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/06/07 05:26
Read: times


 
#132105 - Try this Function.
Responding to: ???'s previous message
Hello,

I used the below function on a frequency counter project a few years back.

Regards,

Charles Bannister
//**********************************************
//              float measure_read( void ) funtion
//              Assemble three counter results into
//              float varaiable.
//              Variable x passed to this function is the
//              Residual left over in 74LS393.
//              Frequency total = counter2+counter1+TL0+74LS393
//**********************************************

float measure_read( unsigned char x )
{
  union data1 {
  struct {
    unsigned char a;
    unsigned char b;
    unsigned char c;
        unsigned char d;
    } s;
  unsigned long var1;
  };
        union data1 counts;

        // counts
        counts.s.a = 0;
        counts.s.b = counter2;
        counts.s.c = counter1;
        counts.s.d = TL0;
        x = 0;
        // Take external 74LS393 into equation
        return ((counts.var1 * 256) + x);

}


List of 8 messages in thread
TopicAuthorDate
assigning 4 bytes to a single long variable inSDCC            01/01/70 00:00      
   Try this Function.            01/01/70 00:00      
      If you're worried about machine cycles            01/01/70 00:00      
   Unwise            01/01/70 00:00      
   have you read the manual?            01/01/70 00:00      
   do you now what a union is            01/01/70 00:00      
   #2            01/01/70 00:00      
      quted the relevant part...            01/01/70 00:00      

Back to Subject List