LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make all Arduino Mega 2560 I/O pins available on LabVIEW?

Solved!
Go to solution

     I've looked up at many discussions here at the LabVIEW for Arduino forum about this issue with the Arduino mega pins, but I haven't been able to solve it. I'm working on a project that has many sensors, to read them I'm using multiplexers and, for convenience, I would use the bottom digital pins of the board to not create a mess in the circuit. Is there any way I can make all the pins from Arduino mega available? I want to use the whole board (Analog in A0-A15; Digital I/O D0-D53).

I appreciate your patience.

0 Kudos
Message 1 of 8
(8,824 Views)

All pins are already available.  Is there a particular error that you are getting?

0 Kudos
Message 2 of 8
(6,992 Views)

Is not an error, is just that when I want to choose an specific pin that goes out of the range in the Arduino UNO I can't. Let me give you an example, the way my circuit is assembled it would be ideal for me to use the digital pin number 22 in the board, but when I create a digital pin on LabVIEW I can choose only between 0-13 no more than that, even if I choose the Arduino Mega as a board. Is this normal? Should I just make a constant in the pin and say it is the output 22?

0 Kudos
Message 3 of 8
(6,992 Views)

When you set the board type to the Mega, it will allow you to use pins 2 through 54 (digital) and pins 0 through 15 (analog).  If you are unable to figure it out, attach your VI to your post and I will take a look at it.

0 Kudos
Message 4 of 8
(6,992 Views)

The VI is attached, Nathan. Thanks a lot. I really appreciate your help.

0 Kudos
Message 5 of 8
(6,992 Views)
Solution
Accepted by topic author mtiaum

There are several issues with your code:

  • ALL Ardunio VIs must be in-line (executed sequencially; i.e. no branching) if you are not implementing semaphores to prevent the race condition.
  • Before using any digital pins, you should set the pin mode.  In fact, if you want to use them as outputs you MUST set the pin mode to output since they will all default to inputs.
  • The digital writes are currently only executed once and any changes you make to the "Value" inputs will not change anything on the Arduino.

What multiplexers are you using?

EDIT:  I just realized that the default type defs for the pin numbers is only for the Uno.  I never knew this because I've never used those type defs before.  You can simply input a U8 for the pin number.  I always hardcode these as constants (U8s) on the block diagram.  (This is the answer to the title question)

0 Kudos
Message 6 of 8
(6,992 Views)

Thanks a lot, Nathan. I just started using the LabVIEW, that's why I've missed so many things in the code. I'm using a MPC506 of 16 channels from Texas Instruments. I appreciate your help.

0 Kudos
Message 7 of 8
(6,992 Views)

I know this is 2013. I don't care, this is not a solution. This is still unsolved tons of people everywhere asking this same question. If you have LINX and a mega you how the hell can you use the 15 analog pins like you can with digital. Why can't you just wire pin 54 to the digitalWrite peripheral? Did the makers of LINX never pick up an Arduino in their life?

0 Kudos
Message 8 of 8
(4,679 Views)