www.pudn.com > c51_ads1232.rar > ADS1232.txt, change:2010-12-26,size:1078b


void adsample(unsigned char ch) 
 
  { 
 
    unsigned char i; 
 
       unsigned long la="0"; 
 
       unsigned long la1; 
 
       unsigned long ula; 
 
       unsigned int ia; 
 
       
 
       CLK_Off(); 
 
       if(ch==0) 
 
         {SA0_Off();} 
 
        else 
 
         {SA0_On();} 
 
       PD_Off(); 
 
       asm("nop"); 
 
       asm("nop"); 
 
    asm("nop"); 
 
       PD_On(); 
 
       asm("nop"); 
 
       asm("nop"); 
 
    asm("nop"); 
 
       while((PRT0DR&0x01)==0x01) 
 
         {} 
 
       for(i=0;i<24;i++)   
 
         { 
 
            la=la<<1; 
 
               CLK_On(); 
 
               asm("nop"); 
 
               asm("nop"); 
 
               asm("nop"); 
 
            if(PRT0DR&0x01) 
 
                 {la=la|0x00000001;} 
 
               else 
 
                 {} 
 
             
 
               CLK_Off(); 
 
               asm("nop"); 
 
               asm("nop"); 
 
          } 
 
    CLK_On(); 
 
    asm("nop"); 
 
    asm("nop"); 
 
    asm("nop"); 
 
    CLK_Off(); 
 
    adresult=la; 
 
       
 
       
 
   }