Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

C++ GPIB Code Too Fast?

I have written some software in Microsoft C++ to send commands to a Wavetek
3600D. When I run the program, none of the commands appear to be written to
the instrument and I get an ENOL error. However when I run the same program
with NI-Spy active, it usually works fine with only an occaisional ENOL
error after sending *RST. It seems to me that the straight program may be
executing too fast for the instrument. Is there a reliable C++ method to
make sure a command is executed before going to the next?

Thanks,
cledus
0 Kudos
Message 1 of 3
(3,997 Views)
When you get an ENOL error, then NO GPIB message was sent.
So you need to double check the basics. GPIB addressing?


cledus wrote:

> I have written some software in Microsoft C++ to send commands to a Wavetek
> 3600D. When I run the program, none of the commands appear to be written to
> the instrument and I get an ENOL error. However when I run the same program
> with NI-Spy active, it usually works fine with only an occaisional ENOL
> error after sending *RST. It seems to me that the straight program may be
> executing too fast for the instrument. Is there a reliable C++ method to
> make sure a command is executed before going to the next?
>
> Thanks,
> cledus

--
Best Regards,
Mike T

Mike Tranchemontagne
Consulting Applications Engineer
TeraC
omm, Inc.
148 Main Street
Building A, 3rd Floor
North Andover, MA 01845
877-900-TERA (8372)
978-557-9490 (FAX)
603-598-4773 (Direct Line and Cell)
0 Kudos
Message 2 of 3
(3,997 Views)
Steve Harbin wrote:

> It runs fine when NI Spy is active. This tells me that the addressing and
> syntax are ok. My theory is that NI Spy slows things down enough to cause
> the program to execute correctly.

OK, that's a good clue! IEEE488 uses a three wire handshake - NRFD (not
ready for data), DAV (data valid), NDAC (not data accepted) - so it should NOT
ordinarily be possible for the data transfer to "go to fast."

Two possibilties I can think of:

1) A bad GPIB cable or connector. I actually had this happen, many years
ago. I think it was the NDAC line that was open, floated to high, which was
interpreted as data accepted. Although this is a remote (no pun intended)
possibility, it's so easy to check, by swapping cables, that I had to
mention this first.

2) NI488 driver settings may have HS-488 mode turned on, or bus timing set
to fast. Go to Windows Control Panel, System Icon, Devices tab. Expand the
National Instruments GPIB Interfaces item. Click on your GPIB controller,
and Properties. Click NI488.2 Settings tab, then click "Advanced..." button.
Make sure HS488 cable length is set to "Off." Also set the bus speed to 2 us.

(Probably unrelated to your problem, but while you're there, consider
UNCHECKING Automatic Serial Poll and CHECKING Assert REN when SC.
IMHO, NI defaults these settings wrong.)

OK all the windows and give it a try. Reply to the newsgroup if you have
more questions. Good luck!

Best Regards,
Mike T

Mike Tranchemontagne
Consulting Applications Engineer
TeraComm, Inc.
148 Main Street
Building A, 3rd Floor
North Andover, MA 01845
877-900-TERA (8372)
978-557-9490 (FAX)
603-598-4773 (Direct Line and Cell)



>
> ----- Original Message -----
> From: "Mike Tranchemontagne"
> Newsgroups: natinst.public.gpib.general
> Sent: Monday, June 19, 2000 8:38 AM
> Subject: Re: C++ GPIB Code Too Fast?
>
> > When you get an ENOL error, then NO GPIB message was sent.
> > So you need to double check the basics. GPIB addressing?
> >
> >
> > cledus wrote:
> >
> > > I have written some software in Microsoft C++ to send commands to a
> Wavetek
> > > 3600D. When I run the program, none of the commands appear to be
> written to
> > > the instrument and I get an ENOL error. However when I run the same
> program
> > > with NI-Spy active, it usually works fine with only an occaisional
ENOL
> > > error after sending *RST. It seems to me that the straight program
may
> be
> > > executing too fast for the instrument. Is there a reliable C++ method
> to
> > > make sure a command is executed before going to the next?
> > >
> > > Thanks,
> > > cledus
> >
> > --
> > Best Regards,
> > Mike T
> >
> > Mike Tranchemontagne
> > Consulting Applications Engineer
> > TeraComm, Inc.
> > 148 Main Street
> > Building A, 3rd Floor
> > North Andover, MA 01845
> > 877-900-TERA (8372)
> > 978-557-9490 (FAX)
> > 603-598-4773 (Direct Line and Cell)
> >
> >







cledus wrote:

> I have written some software in Microsoft C++ to send commands to a Wavetek
> 3600D. When I run the program, none of the commands appear to be written to
> the instrument and I get an ENOL error. However when I run the same program
> with NI-Spy active, it usually works fine with only an occaisional ENOL
> error after sending *RST. It seems to me that the straight program may be
> executing too fast for the instrument. Is there a reliable C++ method to
> make sure a command is executed before going to the next?
>
> Thanks,
> cledus

--
Best Regards,
Mike T

Mike Tranchemontagne
Consulting Applications Engineer
TeraComm, Inc.
148 Main Street
Building A, 3rd Floor
North Andover, MA 01845
877-900-TERA (8372)
978-557-9490 (FAX)
603-598-4773 (Direct Line and Cell)
0 Kudos
Message 3 of 3
(3,997 Views)