LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Mega 2560 - 5002 error

Hi Everyone,

I have had quite  a few mega 2560's work with the toolkit on serial and with a bluetooth modem. I did have trouble originally but found a few suggestions work well. Firstly simply hooking up an input to init.vi would not work for me for some reason (why ???), so I changed the init.vi internally to the correct serial port and the correct board, then saved those values as default (really handy to save time). The other thing to do is the obvious turn your computer off and on and reset the arduino, I had a vi run really quickly and I never noticed it connect, but it had run and not shut down the serial port correctly. Lastly if these are not working I run the com port at 115K baud, so check that when you have the correct baud rate, check in device manager to see if the port is even there (the mega 1280 shows up with a name in device manager but the mega only show somthing like virtual serial port) and lastly when inside init.vi check that when you refresh the com port it comes up with that little symbol like to computers connected together.

I dont know if these are the problems, but hopefully it helps.

Regards

Canalian

0 Kudos
Message 31 of 61
(1,993 Views)

Can some people with MEGA 2560 problems try the VIs at the end of this post and let us know if it solves your problems.  If it does we can roll it into the toolkit.

-Sam K

LIFA Developer

0 Kudos
Message 32 of 61
(1,993 Views)

I finally got my Mega 2560 back to make the test on my end.

I didn't find any difference whether or not the Serial Character Event is introduced in the code.

I tested RyanNaz's proposed modifications and it works. However, simply removing the Flow Control setting also works for me, so I'm not sure if registering for Serial Character Events is necessary or not.

All I can say is that it didn't affect my connectivity with the Arduino Mega 2560, so whether it's rolled into the code or not is fine with me so far.

About the other suggestions in the link to the arduino forum: I didn't have to add any resistor between my 5V and reset pins to make it work. It seems that the FlowControl setting was the only problem for me.

This simple modification to the Init.vi alone has worked for my 5002 problems.

http://content.screencast.com/users/normandinf/folders/Jing/media/b20c3b74-65e7-4128-aaa2-54d9c55ab753/init_arduino.png

GCentral ChampionCLA
0 Kudos
Message 33 of 61
(1,993 Views)

I had the same problem and tried a number of solutions. normandinf solution worked right off the bat. 

LeMur Technology Services, LLC
0 Kudos
Message 34 of 61
(1,993 Views)

Hi everyone

I have some problems in my project which need your help. 

     Idea is:X4-FIG2.jpg

     I have 2 wires from EMONA Datex board: one connect to "A" in ADDER module, another

connect to "2 kHZ sine" in MASTER SIGNALS module as image.

    I connect 2 wires to 2 port on Arduino Mega 2560 board.

    Then, Can I use LabVIEW software to connect or disconnect 2 points together.

Would you like to help me how to do it?

Best regards,

0 Kudos
Message 35 of 61
(1,993 Views)

So you are basicly trying to make or break a connection between two wires, if that is the case why not just use a digital output to control a relay, this is a simple way to make or break a connection.

Message 36 of 61
(1,993 Views)

I have a Mega 2560 "pre R3" version that exhibits the 5002 error problems described by others.  I fixed it using the 10 sec delay described by MAElabman above.  I have also experimented with RyanNaz's VISA Event versions of Init.vi, Close.vi and Wait for Bytes.vi and find that they to have the 5002 error problem.  In Wait for Bytes.vi the error cluster is connected to a shift register which unnecessarily latches error events.  Changing the shift register to tunnels and using the 10 sec delay of above seems to eliminate the 5002 errors and works best.

0 Kudos
Message 37 of 61
(1,993 Views)

Hi KSouza,

I am using LabView to make and break connection of 2 wires.

So would you like help me how to do it?

Best wish

0 Kudos
Message 38 of 61
(1,993 Views)

Hey,

KSouza is right. One of the best ways to do this would be to use one of the digital outputs on the Arduino board to control a relay.

Kevin Fort
Principal Software Engineer
NI
Message 39 of 61
(1,993 Views)

Here is a link to how to hook up a relay to the Arduino (http://www.arduino.cc/playground/uploads/Learning/relays.pdf), it is very straight forward so it should be no problem to figure out. Controlling the relay would be the same as controlling say an LED turning on and off. In LabVIEW the programming would just be a discrete output from the Arduino and you could use the same code as the one the controls the LED. Just wire it with the relay wiring and not the LED wiring. https://decibel.ni.com/content/docs/DOC-20044   Hope this helps.

-Kenny

Message 40 of 61
(1,993 Views)