Motor control by serial port

So now I decided to move to a little hardware 
I have been controlling the speed and direction of a DC motor by passing a combination of ASCII values and HEX values.For eg:- P20 will give me some speed P50 will give me another.M1/0 will rotate the motor in both the directions.S will give me counts which has been converted to the respective RPM.
So I have no issues here. But now I have to implement a PID controller with it.
That means Set Point will be decided by user(That is me) and Process Variable(PV) will I think be the feedback from the output of RPM.And, I think output of PID will be given as HEX to VISA.I don't know.Am I correct over here? 
How to implement the motor control with the PID block?
Can anyone guide me in the right direction?
Attachments:
Basic Serial Write and Read1.vi ‏23 KB

Hi Sunny,
the output of the PID is a number used to set an actuator. In your case you have to send that number to your motor control board, which expects strings (not any kind of HEX)! As you already gave examples of the expected strings you would use a FormatIntoString function to form the proper commands.
VISA also only uses strings as in-/output, you have to create them anyway!
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome

Similar Messages

  • Motion Control via Serial Port

    I have previously developed an automated video microscope application in Labview. It worked great. My setup was: NI PXI system with 1409 image board, 7344 motion controller, 7764 breakout box, stepper motors, motor drivers, and tables. Now, a customer is requiring that we use a specific brand of drivers that encompass a motion controller and are daisy-chained together. Communication will take place from a serial port, thereby bypassing the 7344. My question is: will I have to can my entire previous Labview motion/data acquisition program b/c I won't be using the 7344 controller? Or, will it be easy to specify in the program to commmunicate via the serial port rather than the card? Would this setup take place in MAX, or in the LabView applicatio
    n itself? Any nuances that I should know about? Any info would be appreciated. THANX-ROB

    Rob,
    in this case you won't be able to use any of your motion related code. The motion VIs in LabVIEW call the NI-Motion driver dll and thus they are not hardware independant. By the way, this is not a specific disadvantage of the NI-Motion driver. In fact there is not such a thing available like a standardized interface and hardware independant motion control language.
    In general you will have to use low level serial communication (VISA). That means you have to read the drive/controller manual, identify the serial command strings you need and send them to the device.
    For configuration the drive vendor should provide a utility to set the necessary parameters.
    On the other hand you could be lucky in the case that the vendor of the drive/controller provides h
    igh level LabVIEW vis. You should check with this vendor if a LabVIEW driver is available. Still you will have to rewrite your motion related part of the code.
    I'm sorry that there are no better news.
    Best regards,
    Jochen
    NI-Germany

  • Motor Control Through Serial

    Hello,
    I am working on a project which requires the operator to be able to control the motor's rpm and whether it is on and off from a labview interface.  The motor is a Kollmorgen servomotor(AKM42E-ANDNC-00) which is connected to a danaher S20360-VTS controller. The controller is connect to the computer through the serial port.
    My question is if there is any way to control this motor through the serial connection to the computer.  I attempted to communicate with is using strings but only received gibberish back. ( I don't really understand string communication).  The settings for the serial communication are correct (with the exception of flow control which I am unsure about).  Any help would be appreciated.  Serial info can be found starting on pg 57 of the controller manual.
    Thanks
    Solved!
    Go to Solution.
    Attachments:
    msm20001_rev_C.pdf ‏2222 KB
    akm_deis.pdf ‏1913 KB
    BasicReadWrite.JPG ‏126 KB

    John, thanksm for the response.  I keep getting the feed back in the attached image below.  I am in contact with Kollmorgen now and will update you when I get a response to my problem.
    Attachments:
    BasicReadWrite.JPG ‏126 KB

  • Low level control of serial port?

    Hi there,
    We're using LabVIEW 7.1 and I would like to control some low level aspects of the serial port (I'm having a LOT of difficulty connecting to an ABU93 autoburette). Is there a way to set the DTR, DTS RTS and CTS in LabVIEW 7.1? Is this controllable through VISA?
    Thanks for any help,
    Russ

    The serial lines cannot be adressed using the Configure serial port VI. You need to dig a little deeper, and access the modem property node.
    See the attached vi.
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Serial line settings.vi ‏35 KB

  • Can't find a PCI-serial port

    Hello:
    I am using a PCI-Serial card to control a serial-port stage, I can not find the serial port with Labview8.0. Windows can find this serial port. When I use the same Labview program in my old computer which has a serial port on board, it can be recognized. Shall I change something of the 'Visa serial' communication module?
    The attached file is a Labview programmed driver for a motor-stage.
    Thanks,
    Attachments:
    ZaberLabview8Demo.zip ‏77 KB

    If Windows can't find the serial port, then LabVIEW isn't going to find it, and it's irrelevant what you've coded. You should go into the Windows Device Manager to see what it tells you about the device. Does it even show up in the list of devices? Does it have a driver loaded? If it doesn't show up in Device Manager, try plugging the card into another PCI slot. Does the card show up if you plug it into another computer? Perhaps the card is bad.

  • Time out function in VISA configure serial port vi

    I have some doubts regarding the time out functionality of "VISA configure serial port vi":
    1) I have set the time out value as 10s while initializing the port using this vi. Does this mean that for any Rx operation happening on the serial port, it will wait for 10s for the data to be received?
    2) Is this waiting functionality also valid on "bytes at port" vi which I am using before reading the port data?
    Because in my application, the control at serial port is actually not waiting for 10s and is coming out before the desired time out (10s). Do I need to set this time out anywhere else apart from initialization at "VISA configure serial port vi"??
    Can anyone please tell the steps to set this timeout for the serial port?
    Thanks in advance!

    1. A read will return when the first of the following is satisfied:
       a. The number of bytes at byte count has been received.
       b. The termination character (if enabled) has been received.
       c. An error is detected.
       d. The timeout time has elapsed.
    I am not sure what happens if handshaking is enabled and the other device pauses communication.
    2. No. Bytes at port returns immediately. This is a status check and it would not make sense for a timeout to apply.
    Without seeing your code and the data the remote device is sending, we can only guess. My first guess would be that you have termination characters enabled (default) and a termination character appears in your data.
    Lynn

  • A31 Serial port only works on dock..?

    Hi All,
    I have an IBM A31(2652-P3M) and I'm trying to use it as a GPS terminal for 4x4 driving. Most new laptops don't have a serial port to hook into my gps so this one is good in that respect.
    But... the serial port on the laptop doesn't work. Only the serial port on the dock  (Type 74P6733) works. Unfortunate the laptop with the dock is too big to mount in the car.
    Is there any reason why the port on the back of the laptop itself doesn't work? Is there some software, hardware or bios switch that controls which serial port works?
    Thanks for your help,
    Ashley

    Hi freaky-namuh, welcome to the forum
    It could be that it is disabled in BIOS, config > serial port
    Andy  ______________________________________
    Please remember to come back and mark the post that you feel solved your question as the solution, it earns the member + points
    Did you find a post helpfull? You can thank the member by clicking on the star to the left awarding them Kudos Please add your type, model number and OS to your signature, it helps to help you. Forum Search Option T430 2347-G7U W8 x64, Yoga 10 HD+, Tablet 1838-2BG, T61p 6460-67G W7 x64, T43p 2668-G2G XP, T23 2647-9LG XP, plus a few more. FYI Unsolicited Personal Messages will be ignored.
      Deutsche Community     Comunidad en Español    English Community Русскоязычное Сообщество
    PepperonI blog 

  • Using serial port to communicate with servo motor drive

    I wish to use Labview 7.1 to control a brushless servo motor with encoder (from MCG) and digital drive (from AMC) via the serial port. The application simply involves progressively loading the shaft on the motor in 180 degree increments, and reading the torque. Is this possible? If so, how complicated is this approach? Thanks!

    Communicating with your AMC drive via LabVIEW is no problem. There is an example in the Example Finder (Help >> Find Examples . . ) called Basic Serial Write and Read.vi which will show how to send and receive serial commands. You will have to find out what serial commands your drive responds to by looking at the AMC drive user manual. Certainly there are commands to position your servo motor at various increments and at various speeds.
    As for reading torque, however, I would be surprised if the drive would directly output a torque value. One possibility might be to read the current being sent to the servo and then interpret that into a torque reading - provided that the drive has a serial command to read the current output (normally servo motors have a fairly linear current to torque conversion). Current to Torque conversions are motor specific and the accuracy using such a method might not be to good.
    A more accurate method would be to use a torque sensor (Transducer Techniques sells these along with many other sensor companies) - or to use a strain gauge. Both types of sensors would need to be read in with a DAQ board (see link for National Instruments DAQ boards).
    Hopefully this gives you some ideas - good luck with your project!

  • Serial port control -- what's this code snippet?

    Hi, all.
    I've just become active working with LabView, version 6.0i. And this because of a program which "suddenly" stopped working, with no changes made by anyone that I can see (yeah, likely story, right?).
    In short, the screenshot which I'll include with this post is of one tiny code snippet buried deeply in the .vi which runs an X-Z positioning system. I'd like to know what people thing this code snippet does. I have my suspicions, but I can't believe that whoever wrote this code actually used it for this purpose!
    The X- and Z-positioners which I'm using are controlled by separate power sources, and separate ports on the computer. The X-positioner is ultra-fine-resolution, and has an optical encoder. It's controlled by the RS-232 port on the computer, and it's meant to be moved only a little at a time. The Z-positioner is a bit more coarse, and usually moves quite a bit at a time. It's serial-port controlled.
    The screenshot is of the portion of the code called "XMove" -- that portion of the code which controls the x-positioning stepper motor. Often, the Z-positioner is still running during this part of the code (the "ZMove" subroutine is called before the "XMove"), and then, after both parts of the positioner have stopped, the code should shut down the power to them, and update the position of the translation stage.
    However, once the code gets to this portion (screenshot), that while loop just keeps running.
    Here's what I think is happening (please correct me if I'm wrong!): The Z-positioner is run by the serial port, which, as far as I know, can be controlled by only one device at a time. Thus, this While loop does the following:
    1) attempts to write the characters "1R" followed by a linefeed to port 0 (the applicable serial port on this computer);
    2) reads how many characters are stored in the serial buffer;
    3) reads all the characters in the serial buffer;
    4) takes the first two characters from the string read;
    5) compares these two characters to *R;
    6) if the two characters are R, then the loop terminates and the code finishes.
    As far as I can tell (I've probed many parts of this structure), the code fails when the "N" portion passes the number of characters in the serial buffer to the "R" portion -- it's always zero. It appears to me that the "W" portion writes to the buffer AFTER the number of characters is read (I wouldn't have suspected this unless I'd run it many times and monitored which steps were done in which order). This ain't right!
    I found a similar question answered in the KnowledgeBase forum, but the answer to that one was that the serial port may have an "echo" mode. That doesn't change the fact that data is being from to the port before it's written, does it?
    Is there a way to make sure that the "read" statement happens AFTER the "write" statement? Am I way off base with what this code snippet should do? And, most importantly, *** is this a good way to tell if the Z-positioner is done with its job? ***. Is this a standard trick to tell if a program is done with the serial port?
    Thanks, all. I know the quandary of trying to debug with so few details, and not having the program in front of you. Any help is appreciated!
    Sincerely,
    Curtis Osterhoudt
    Attachments:
    VI_diagram.jpg ‏17 KB

    I suspect someone did change it, but they just don't realize they did.
    THe code snippet is an example of some very bad LV code! What you suspect is happeneing is indeed true. LV uses a data dependacy paradigm that says code execution order is dependent on data availablility. Data availability is determined by ythe rule that the output of a node or sub-VI is not available until the object completes.
    In you snipet, the only node that has to complete before the read bytes at port and the write to port VI is the the constant port number constant. That means that LV can execute either the write or the check bytes at port VI's first. This is determined at LV compile time. If for some reason LV decideds to compile in the write before the check bytes at port, the
    n the I/O may work as intended, BUT NOT POROGRAMMED!
    For a quick fix, put the contant port number and the write VI in a single frame sequence structure. This way the read from the constant and wire operation must comlplete before the seq completes, therby forcing the read stuff to wait.
    I hope this help,
    Ben
    Ben Rayner
    Certified LabVIEW Developer
    www.DSAutomation.com
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Control a generator with a control volage by serial port RS232

    Hello everybody,
    I would like to control a generator thanks to a control voltage. This last one would be sent to a switch wich turns on the generator.
    To do that, I want to link the switch and the computer with a serial port RS232 by using NI-USN 232 cable.
    I made some research on this subject and I am only a beginner on LabView but I would like to use one (or several) pin which will send 5V in voltage when I want.
    Is that possible? Is there another way to make it?
    Thanks in advance.

    Thank you for your answer.
    Maybe, I didn't explain myself correctly. 
    For example, on the Raspberry Pi, you can control a card by sending 3,3V signal with RS232 port (I made it last year so it makes a sense).
    What I want to do here is to control an electronic card that turns on my generator after. I don't have enough to buy a generator controlled unless you know one not very expensive.

  • How to add control buttons using Java thorugh serial port?

    Hi everyone,
    I'm new to this forum.
    I have some questions on Java and serial port.
    I want to write a Java program to control my robot, through serial port. For example, when I click "Forward", the robot will go forward, and so on.
    Now I already have the buttons, so next I would like to ask how to interface the buttons with the serial port.
    I already have all the javax.comm things installed.
    below is the code for my buttons:
    import java.awt.*;
    public class ControlButtons extends java.applet.Applet
         GridLayout myLayout = new GridLayout(3, 3);
         Button button1 = new Button(" ");
         Button buttonForward = new Button("Forward");
         Button button2 = new Button(" ");
         Button buttonLeft = new Button("Left");
         Button buttonStop = new Button("Stop");
         Button buttonRight = new Button("Right");
         Button button3 = new Button(" ");
         Button buttonReverse = new Button("Reverse");
         Button button4 = new Button(" ");
         public void init()
              setLayout(myLayout);
              add(button1);
              button1.setVisible(false);
              add(buttonForward);
              add(button2);
              button2.setVisible(false);
              add(buttonLeft);
              add(buttonStop);
              add(buttonRight);
              add(button3);
              button3.setVisible(false);
              add(buttonReverse);
              add(button4);
              button4.setVisible(false);
    }Now I would like to ask for direction on how to add in the code to make it work with serial port.
    Thanks

    The plan is, I have a robot device connected to the serial port.We don't know anything about that device. We don't know how to control it. We don't know what you have to write to the device to make it do anything. Only you know what.
    For example, when I click "Forward", the robot will go forward, and so on.So what do you have to send to make it do that? and same for the other buttons.
    Next, you need to work out from the javax.comm API how to open the serial port and send data to it. This is a standard exercise in learning a new API. You must be able to do this. Again and again.
    But the program is useless. The button can be clicked, but didn't do anything.Because (a) they have no ActionListeners and (b) there is no code to send anything to the serial port.
    You have to write all that. So you also have to look up ActionListener in the Java API and how to attach it to a button. You can do that. We all do that kind of thing every day.
    So next I would like to ask how to interface the buttons with the serial port.You've been asking nothing else since you started, but you've also only done enough investigation of your own to create the buttons. That's only the start.
    The problem is what method and command should I use to make those buttons actually functioning.See above. You've been told part of it several times. The rest only you can answer, because it's your robot.

  • Serial port control

    hello
    is it possible to control, using labview, the inputs and the outputs of a serial port as they were simple digital on/off channel?
    for example in order to use them to turn on/off a relay or to read the state of a switch
    I've searched among the labview examples but they show only complex communication to an hardware using strings...
    thankyou in advance
    paolo
    Solved!
    Go to Solution.

    You can control the handshaking lines Request to Send (RTS) and DTE Ready (DTR).  You can read the handshaking lines DCE Ready (DSR) and Clear to Send (CTS) as digital inputs.
    They are accessed through property nodes of the VISA reference under Serial Settings / Modem Line settings.
    Be careful of any loads you apply to them or signals you enter in terms of voltage and current so you don't fry your computer.
    Message Edited by Ravens Fan on 09-10-2009 04:27 PM
    Attachments:
    Example_VI_BD.png ‏2 KB

  • How can I control a HP 33120A waveform generator with the serial port of my PC?

    Hello,
    I want to control a HP 33120A waveform generator with my PC using the serial port. I don't have any idea about how to do it. If you've done it or if you know how I can do it, please give me some indications.
    Thanks
    Jean-Baptiste Paillet
    PS: I don`t have G PIB port

    The answer to your cross-post in the LabVIEW General group seems to be right on the money:
    http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=50650000000800000032200000&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0
    Regards,
    John Lum
    National Instruments

  • Control Camera Attibutes through serial port using VISA commands

    Hi there,
    I'm using a Basler acA2000-340kc camera through an PCIe-1473R FPGA as frame grabber.
    I would like to be able to configure the camera through the serial port just in LabView, not using a third-party as Pylon (which I can do now).
    According to this forum post 
    http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/My-Basler-acA2040-180km-NIR-is-not-visible-in...
    this is possible just taking the VI posted here
    https://decibel.ni.com/content/docs/DOC-5049
    and converting from IMAQ to VISA, as RIO frame grabbers cannot use IMAQ. I have been trying to do this by changing the IMAQ vi to their VISA equivalents, but I have no good results.
    Does anyone know which are the steps to go from that piece of code to one that can be used to control the camera in my case?
    Thanks a lot,

    Hi i.popa,
    Basler makes the Basler Binary Protocol Library for serial communication with their cameras. If you make sure you're running the serial server section of your FPGA code to keep the serial port open, you should be able to use calls from this library to communicate with your camera. We have a community example with more information on using the Call Library Function Node to call a DLL. This DLL will take care of all the processes needed to write from and read to the registry, so this implementation will probably be similar to the example program you listed above, using calls to this library instead of the IMAQ Serial functions.
    Good luck with your application!
    Emily C
    Applications Engineer
    National Instruments

  • How to control an Xserve G4 with the serial port

    I have an Xserve G4 first generation, and was wondering exactly how you would go about connecting to it via serial port incase I need to change something when there is a network issue. I have looked around the internet without much success. It has Leopard Server on it, so Apple says the baud rate is 56700, and 8bit, no parity. So that's all set in the client machine, which is a MacBook Pro with a USB to Serial adapter on it, which shows up in Zterm. Once I'm in Zterm, it just sits there, and pressing enter doesn't prompt a log in. Does anyone see what else I'm most likely missing?
    Thanks

    Thanks for the reply Cemelot. Yes, I did create a profile in ZTerm. This is what I have it set to.
    I also read that you're supposed to run the command "/usr/libexec/getty serial.57600 /dev/tty.serial" on the Xserve itself.  It made no difference if I did that or not. I also checked to make sure tty.serial was inside /dev/. Anything else I'm missing? Thanks again.

Maybe you are looking for

  • Rule Generation fails

    Hello! We have an issue. After installation few month ago we uploaded standard files (according to postinstall steps) and now we are trying to load modified action/permission files. We have a problem with Rule Generation programm. During rule generat

  • Hard Disk 1 Quick (303)

    There are many cases of this HDD failure, but mine a little different and I can't find any information on it. The computer was working fine and I wanted to reformat. (I reformat with USB not DVD) Upon booting from USB, it started and I chose language

  • I can't buy anything on my phone because i forgot the answers to my security questions how do you get them

    i need to get th answers to my security questions

  • FA clearing account?

    Dear all, I have a request from user and she wants to have a report which shows the fixed asset clearing account. Since I am not familiar with fixed asset, does anyone know which tables can retreive this information or any similiar sql statment that

  • Can't read disk label

    Dear Sun experts, I am trying to install Solaris 9 on a Sun Ultra 10 Sparc workstation. This system formerly had Solaris 8 on it, but we decided to do a reinstallation to configure things the way we wanted them.Before doing that we encountered a few