Test and Measurement Forum

Unable to open device, status=12

Post your C and C++ discussions here

Unable to open device, status=12

Postby labfis » Tue Sep 18, 2012 2:22 pm

Hardware: PicoScope4224
Software: PS4000sdk_r10_4_3_1, example PS4000con.c compiled in Borland C++ (Windows XP and Windows 7)
Picoscope 6 works ok

How can I communicate with picoscope?
Thanks
labfis
Newbie
 
Posts: 0
Joined: Tue Sep 18, 2012 1:43 pm

Re: Unable to open device, status=12

Postby Martyn » Tue Sep 18, 2012 2:31 pm

Is PicoScope 6 still running when you try to open the device in your application ?

Have you linked against ps4000bc.lib ?
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2344
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Unable to open device, status=12

Postby labfis » Tue Sep 18, 2012 6:56 pm

1. PicoScope 6 is not running
2. I linked ps4000bc.lib to the project because otherwise I can not compile it.
labfis
Newbie
 
Posts: 0
Joined: Tue Sep 18, 2012 1:43 pm

Re: Unable to open device, status=12

Postby Martyn » Wed Sep 19, 2012 10:06 am

Can you post back exactly what you see in the console window.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2344
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Unable to open device, status=12

Postby labfis » Wed Sep 19, 2012 11:44 am

I had to reduce the PS4000con.c just keeping the
status = ps4000OpenUnit(&(unit.handle)) funcion because I could not compile it, it is attached and console print screen also.
printscreen.PNG
printscreen.PNG (2.93 KiB) Viewed 3301 times
Attachments
bcb.zip
(3.11 KiB) Downloaded 160 times
labfis
Newbie
 
Posts: 0
Joined: Tue Sep 18, 2012 1:43 pm

Re: Unable to open device, status=12

Postby Martyn » Thu Sep 20, 2012 6:09 am

Can I see the errors you get when you try to compile the console program as supplied in the sdk.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2344
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Unable to open device, status=12

Postby labfis » Thu Sep 20, 2012 8:36 am

I removed the linux headers then the first error was on
struct tTriggerChannelProperties sourceDetails = {triggerVoltage,10,triggerVoltage,10,PS4000_CHANNEL_A,LEVEL };

[C++ Warning] conio.h(181): W8058 Cannot create pre-compiled header: code in header
[C++ Warning] PS4000con.c(280): W8065 Call to function '_kbhit' with no prototype
[C++ Warning] PS4000con.c(299): W8065 Call to function 'fopen_s' with no prototype
[C++ Warning] PS4000con.c(335): W8065 Call to function '__min' with no prototype
[C++ Warning] PS4000con.c(350): W8012 Comparing signed and unsigned values
[C++ Warning] PS4000con.c(443): W8065 Call to function '_kbhit' with no prototype
[C++ Warning] PS4000con.c(466): W8065 Call to function 'fopen_s' with no prototype
[C++ Warning] PS4000con.c(506): W8065 Call to function '__min' with no prototype
[C++ Warning] PS4000con.c(559): W8004 'status' is assigned a value that is never used
[C++ Warning] PS4000con.c(608): W8065 Call to function '_kbhit' with no prototype
[C++ Warning] PS4000con.c(643): W8065 Call to function '__min' with no prototype
[C++ Warning] PS4000con.c(645): W8065 Call to function 'fopen_s' with no prototype
[C++ Warning] PS4000con.c(755): W8065 Call to function 'fopen_s' with no prototype
[C++ Warning] PS4000con.c(771): W8065 Call to function '_kbhit' with no prototype
[C++ Warning] PS4000con.c(830): W8004 'retry' is assigned a value that is never used
[C++ Warning] PS4000con.c(830): W8004 'status' is assigned a value that is never used
[C++ Error] PS4000con.c(984): E2063 Illegal initialization
======
[struct tTriggerChannelProperties sourceDetails = {triggerVoltage,10,triggerVoltage,10,PS4000_CHANNEL_A,LEVEL };]
======
[C++ Error] PS4000con.c(986): E2063 Illegal initialization
[C++ Warning] PS4000con.c(1034): W8004 'status' is assigned a value that is never used
[C++ Error] PS4000con.c(1045): E2063 Illegal initialization
[C++ Error] PS4000con.c(1046): E2063 Illegal initialization
[C++ Warning] PS4000con.c(1186): W8004 'status' is assigned a value that is never used
[C++ Warning] PS4000con.c(1214): W8065 Call to function 'scanf_s' with no prototype
[C++ Warning] PS4000con.c(1248): W8065 Call to function 'scanf_s' with no prototype
[C++ Warning] PS4000con.c(1341): W8065 Call to function 'scanf_s' with no prototype
[C++ Warning] PS4000con.c(1342): W8065 Call to function 'fopen_s' with no prototype
[C++ Warning] PS4000con.c(1344): W8065 Call to function 'fscanf_s' with no prototype
[C++ Warning] PS4000con.c(1375): W8065 Call to function 'scanf_s' with no prototype
[C++ Warning] PS4000con.c(1410): W8065 Call to function 'scanf_s' with no prototype
[C++ Error] PS4000con.c(1497): E2063 Illegal initialization
[C++ Error] PS4000con.c(1498): E2063 Illegal initialization
[C++ Warning] PS4000con.c(1590): W8065 Call to function '_kbhit' with no prototype
Attachments
PS4000con.zip
(29.45 KiB) Downloaded 172 times
labfis
Newbie
 
Posts: 0
Joined: Tue Sep 18, 2012 1:43 pm

Re: Unable to open device, status=12

Postby Martyn » Thu Sep 20, 2012 10:57 am

This looks like a lib file issue, correct this and then it should work

Can you try using coff2omf.exe at a command prompt to convert ps4000.lib into a lib file for use in C++ Bulider XE

The executable can be found in the Embarcadero bin directory and is used :-

coff2omf ps4000.lib newps4000bc.lib
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2344
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots


Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests