Closing Serial

I have created a property called SC and placed it in a module. SC is being declared as a serialControllerSubClass of Serial. SerialControllerSubClass has an assortment of methods. Currently, I don’t need to create a new SC instance in my App when I call methods in SerialControllerSubClass using SC.(MyMethod) so should I ever need to use SC.close? I’m unclear why I don’t need to use SC = New SerialControllerSubClass when I do use SC.Close. Does this make sense?

If the methods are Shared Methods, then no, you don’t need to instantiate it or close it. If they are regular methods, then you must instantiate it with SC = New SerialControlerSubclass somewhere before you can call the methods. Whether you need to close it is another issue altogether.

I now see how to get a shared method which I didn’t think I used. The confusion comes in when I have to use SC.Close or I encounter a serial write problem on my next method. This is not consistent and often I do not Close.

I don’t see any shared methods in SerialControlerSubclass.

So where are instantiating SC? And how are you using it?

Tim, I need to find a cleaner way to address my I/O commands so I’m going to rewrite my serial class and modules. I’ve fought changing baud rates that I have not been able to trace out and other inconsistencies which could even be cause by my new USB interface. I used a serial interface before which was reliable. I think I will set up a Select Case method to include different combinations of I/O read/write sequences for collecting temperatures, inputs, outputs and include logging code since I keep chasing a hang after many hours of operation. I believe it’s being caused by my serial class but have not been able to trace it out.