From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA usb, read problems

Solved!
Go to solution

Hello,

 

I'm doing a project where Labview must communicate with a uC (microchip, mikroC PRO for PIC). Unfortunately, it doesn't work correct, sending data to the uC is good but cann't transmit data to the PC (Labview). The program remains in the loop "while (! HID_Write (& writebuff2, 64)). '

 

For writing and reading, I use the example program "USB RAW - bulk.vi". If I 'pushed the Bulkin button then I get the following error welding "Error -1073807302 occurred at VISA Read in USB RAW - Bulk.vi" but if I click Bulk Out, then I receive data in the uC.

 

Can someone help me maybe? thanks 

 

 

 

 

 

Piece of uC code:

 

unsigned char readbuff2[64] absolute 0x500;   // USB Buffers should be in USB RAM

unsigned char writebuff2[64] absolute 0x540;  // USB Buffers should be in USB RAM

 

void USB_enable()

{

  char cnt;

  HID_Enable(&readbuff2,&writebuff2);     

}

 

void USB_Communication()

{

  char Read_Reg;

 

  if (HID_Read())

  {

    switch (readbuff2[0])

    {

      case Reg_Addr_Software_Version:      //read Software_Version

      {

        writebuff2[0]= Reg_Addr_Software_Version;

        writebuff2[1]= Software_Revision_H;

        writebuff2[2]= Software_Revision_L;

        writebuff2[3]= 0;

        break;

      }

      default:

      {

        writebuff2[0]= Reg_Addr_Automatic_Response_Warning;

        writebuff2[1]= 0;

        writebuff2[2]= Address_Fail;

        writebuff2[3]= 0;

        break;

      }

    }

    while(!HID_Write(&writebuff2,64));

  } // end HID_Read()

}

 

 

 

 

0 Kudos
Message 1 of 8
(4,756 Views)
Solution
Accepted by topic author rtessel

The program MAX (Measurement & Automation Explorer) I also get an error, see attachment. When I press the read button then I get the error "VISA: (Hex 0xBFFF003A) Unable to start operation Because setup is invalid (due to attributes being set to an inconsistent state).". The write function works, see data coming in the uC.

 

 

Also added a logfile, there are two failures, USB_BULK_IN_STATUS and viRead.

 

Regards,

Ronald

Download All
0 Kudos
Message 2 of 8
(4,725 Views)

Hello rtessel,

 

Were you able to resolve the issue?

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 3 of 8
(4,683 Views)
0 Kudos
Message 4 of 8
(4,676 Views)

Hello rtessel,

 

Thanks for sharing it!

 

This will for sure help other people who find your question/post..

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 5 of 8
(4,640 Views)

Hi EVERYBODY

 

I'am student, and im working on project thats im using LABWINDOWD/CVI (2010) and Pic 18f4550.

I wrote my program on LABWINDOWS, and i program my piv in MICRO PRO C (version 5.60) 

the program of the pic is to read what i write (i mean i write text and i must receive the same text).

i installed Visa, and i arrived to make the connection between ISIS and the LABWINDOWS (i mean i test everything vitually)

but when i write the text, the pic receivit without problems, and the pic doesn't send me the text, and i the LAbwindows show me that i have problem in this function (viread).

Actually i dont know the problem, and i need ur help because i need to start working practiclly on the project soon, and i nees to make sure that virtually i dont have no problem.

 thank  😄 

0 Kudos
Message 6 of 8
(4,131 Views)

Did you look at the links describing the solution?

 

"Yes I solved the problem.

 

I found the solution in this topic: http://forums.ni.com/t5/LabWindows-CVI/Control-PIC18F4550-via-USB-with-LabWindows-CVI/td-p/694804

 

And see the solution in topic:

http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/VISA-RAW-FOR-USB-USING-PIC18F4550/m-p/2064030...

 

Regards,
Ronald"

 

He said: "The descriptor file (USBdsc.c) of MikroC Pro was not correct" and made some modificacations described in the forum post

Taylor B.
National Instruments
0 Kudos
Message 7 of 8
(4,097 Views)

Hi Ronalds

 

I chnaged the  adresses of the discriptor as you told me, and thanks a God, it s works now.

 

Thanks you very much for ur help

 

Regrads

 

Mark

0 Kudos
Message 8 of 8
(4,054 Views)