Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

PIC USB connection using Visa4.3.0

Hi Philipp,
 
The data transfer between Labview and the device is usually in 8 bits. This can be read or written using hexadecimal representation in Labview so make sure to change the 'Display style' of the  of the string box into 'hex display'. This can be done by right clicking the box and go to the properties and choose the display style as 'hexadecimal' instead of 'normal'. I am attaching my test VI. This can be used to read and write data to the device. Use 'bulk' transfer for both in and out endpoint while using this VI. Hopefully this will help you.
 
Regards,
Hary
0 Kudos
Message 11 of 14
(2,201 Views)

Hi Hary,

currently I try to communicate with a PIC18F4550 just like you do. But I have problems with the "read" function. In fact I am the "CVI-person" Philipp talked about 😉

Your microcontroller firmware seems to be very similar to my own. I also use the MCHPFSUSB framework. But perhaps the error is located in my microcontroller-program.

What parts of the MCHPFSUSB Framework have you changed? For my part, I just modified user.c, user.h and io_cfg.h. Do you have changed something else (descriptor files?). Perhaps you could show me the parts you changed or just give me some hints!

Thank you very much!

Best regards

Angela

 

0 Kudos
Message 12 of 14
(2,152 Views)
Hi Angela,
 
Sorry for my late reply. Is your problem only with read or there is a problem with read as well?
The other important thing that has to be changed for my device was the usbcfg.h. I need to comment out the #define USE_SELF_POWER_SENSE_IO and #define USE_USB_BUS_SENSE_IO because I used PORTA as the input and output pin.
If the problem is only with the read function. It can be the hardware problem. How does your chip connection look like?
 
 
Hary
0 Kudos
Message 13 of 14
(2,061 Views)

Hi Hary,

thanks for your tip with the SENSE_IO, I changed that in my program.

I finally was able to solve the problem. My problem was, that the read function in LabWindows always collapsed (but write function worked...). Look at this threat for more details: http://forums.ni.com/ni/board/message?board.id=180&thread.id=35267

I solved the problem by changing the endpoint descriptors in the microchip framework (file: usbdsc.c). They now look like this:  

 /* Endpoint Descriptors *
sizeof(USB_EP_DSC),DSC_EP,_EP01_OUT,_BULK,64,0x00,
sizeof(USB_EP_DSC),DSC_EP,_EP01_IN,_BULK,64,0x00

Finally I created 3 different ports on my PIC and I am able to control them with CVI.
PORT A -> analog input,
PORT B -> digital input 
PORT D -> digital output.

Best regards and thanks for your help!

Angela

0 Kudos
Message 14 of 14
(2,045 Views)