Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial bus-- bytes at Port returns 0 with termination character disabled

Solved!
Go to solution

Hi Lynn,

 

 

I finally solved the problem. You gave a good hint that it could be one of the drivers.

 

It turns out that the problem was the USB based virtual serial port was the problem. Since I switched over to downloading from my laptop’s serial port, I have not had any blue screen of death. I have tested it several times, and it seems to work…but no crashes. So I guess I am good for now.

 

What I do not know is what was causing the problem. The USB based serial port seem to run a bit faster but it always crashed… sometimes quickly sometimes after a few runs..

 

I have also made several changes along the way, which were source of several other problems but fixing all of them did not stop the blue screen of death.

 

I am attaching a zip file with all of the major changes listed below. I may still have several problems but at least it does not crash.  It may also be useful for others who like me a re new to LV.

 

Appreciate if you take a look at the files attached to see if I am still doing something structurally wrong ?

Any help would be appreciated.

 

Thanks.

Bhal Tulpule

 

***********Major changes….

  1. 1.   Local variable No_OF_PKTS moved out of the VI.
  2. 2.   Bytes_at_port removed.
  3. 3.   Removed baud rate and other parameters for the Serial port setup in multiple places in Send_A_Pkt_Rev6.
  4. 4.   Added flat sequence structure to control sequence of execution.
  5. 5.   Removed VISA Basic function in Sync VI and replaced it with Read_Write_For_Sync.

 

I have many technical problems with my device and other issues but since the PC does not crash I am able to address them one by one.

 

Thanks for your help.

 

Bhal Tulpule

P.S. I think it would be educational to find out why USB based virtual serial port does not work with LV. Maybe there could be warning to users about this…

0 Kudos
Message 21 of 23
(1,068 Views)

Bhal Tulpule,

 

USB to RS-232 adapters have a notorious history of strange behavior.  Some brands work better than others. There may be settings within the OS which can help. Although likely not the issue in your case, the power settings which allow the OS to shutdown power to the USB port after an idel period causes many problems.

 

Your VI still has some problems.  In the Idle state you must press Connect twice to change to the Connect state.  Turn on Execution Highlighting (the lightbulb on the block diagram toolbar) and run the VI.  Wait until the little dots stop moving on the block diagram then press Connect.  You will see that the value fed to the Select inside the event structure is the value which was present on Menu when the program started running, not the changed value.  

 

New Value.png

 

Similarly, the Serial Port selector will use the value which was present at the time the VI starts running, not the value to which it may be changed later.

 

Read the Help files for Event Structures. It is highly recommended that only one event structure be used in a program.  Alsoe things like opening a file, which may take some time, should generally not be inside an event structure.  Look at the Consumer/Producer Design Patterns for an alternative approach.

 

The sequence structures in Make_Next_Pkt_Rev2.vi do nothing. That VI will produce exactly the same results without them.  Generally it is better to avoid sequence structures.  They are rarely needed in well-written LV programs.

 

Lynn

Message 22 of 23
(1,057 Views)

Hi Lynn,

Oh, so that's how the double bounce on Connect works. I tried several ways but did not get it...

I will fix up all these and post the results. Hope fully it helps others too.

Thanks and Kudos to you..

Best Regards.

Bhal Tulpule

0 Kudos
Message 23 of 23
(1,052 Views)