Jump to content

ned

Members
  • Posts

    571
  • Joined

  • Last visited

  • Days Won

    14

Posts posted by ned

  1. 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.

  2. QUOTE (Ravi0709 @ May 20 2008, 04:14 AM)

    I have created CAN interfaces in MAX explorer using vector dbc file successfully and transfered to RT Target (a Desktop PC converted into RT). When I supplied raw data for each message, these interfaces generate CAN message and directly sending over physical CAN port. I wish to use this generated message internally in code further, instead of sending over physical port. We have a custom checksum generation code (in C). I wish to pass this generated CAN message to checksum code to generate checksum byte. In latter stage, I'll send CAN message and checksum byte together over physical port. My problem is, I'm unable to use the generated CAN message in LabVIEW code further. I need help to access this CAN message. How can I generate CAN message (from raw data) for internal purposes ??

    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.

  3. QUOTE (Giseli Ramos @ May 19 2008, 07:32 AM)

    I have a VI that monitors a TCP connection using the function "Not a Number/Path/Refnum". When the peer (the other side which this VI is connected is a win program in Visual Basic) closes the connection, my VI seems unable to detect the closed connection, it is "thinking" that

    the TCP refnum is still valid.

    How I can handle it?

    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).

  4. 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.

  5. QUOTE (panithan @ Apr 26 2008, 09:32 PM)

    Thank you for all the advice.

    My question now is how do you control the speed of the loop iterations? My code right now will outputs a pulse every other iteration. However, I can't seem to increase the speed to what I need. I know I can use the "wait till next millisecond multiples" function to slow down the speed, however, I can't seem to increase it to beyone 1kHz.

    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.

  6. QUOTE (george seifert @ Apr 4 2008, 10:09 AM)

    Nice to know it's mostly guess work when it comes to ENUMs. I tried guessing Int32 and it worked. Thanks.

    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.

  7. QUOTE (B Chavez @ Mar 20 2008, 12:46 PM)

    And with regard to the second question, adding a 'timeout' event allows the loop to run again and sets the KeyFocus as expected.

    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).

  8. QUOTE (alexadmin @ Mar 18 2008, 07:52 AM)

    Ohh... There are a lot of new words about LabView for me ;-) I try to analyze them and read respective help. Also I have attached my example model. The buttons I said is LED1..LED8; String3 and String4 are calculated value outside and inside of Event structure.

    Thank you.

    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.

  9. QUOTE (Thang Nguyen @ Mar 14 2008, 11:37 AM)

    Hi,

    I want to ask a question.

    Is it true that the program will wait for 1 sec to get data for the first time reading the number of samples set by the rate? So in this case the whole system will be late by 1 sec. Is it true?

    Thank you

    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.

  10. QUOTE (egraham @ Mar 14 2008, 08:53 AM)

    Yes, it would appear that way, but look at the attached picture from the LV example VI. It is wired in exactly the same way and it works very well like this. So there is something else I'm not seeing.

    It wouldn't be the first time...

    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.

  11. QUOTE (mross @ Mar 10 2008, 04:42 PM)

    Controls are data sources and indicators are data sinks. YOU DO NOT WANT TO MIX THEM UP.

    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?

  12. QUOTE (Götz Becker @ Mar 11 2008, 05:34 AM)

    Hi,

    I am currently using variants in a RT app without problems (basically always a typedef cluster with a Cmd-Enum and a Variant for the data).

    For a new 24/7 RT app I am wondering if I could run into problems using variants. Do you generally stay away from Variants in mid-size to large 24/7 RT apps?

    Does anyone has bad experience with <vilib>/Utility/VariantDataType/GetTypeInfo.vi in RT?

    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).

  13. QUOTE(daro @ Feb 25 2008, 02:13 PM)

    Hi,

    I´m trying to call the function GetUnitInfo from a Dll in Labview 8.2. The problem is that when I try to configure the Call Library function, I can not see this function, and Its suppose that this Dll only contains 2 functions (GetUnitInfo and SaveResults).

    Instead of the 2 functions mentioned, I see the following:

    DllCanUnloadNow

    DllGetClassObject

    DllRgistrServer

    DllUnregisterServer

    I don´t have access to the Dll code, so any ideas what could be wrong??

    Thank you in advance.

    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.

  14. QUOTE(Zalon @ Feb 25 2008, 08:46 AM)

    Ok, good.

    Another thing is that when using the local variable together with the array indicator, the array is kept in memory, and when i run the function again the old values will still be in the array the function returns.

    How should i empty it? Should i do it when calling the function? Set the array to an empty constant in a sequence inside the function? Or some other way?

    Hope it makes sense

    Edit:

    I replaced the local variable with an empty control instead, that does what i wanted it to do, but is that the correct way to do it?

    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."

  15. QUOTE(gammalight @ Feb 5 2008, 11:54 AM)

    Hello,

    I hope my question is quick and painless to answer. I will add that I am new to using cRIO devices and FPGA programming. I have cRIO-9004 device that I am configuring in MAX. The 9004 is connected to the host computer via USB ethernet adapter and crossover cable. The IP address is 169.254.92.15 and the subnet mask ID is 255.255.0.0. When I start MAX the device shows up under "Remote Systems" with an IP adress of 0.0.0.0, which is a good thing. I then try to set my network settings, with an IP address of 169.254.0.2, which times out when I ping which means nothing is using this address already, and the same subnet mask ID, 255.255.0.0. I then type a name in the name field under the identification section. But when I hit the apply button I get a message that says:

    "The subnet mask you entered places the target and the gateway in two different subnets, which may make this partially unconfigurable."

    I can click okay, and it appears to let me proceed, but this doesn't seem right. Can anyone help me out, am I doing something wrong here?

    There is also a VISA error under the "Device and Interfaces" section.

    I am simply just fiddiling with the device, this is not for a project for school or a project for work, just for curiosity sake.

    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.

  16. 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.

  17. QUOTE(task @ Feb 1 2008, 03:45 PM)

    My problem is getting the modbus stuff to work. All the IP addresses and subnet masks are set up correctly. Under my PXI system I set up a ModbusSlave I/O server. It took awhile but I figured out how to set up the shared variables. I tried several different methods but it still doesn't work.

    Example: Variable 00001, bind to source ModbusSlave0001, boolean, network published. Is this the direction I should be going or am I off base?

    I get a deployment error: Cycle detected (addresses of the boolean).

    I just need a nudge in the right direction!

    Thanks for any help.

    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.

  18. QUOTE(BrokenArrow @ Jan 7 2008, 07:49 PM)

    If you had this VI running, say 50 times a second, would you use the "zero" timer or not?

    It depends - what else is happening at the time? I remember seeing somewhere that a zero wait allows LabVIEW to yield processor time to other tasks (including other parts of your LabVIEW program), whereas a loop without a wait just runs as fast as possible, consuming all available CPU time. So if you have other tasks executing in parallel then the zero wait is probably a good idea; if you just need that VI to complete as fast as possible, leave it out.

  19. QUOTE(BrokenArrow @ Jan 7 2008, 01:42 PM)

    While experimenting with methods to update an array, I intended to check the speed difference when initializing outside the loop vs. inside. While it wasn't surprising that that made no difference, I was surprised at the difference the "zero" timer makes.

    Is there a faster way to do this? Oddly, I found using Build Array in the loop (a LabVIEW no-no, I thought) is just as fast as this method, and a little cleaner looking.

    Check this VI if you get a chance. My results are written on the BD.

    Thanks,

    Richard

    Looks like my computer is faster than yours :P - I get 595ms without the "zero" timer and 795ms with the timer.

    Build Array should be acceptable in this case because the array is the same size on every iteration, so the memory for it only needs to be allocated once and then it can be reused each time through the loop. You should avoid using Build Array in a loop when you are adding elements to the array on each loop iteration and speed is critical, because adding new elements grows the array. Resizing the array may force LabVIEW to allocate a new, larger segment of memory and then copy all values into that space, which is a time-consuming operation.

×
×
  • Create New...

Important Information

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