Quantcast
Channel: Data converters
Viewing all articles
Browse latest Browse all 88365

Forum Post: RE: ADS1241 Registers

$
0
0

Hi Bob,

Thank you for your very helpful  response. I have moved the interrupt routine outside the while loop and created variables that flag the main loop there is data available as you pointed out. It looks like creating the data string and transmitting tcp packets take most of the time at each cycle. Just printing a string out to the terminal takes .055 s or 55 mS, however adding the tcp transmission lines to transmit the 2 ADC channels in tcp increases the time to 220 mS.

 

 My while loop and interrupt controller follow.

 

        while (1) {             //printf("\r\n  n =  %i\n", n);               if (iFlag == 1)                 // iflag is set in ISR so do the following             {                 if (iMUX == 0)                     ChxStruct_ptr->A2D1 = getV();                 else                     ChxStruct_ptr->A2D2 = getV();                 iFlag = 0;                     }

            getTime();             //getChecksum();             getString();             int i2 = client.send_all(Ana_Data,strlen(Ana_Data));             if (i2<= 0) break;             iMUX++;                     // channel multiplexer toggle swtich             if (iMUX > 1)                 iMUX = 0;             // printf("%s\n", Ana_Data);         }

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

 

void isr4567() {     __disable_irq();                // disable all other interrupts     if (iMUX == 0)     {         spi.write(0x51);                 //   write to   MUX register         spi.write(0x00);                // number of register to be written -1         spi.write(0x67);                //   +Ch4, -Ch5      }     else     {         spi.write(0x51);                 //   write to   MUX register         spi.write(0x00);                // number of register to be written -1         spi.write(0x45);                //   +Ch4, -Ch5      }       wait(4*tosc);     spi.write(RDATA);     wait(50*tosc);                    // t9 = 10 Tosc = 10/4.9152e6 = 2.035 uS            _DOR2 = spi.write(0xFF);                 // Data registers        _DOR1 = spi.write(0xFF);                     _DOR0 = spi.write(0xFF);      iFlag = 1;                       // set flag so main knows there is data.     __enable_irq();// enable all other interrupts }

 

Best regards,

Hamid


Viewing all articles
Browse latest Browse all 88365

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>