Jump to content

ned

Members
  • Posts

    571
  • Joined

  • Last visited

  • Days Won

    14

Everything posted by ned

  1. QUOTE (Siconi @ Jun 10 2008, 05:54 AM) MAX is only for configuring National Instruments hardware. I'm not familiar with the ADAM-4000 series, but I use the ADAM-5000 series here and communicate with them using the DLLs provided by Advantech. I expect that similar libraries are provided for the 4000 series; there may also be ActiveX or .NET controls you can use if you prefer. You may find the DLL Import utility in LabVIEW, under Tools -> Import -> Shared Library (.dll)... to be helpful. (EDIT: I think this tool is only available in later versions of LabVIEW; in 7.1 you may need to configure the Call Library nodes yourself, following the ADAM documentation and function prototypes.) Alternatively, you can read the ADAM documentation to learn the syntax of the serial commands, and then send them yourself using the Serial Read/Serial Write VIs.
  2. The way I've always done this, and I believe it's the standard approach, is to put controls on the front panel along with matching indicators. Wire the indicators to the connector pane, then hide them. On the block diagram, wait until the user presses the button (using a loop or an event structure), then pass the values from the controls to their corresponding indicators. Make sure that the copy from the control to the indicator happens only after the button is pressed. If you use an event structure, be warned that sometimes events may not fire in exactly the order you expect. In particular, say you allow the "Enter" key to toggle your button. If you enter a value into a numeric control, then hit Enter, the boolean event will fire before the value of the control is officially changed. So, if you copy the value of the numeric control into an indicator in the boolean event case, you'll get the previous value of the numeric. Don't worry if this doesn't make sense to you - if you do use an event structure and your numeric values are inexplicably wrong, look back on this post and it will probably make more sense. On a side note, does anyone else ever use an event structure outside a loop when you just want a VI to wait until a single event (Window close, button click, etc.) occurs before terminating the VI?
  3. QUOTE (Ravi0709 @ May 21 2008, 06:38 AM) I just noticed this library on NI's site, which might help you: the http://joule.ni.com/nidu/cds/view/p/id/884/lang/en' target="_blank">Frame Channel Conversion Library. I don't fully understand what you're trying to do, but if that NI library doesn't help you, here's what I'd suggest: Write all your CAN messages, through the Channel API, to virtual interface 256. In a separate loop, wait for messages to arrive on virtual interface 257; read them using the Frame API to get the raw data. Whenever a frame arrives, calculate the checksum (if necessary) and resend it through the physical interface.
  4. QUOTE (Ravi0709 @ May 20 2008, 04:14 AM) NI-CAN provides two "virtual interfaces," numbered 256 and 257. Those two interfaces are directly connected to each other; anything sent over one is received on the other. So, you can send your initial packet over one virtual interface, read it back in over the other virtual interface and generate your checksum, then resend it over the physical port. Take a look at the NI examples, and the section on "Frame to Channel Conversion" in the NI-CAN manual.
  5. QUOTE (Giseli Ramos @ May 19 2008, 07:32 AM) You cannot use that function that way. Instead you need to check the error output from TCP Read or TCP Write. You will probably need to filter the errors, because some errors do not indicate a dropped connection (for example, TCP Read may return a timeout error because no data available, but the connection is still valid).
  6. QUOTE (BrianJensen @ May 8 2008, 01:49 AM) Have you looked at Copley Motion? They make several stepper motor controls with a CAN interface; you could control it using a CAN card and the FPGA in an NI cRIO. I'm not sure if this would fall in your definition of "cost efficient" since a cRIO isn't inexpensive, and writing code for the CANOpen protocol may be time consuming. Copley does provides libraries and LabVIEW examples but they rely on ActiveX and won't run on a cRIO. Another option, if you're willing to bypass LabVIEW entirely, would be a unit like the Parker Motion Gemini GT6K. It's an independent controller that can be programmed in a simple text-based language, and it includes a couple of channels of I/O.
  7. QUOTE (panithan @ Apr 26 2008, 09:32 PM) You are relying on Windows to maintain your timing, and LabVIEW on Windows cannot reliably run loops faster than 1kHz. Also, you may be running into the limits of your I/O board - what is its maximum sample rate? To do this properly you really want to use a counter/timer board, not a digital output board.
  8. QUOTE (george seifert @ Apr 4 2008, 10:09 AM) It shouldn't need to be guesswork; VisualBasic provides a way to explicitly specify the representation, using the "Public Enum [Name] as [Type]" syntax. Since the VisualBasic enum definition you provided doesn't specify a type, it's safe to assume it's an I32.
  9. According to this MSDN page, "If no underlying type is explicitly declared, Int32 (Integer in Visual Basic) is used implicitly."
  10. QUOTE (B Chavez @ Mar 20 2008, 12:46 PM) I rather like the timeout approach, with a twist - I keep the timeout value in a shift register that's normally set to -1. When an event causes the loop to exit I set the timeout shift register to 0, put my front panel terminals in the timeout case (unless they're used elsewhere, in which case they go outside the event structure), and let the timeout case stop the while loop. This allows all values to update and any pending events to trigger (and if one of those events needs to cancel the exit, it just resets timeout back to -1).
  11. QUOTE (alexadmin @ Mar 18 2008, 07:52 AM) JFM is right - your problem is that you are reading the value of your boolean terminals outside the event structure. As a result, the computation occurs in parallel with your event structure; it doesn't wait for an event to fire. If you turn on "execution highlighting" (the lightbulb icon) and run your VI, you'll see what is happening more clearly. To fix this, put all the computation inside the event structure.
  12. QUOTE (Thang Nguyen @ Mar 14 2008, 11:37 AM) The program will wait for as long as you've specified in the "Timeout" input to DAQmx Read, according to the help file. In your case if your sampling speed is 200 samples/second and you want 200 samples, then you will have a 1 second wait (but if for some reason the acquisition is delayed you could be waiting up to 10seconds since that's what you're using as a timeout value). You could set the timeout to 0 and then you might not read all 200 samples on the first try but you won't be late.
  13. QUOTE (egraham @ Mar 14 2008, 08:53 AM) Perhaps this is just a timing issue; are you running your loop much faster than the NI example? The NI example should exhibit the same behavior that you're seeing, but if the amount of time spent doing the PID calculation is a tiny fraction of the overall loop time, you won't notice the effect.
  14. QUOTE (yen @ Oct 11 2007, 02:43 PM) I'm not sure if this is the same issue or a new one, but "View New Posts" isn't working quite right for me, I'm seeing all posts since a few days ago as new even though I've logged in and read posts several times since then.
  15. QUOTE (mross @ Mar 10 2008, 04:42 PM) I might be about to hijack this thread, but I'm curious about opinions on this. At a previous job, I built a large application that needed some controls to act as indicators under certain circumstances. For example, there is an indicator for temperature, a control for temperature setpoint, a control for air flow rate, and a boolean to turn on a PID loop. When the PID loop runs the air flow rate control is disabled and acts as an indicator so that the user can see that the PID loop is functioning. I built a complex system based on references and checking for changes to the air flow value by both the user and by the control loop - each only updated the other when a change occurred. How do the rest of you handle this sort of situation?
  16. QUOTE (Götz Becker @ Mar 11 2008, 05:34 AM) I've used variants for passing data through queues in mid-size RT applications that run 24/7 without problems. I also flatten the variants to strings for TCP/IP communication and make use of attributes - for example, I have an RT server that can have multiple TCP/IP clients, and when a command for the server arrives the TCP refnum is added to the variant as an attribute so that when the server replies it knows where to send the response. I've also used the VariantDataType VIs successfully; in my case I use them to get the label of every item in a cluster (including subclusters).
  17. QUOTE(daro @ Feb 25 2008, 02:13 PM) It appears that you're trying to directly call a DLL that contains an Automation, OLE, or ActiveX component (no idea what the difference is between these, they may all be names for the same Microsoft technology). Take a look at the ActiveX palette. Drop "Automation Open" on your block diagram, create a constant for the Automation Refnum input, right click on the constant and choose Select ActiveX Class -> Browse, then in the dialog box that appears, browse to your DLL. See if you can then use the ActiveX invoke and property nodes to access your functions.
  18. QUOTE(Zalon @ Feb 25 2008, 08:46 AM) This is almost the correct way to do it, but you should probably replace the empty control with a block diagram constant. Right click on the control and choose "change to constant."
  19. ned

    Mouse Jiggler

    QUOTE(crelf @ Feb 22 2008, 12:48 PM) Hmm, I was expecting a link to this unusual device use when I saw the subject line.
  20. Yes. Take a look at the "Scan from String" primitive in the String pallette, and read the help for Format Specifiers, specifically %T which is used to format time.
  21. QUOTE(gammalight @ Feb 5 2008, 11:54 AM) The answer is in your error message - did you set an IP address for the RIO's gateway? Your IP addresses and subnet mask settings should be fine for communication between your PC and the RIO; that error message is telling you that you will be unable to reach the RIO from outside of your local network because the IP address of the gateway is somewhere else entirely. You can probably set the RIO's gateway to the IP address of your computer if it bothers you.
  22. Any chance you can just close LabVIEW, do the replacement on disk (ie, rename the old one, move the new one to the location of the old one), and then reopen your VIs? Once you've done that you can open the new typedef and rename it to save it back to its original location. EDIT: I misunderstood Ben's comment when I first read it, and after rereading I note that my suggestion simply duplicates his.
  23. As a side note, you could make your code more efficient by removing the boolean "not" and the case structure, and connecting the output of ">=0" directly to the "Visible" property node, unless there's something hidden in the True case of the case structure.
  24. ned

    Modbus in RT

    QUOTE(task @ Feb 1 2008, 03:45 PM) This sounds right to me, but maybe your Modbus addresses are off. You'll have to look at the Modbus spec, but some addresses are for booleans and some are for numbers, and of those, half are for values the master can write and half are for values the slave can write. Are you assigning an address to your shared variable that only the master can write, and then trying to write to it on the slave? I don't know what else that error might mean.
  25. Does the user need to see the Excel sheet while your program is running? Excel has a "Visible" property you can set to false to hide it while you're doing your processing, then set it to true to show the Excel window once you've finished.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.