From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

OpenCom Function resets hardware

Solved!
Go to solution

Hello,

 

I have a perculiar problem. I have a test setup and I want to communicate to it via RS232.

I am communicating with an Arduino ATMega (which might be part of the problem...) using a USB cable and the RS232 protocol at 19200 baud. I am using COM12 (not that it matters)

I am using Win7.

I have a program called Hercules which is basically hyper terrminal. I can successfuly use it to open my COM port and communicate with my test setup and everything works fine.

 

I have also opened NI Max and used the Visa Test Panel of COM12 to communicate with my test setup with success. Again everything works fine.

 

HOWEVER!

When I try to use the program I am writing in CVI I get different behavior. When I open the com port, my hardware is going through some sort of reboot.

I am confused becasue this doesn't happen using NI Max, not to mention Hercules. I have made NO changes to my hardware.

But since I am able to communicate with two other software methods, I cannot imagine it's a hardware issue. Am I missing something?

 

Ths is my code. I have tried both OpenCom versions. I also tried 9600 Baud with no change.

//OpenComConfig (12, "COM12", 19200, 0, 8, 1, 0, 0);

OpenCom (12, "COM12");
CloseCom(12);

 

Any help would be appreciated.

Veni Vidi Duci
0 Kudos
Message 1 of 5
(4,276 Views)

HI DB_IQ, 

If you don't mind clarifying, what exactly is happening that makes you think it is going through some sort of reboot? 

The article linked below mentions that if the specified port is already open, OpenComConfig closes the port and then opens it again. I'm wondering if that might be what you're referring to? 

http://zone.ni.com/reference/en-XX/help/370051V-01/cvi/libref/cviopencomconfig/

Shalini M.
Partner Development Engineer
Alliance Partner Network
National Instruments
0 Kudos
Message 2 of 5
(4,253 Views)

No problem.

My Arduino circuit has some LED's and controls an LCD screen.

It also connects to another board that is powered and has LED's of it's own that indicate status.

 

When I connect via serial to my hardware, I am observing the LCD revert to it's default state as well as activity of LED's on the second board.

I am sorry but I cannot share specifics of the design 😞

 

I did, however, just observe that after testing my CVI code and going back to Hercules, that program also caused a reset.

But, I can open and close repeatedly after the initial reset without it occuring again.

So, I wonder if there is a hardware consideration I have to look at after all.

 

I will keep digging.

 

Veni Vidi Duci
0 Kudos
Message 3 of 5
(4,248 Views)
Solution
Accepted by topic author DB_IQ

Arduino is designed to reset everytime the port is opened.

You can see the same behaviour when you use the embedded Serial Monitor into Arduino IDE.

It is called the autoreset feature and is utilized by arduino IDE to load programs to your board.

 

It resets the board and when the bootloader responds, the IDE talks to it and loads the program without the need of an ICSP tool.

If you want to disable it, I think there is a solder-jumper you can easily remove.

Check the bottom of the board.

 

Uno has this feature, I hope Mega has it too.

Search the forums for "auto-reset feature" for more updated info.

 

Hope this helps.

S. Eren BALCI
IMESTEK
0 Kudos
Message 4 of 5
(4,154 Views)

I think your right. It's not code, at the very least.

Whatever it is is hardware and is not an issue for NI.

Veni Vidi Duci
0 Kudos
Message 5 of 5
(4,003 Views)