12.07.2015 Views

Modelo para trabalhos ABNT - Feevale

Modelo para trabalhos ABNT - Feevale

Modelo para trabalhos ABNT - Feevale

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

APÊNDICE E//Aplicativo <strong>para</strong> seleção de canal na switch unit//Fábio Alano Hedler 2010#include #include #include #include #include #include #include #include int main(int argc, char *argv[]){//Declaração de variáveischar canal[3];char buf[256] = {0}, bufswitch [20], SCPIcmd[128];ViSession defaultRM, vim;unsigned long actual;strcpy(canal, argv[1]);//Definição do endereço da switch unitstrcpy(bufswitch,"GPIB::009::INSTR");bufswitch[18]=0;//Abre sessão GPIBviOpenDefaultRM(&defaultRM);viOpen(defaultRM, bufswitch, VI_NULL, VI_NULL, &vim);//Lê o estado do canalstrcpy(SCPIcmd, "ROUTe:OPEN? (@");strcat(SCPIcmd, canal);strcat(SCPIcmd, ")");SCPIcmd[20]=0;viWrite(vim, (ViBuf)SCPIcmd, (ViUInt32)strlen(SCPIcmd),&actual);viRead(vim, (ViBuf)bufswitch, 1, &actual);bufswitch[actual] = 0;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!