Home Forums Programming Books and Reviews C program that sends 1mA to all Si sensors

Viewing 0 reply threads
  • Author
    Posts
    • #1986
      Shayaan_Mustafa
      Participant

      Hi,
      Can someone help me in understanding this program. I need to try this with Labview Software. 

      /* THIS PROGRAM SENDS ONLY 1mA TO all si SENSORS [137 to 0 ]
       TO DIFFERENTIATE
       BETWEEN SENSORS DIPPED IN LIQUID & VAPOUR. VOLTAGES ACROSS THESE
       SENSORS ARE STORED IN A FILE OPENED*/

            #include
            #include
             #include
            #include
            #include
       //     #define CSRC 14
            #define DVM 12
            int status;
            //unsigned int v2;
            float v1;
            extern Base=0x200;
            error_handler(error,routine)
           
            int error;
            char *routine;
            {
       char ch;
       if(error!=0)
          {
           printf("nError in call to %s n",routine);
           printf("Press any key to continue:");
           scanf("%c",&ch);
         }
            }
            initialize_hpib()
            {
       settimeout(3000);
       error_handler(status,"SETTIMEOUT Error");
       return;
            }
            sourcesetup()
             {
        char *str;
                  transmit("DCL",&status);
           error_handler(status,"Device Clear");
         /*
        str="D0R0T0G0K0F0X";
        send(CSRC,str,&status);
        error_handler(status,"CSRC INITIALISING EEROR");
         */
        str="F0R2G1P10X"; /*SET UP THE DVM */
        send(DVM,str,&status);
        error_handler(status,"DVM setting error");
             }
        /*
             csrcsetup()
       {
         char *str,cv[20];
         int l;
         str="L2B2I+1E-3V+3E+0P1X";
         send(CSRC,str,&status);
         error_handler(status,"CSRC SETTING ERROR");
          str="L2B2X";
          send(CSRC,str,&status);
          error_handler(status,"CSRC ERROR");
         str="F1X";
         send(CSRC,str,&status);
         error_handler(status,"CSRC EXECUTION ERROR");
                 delay(1000);
                  enter(cv,20,&l,DVM,&status);
          error_handler(status,"ENTER statement");
          v1=atof(cv);
          return;
          }
        */
           /*
             trigger()
             {
         error=IOTRIGGER(CSRC);
         error_handler(error,"IOTRIGGER");
       
          error=IOTRIGGER(DVM);
         error_handler(error,"IOTRIGGER");
           delay(100);
             }
            */
             main()
             {
        int l,sensor_no;
        char cv[20],buf[6000];
        FILE *fp;
        fp=fopen("smtochk1.c","w+");
        clrscr();
        printf("n THIS PROGRAM IS TO INDIVIDUALLY CHECK THE VOLTAGEn ACROSS EACH SENSOR. PRESS ANY KEY TO SWITCH TOn NEXT SENSOR");
        printf("n PRESS CTRL-BREAK KEY TO SUSPEND/QUIT THE JOB");
        outportb(Base+0x09,7);/*UNIPOLAR & INPUT RANGE 0-10V*/
        outportb(Base+0x0c,3);/*SOFTWARE TRIGGER ENABLING*/
        outportb(Base+0x0a,0);/* UNIPOLAR WITH CH0 SELECTION*/
         printf("n THIS PROGRAM WRITES THE CURRENT OUTPUT IN THE FILE "smtochek1.c"n [WHICH CAN BE SAVED]");
         initialize_hpib();
         sourcesetup();
         printf("nn SENSOR NO.t VOLTAGE IN voltS.");
        for(sensor_no=137;sensor_no>=0;sensor_no--)
         {
          outportb(Base+0x0,sensor_no);
       //   csrcsetup();
       //   trigger();
                 enter(cv,20,&l,DVM,&status);
          error_handler(status,"ENTER statement");
          v1=atof(cv);
         printf("nn %dt %f", sensor_no,v1);
          sprintf(buf,"n Sensor no=%d Voltage at   1mA is %f V",sensor_no,v1);
          fputs(buf,fp);
        getch();
        }
        printf("nOVER ");

         transmit("DCL",&status);
         error_handler(status,"Device Clear");
       getch();
             }

      Thanks in advance.

Viewing 0 reply threads
  • The forum ‘Programming Books and Reviews’ is closed to new topics and replies.