Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

serial communication Very new user

Dear User Forum.

I need some help or links to a very basic example or tutorial to use the MS  studio NI Visa for communications to a microcontroller sending about 12 characters to theserial port,

my problem is that desides the knowledge in Microcontroller programming and a very basic knowledge of VB ,I have no idea even where to start things like how to open or configure the

MS studio componets how to read the bytes at the comport ,I am hoping some one will lead me to a tutorial of an explenation of the very basic stuff which most of you already fogotten

Please help I woukd really appreciate it.The examples for DotNet in MS I found however with the basic comments in the code is just not enough to help a first time user

 

Thank you very much.

0 Kudos
Message 1 of 5
(3,869 Views)

Hi p.e.,

just to make sure we are talking about the same examples, I guess you are referring to the ones that come with the VISA driver, see here or here.

I will be referring to the basic example "NI-VISA\Examples\DotNET2.0\SimpleReadWrite"

I have to admit that the code would be easier to understand if it had some comments in it but let me just point out some of the major points:

- The most important object (in MainForm.cs) is the MessageBasedSession that represents the VISA session

- The VISA resource is selected in "SelectResource.cs" using the ResourceManager

- Then the session for the selected resource is opened

- When using e.g. the "Query" method (write, then read), the session's Query method is called (instance of MessageBasedSession.Query)

(Replacing or inserting the escape sequences in ReplaceCommonEscapeSequences (or Insert...) is required due to the handling of the back slash in C#

 

Basically all you really need to do is 

- create a MessageBasedSession object

- use its Open method to open a VISA resource (if you know its name you can hard-code it for now)

- use the Read, Write or Query functionality to transfer data, i.e. data bytes

- close the Session (call the dispose method).

 

I was referring to the C# example, although the VB example does exactly the same.

 

If you have any other questions regarding this topic don't hesitate to ask.

 

Best regards,

Peter

 

 

--
Peter A.
Field Sales Engineer, NI Germany
0 Kudos
Message 2 of 5
(3,846 Views)

Hi Peter

 

Thank you very much for you answers!!!

I have seen the examplel  in the Dotnet2.0 ,in the MS examples

I am currently in Germany (Paderborn) till friday 17-10-2008 then I wil be going back to Switzerland

I will on the weekend and next week go throuh your advice and the sample code

and try to link it to my Microcontroller.

I really appreciate your help.

Best Regards

Peter 

0 Kudos
Message 3 of 5
(3,842 Views)

Hi

 

You could use the standard serial component that comes with Visual Studio.

It is easy to use

 

Colin

0 Kudos
Message 4 of 5
(3,760 Views)

Hallo Colin

 

Thank you for your reply ,

I have seen the serial component in Visual Studio and its properties in the properties window,However no where can I find and simple

example to open the port read 12 bytes of data and the wait for the next 12 bytes to arrive.

if I could only see such a very very basic example then i could at least get started all the documentation on this is such that it is to high for

a person that never used these components.

 

anyway thank you once again

Pe 

0 Kudos
Message 5 of 5
(3,751 Views)