07-10-2012 04:26 AM
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()
}
Solved! Go to Solution.
07-11-2012 01:29 AM
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
07-12-2012 03:36 AM
Hello rtessel,
Were you able to resolve the issue?
07-12-2012 05:08 AM
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:
Regards,
Ronald
07-18-2012 10:48 AM
Hello rtessel,
Thanks for sharing it!
This will for sure help other people who find your question/post..
04-03-2014 09:19 AM
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 😄
04-04-2014 11:18 AM
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:
Regards,
Ronald"
He said: "The descriptor file (USBdsc.c) of MikroC Pro was not correct" and made some modificacations described in the forum post
04-07-2014 03:43 AM
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