LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Singlton - Serial Communication - DVR

Hi All,

I am developing a device driver which based on serial communication. Attached project file represents a base class Communicant and other child classes of it. Let’s focus on ‘CommuncantSeriaPort class’,

 

Method VI’s: OnStart.vi      :- Is for initializing the Communication                                             – VISA Open

                       OnSend.vi     :- Is for sending a string through Established Communication  – Visa Write

                       OnReceive.vi:- is for Receiving string through Established Communication  – Visa Read

 

I am new LVOOP, What I want to achieve is,

 

If there are two serial port devices connected and user wants to use them simultaneously then how to achieve this using singleton concept and DVR concept?

 

It will be great if anybody would guide me through..

 

Thank you..

 

Regards,

Amit

-
Amit
CLAD
Download All
0 Kudos
Message 1 of 7
(3,837 Views)
You don't need a separate class for each port unless the ports operate in fundamentally different ways. All you need is are two instances of single class.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 7
(3,809 Views)
Oh yes, remember that in LabVIEW:

Object = wire

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 7
(3,804 Views)

Hi Mike,

 

Thank you for your response. My understanding is Singlton is making sure to have only ONE copy(Instance) in memeory .

 

For example at the very begining  user initalize COM1 port, so one instance of class is created in the memory,

 

Now, user wants to initialze COM port 2 then, I need to call fresh copy of Class instance but at the same time how to save and reuse first instance ?

 

Thank you.

 

 

-
Amit
CLAD
0 Kudos
Message 4 of 7
(3,796 Views)
There is no reason you can't have two instances of a class in memory at the same time. Like I said an instance of a class is an object and in LabVIEW an object is a wire.

Part of the class data should be a value indicating which port to use. Two instances would be two wires which could carry different values.

When I get to work, I'll post a link that will help.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 7
(3,776 Views)
Message 6 of 7
(3,762 Views)

Thank you Mike..this links have significant info for beginner like me.

-
Amit
CLAD
0 Kudos
Message 7 of 7
(3,729 Views)