DC Motor Controlling with ANSI C & DAQ Card

Hello,
I have 2 DC motors and a sensor. I have a NI Daq Card and i have a NI Connector board. I am trying to control DC motor with based on sensor values. Based on the conditions motors should move forward or backward. I am also using motor driver, i already connected my DAQ Card to computer and Connector block and i connected my motors to motor driver and my motor driver to connector block. And i also connected my sensor to connector board.
I gave you a HIGH LOW example which is ritten in PIC BASIC. What i am trying to learn is how i will write in ANSI C and use with DAQ card. And with which function i can read the value of the sensor? Normally if i read port in PIC Basic i will easily read the value.
I checked the DAQ CARD ANSI - C Examples but they aren't too clear. So this i just wanna ask someone who know this.
And to show what i exactly mean, here are some code written in PIC BASIC
INPUT PORTB.0                          ; Light Sensor
OUTPUT PORTB.3                     ; Left Motor Forward
OUTPUT PORTB.4                     ; Left Motor Backward
OUTPUT PORTB.5                     ; Right Motor Forward
OUTPUT PORTB.6                     ; Right Motor Backward
; to make code easy to read we are defining symbols for our ports:
SYMBOL             LSENSOR                 PORTB.0
SYMBOL             LMOTORF                 PORTB.3
SYMBOL             LMOTORB                 PORTB.4
SYMBOL             RMOTORF                 PORTB.5
SYMBOL             RMOTORB                 PORTB.6
Our functions:
TURN_RIGHT_FORWARD:
HIGH   RMOTORF
LOW   RMOTORB
LOW   LMOTORB
LOW   LMOTORF
TURN_LEFT_FORWARD:
HIGH   LMOTORF
LOW   RMOTORB
LOW   LMOTORB
LOW   RMOTORF
GO_STRAIGHT_FORWARD:
HIGH   LMOTORF
HIGH   RMOTORF
LOW   LMOTORB
LOW   RMOTORB
GO_STRAIGHT_BACKWARD:
HIGH   LMOTORB
HIGH   RMOTORB
LOW   LMOTORF
LOW   RMOTORF

Hey there,
I noticed that you have posted here (http://forums.ni.com/ni/board/message?board.id=250&message.id=31497) and got some answers
Might be worth sticking to that forum.
AdamB
Applications Engineering Team Leader | National Instruments | UK & Ireland

Similar Messages

  • I am searching a VI for AC acquisition with a PCMCIA DAQ card 6024E

    Hi,
    I am searching a VI for Alternativ Current acquisition with a PCMCIA DAQ card 6024E.
    I have tried several availble examples but they are unfortunately not compatible with this card.
    I am a beginner with Labview, as a consequence any help and support on that topic would be really appreciated.
    Thanks,
    Alban Cotard.

    I think you wann measure Alternating Current?!?
    what want you know, the period, amplitude, rms.....?
    e.g. use the "cycle average and rms.vi"  or  other  VI in this palett
    regards timo

  • Data-acquisition with NI 6036E DAQ card & GPIB using an external trigger

    Hi all,
    I hope somebody could give me some help with the following and answer some questions:
    Simple system description:
    Labview 6.1
    PCI-GPIB card
    6036E DAQ card
    In my system, I am using an external analog trigger signal (A) for continuous data-acquisition. Characteristics of the analog trigger signal (A) are: ~40 Hz, signal height +1.48V, triggered by rising edge (the analog trigger signal (A) could be changed to a TTL signal). Each data-acquisition is done within ~1.0 ms after the rising edge of the trigger pulse. The timing of the data-acquisition and analyzing procedure is controlled by execution in a sequence structure placed in a loop.
    Now, I connected a power meter to the system, to measure the laser power during the data-acquisition. The power meter has two options to provide the laser power data:
    a) via analog signal output (voltage corresponds to laser power in watts)
    b) via GPIB (direct output reading of laser power in watts).
    Problem:
    During a certain point in my data-acquisition sequence structure (defined by a frame), I want to use the next occuring analog trigger signal (A) to acquire 1 value from the power meter.
    How do I do this in Labview programming for the following two situations?
    a) If I connect the analog output from the power meter to an analog input channel of the 6036E DAQ card. The analog trigger (A) would be connected to a second analog input channel (In case the analog trigger signal (A) is changed to a TTL signal it would be connected to the PFI0/Trig input pin on the DAQ card).
    b) If I use the GPIB connection of the power meter. The analog trigger (A) would be connected to a second analog input channel (In case the analog trigger signal (A) is changed to a TTL signal it would be connected to the PFI0/Trig input pin on the DAQ card).
    An other possibility would be to trigger the power meter directly, so it outputs constantly power meter values at ~40 Hz. How could I than acquire 1 power meter value (at a certain time im my sequence structure) via analog input at DAQ card or GPIB?
    Additional questions:
    How do I configure the PFI0/Trig pin on the 6036E DAQ board individually as an INPUT?
    How do I use an analog trigger signal (A) as counting signal for a loop, or as an activation signal for a sequence structure which includes GPIB commands?
    It would be very nice if somebody could give me some help.
    Kind regards,
    beam

    Hi beam,
    I just want to verify that I understand your situation correctly:
    An external trigger signal (A) is wired to one of your input channels (e.g. CH0) to trigger data acquisition of a second channel (e.g. CH1). Your power meter is connected to an analog input channel, which you would like to trigger with a certain rising edge at some of your sequence structure.
    Problem:
    During a certain point in my data-acquisition sequence structure (defined by a frame), I want to use the next occuring analog trigger signal (A) to acquire 1 value from the power meter.
    How do I do this in Labview programming for the following two situations?
    a) If I connect the analog output from the power meter to an analog input channel of the 6036E DAQ card. The analog trigger (A) would be connected to a second analog input channel (In case the analog trigger signal (A) is changed to a TTL signal it would be connected to the PFI0/Trig input pin on the DAQ card).
    If a task has been configured to acquire signal from one analog channel, it's not possible to run a second analog input task or to add a second channel on the fly. You had mentioned that it's possible to read from the instrument through GPIB. Is it possible to perform a software trigger such that at a certain frame of your structure, when the trigger signal A reaches voltage "x", a GPIB command is written to your power meter to query a measurement reading?
    Additional questions:
    How do I configure the PFI0/Trig pin on the 6036E DAQ board individually as an INPUT?
    You do not need to explicitly configure the PFI0 line as an input. If you want to use it as an input such that it acts as an analog trigger, simply wire the trigger signal to this pin. When configuring the trigger in your software, specify PFI0 as the trigger source.
    How do I use an analog trigger signal (A) as counting signal for a loop, or as an activation signal for a sequence structure which includes GPIB commands?
    You can try using the Limit VI to find out when the trigger signal reaches a certain level, and count how many times this level is reached. Similarly, you can use this as the condition to execute GPIB commands.
    Hope this helps,
    Lesley

  • Motor control with 6024e

    I would like to set up a lab to control 1 to 4 axes using the 6024E card.
    Is it possible? I could do my own signal conditioning and amplification.
    I intend to try to use both stepper motors with some closed loop and brushless motors also with closed loop.
    Has anyone got some example solutions for this including what type of motors were used + labview VIs.
    Thanks
    Olivier

    I'm not sure if that would be possible/ or at least worthwhile, using one e series card. Have you considered using a motion control card? This will make the hardware and software implementation so much easier, and could be a cheaper solution in the long run:
    http://www.ni.com/motion/

  • Advanced, Connected, Industrial Motor Control with Zynq-Take 2: The Avnet Intelligent Drives Kit II

    Avnet has just announced a revised Intelligent Drives Kit II for advanced, connected motor control based on the Xilinx Zynq Z-7020 SoC. The kit includes:
    An Avnet ZedBoard Z7020
    Xilinx Vivado Design Edition voucher
    Analog Devices AD-FMCMOTCON2-EBZ Module
    Brushless DC motor: 24V, 4000 RPM, with Hall sensors and a 1250 counts/rev indexed encoder
    8Gbyte SD card programmed with application
    Ethernet cable
    HDMI cable
    Micro USB cable
    12V ZedBoard power supply
    24V AD-FMCMOTCON2-EBZ power supply
    Linux drivers, application software, HDL source, reference designs, full schematics, and Gerber files
    MathWorks Motor Control Design Package (optional, North America only)
    Dynamometer dynamically adjustable load system (optional)
    Avnet Intelligent Drives Kit II
     

    Just to clarify one of the bullets, the MathWorks Motor Control Design Package is available from Avnet in North America, but the component products are available worldwide from MathWorks directly. Visit mathworks.com/zidk for a list of required products, getting started information, and links to tutorial webinars, or contact [email protected] for more information.
     

  • Frequency counter with E-Series DAQ Card

    I am trying to measure the frequency of a signal at 0.1 sec increments using a DAQCard-6062E and an AT-MIO-16E-10. I am using a VI from the examples (frequency counter.vi, in a while loop) which works well with the DAQCard, but it's giving wrong measurements with the AT-MIO card. Why is that?

    Hello Waw,
    Take a look at this KnowledgeBase to see if it fixes the problem.
    http://digital.ni.com/public.nsf/websearch/862567530005F09E8625681C0074935E?OpenDocument
    If not, what version of NI-DAQ do you have? Are you getting incorrect measurements with different ranges of frequencies? Is LabVIEW giving you any errors? Do any examples provide correct results with the AT-MIO-16E-10? Please let me know if you have any questions. Have a great day!
    Marni S.
    National Instruments

  • Mac G4 crashes using continuous generation with PCI-1200 DAQ card

    I've been trying to use a PCI-1200 DAQ card with a Mac G4 to create a continuous analog output signal. The problem is that the computer locks up after a while (a few minutes). I have been using the Generate Continuous Sine Wave vi, but the problem remains.
    I've tried slow signals (10Hz) and fast signals (2kHz) but the computer still seems to crash. I have no clue what is going on!

    bissdp,
    The first thing I would recommend is making sure you have the latest version of the driver:
    www.ni.com > Support > Drivers and Updates > Current Versions > Multifunction DAQ
    Another you could try is to determine what component is causing the computer to lock up. Use a process explorer utility to try to see what processes are locked up. A search in google might turn up utilities like this one: (http://www.clarkwoodsoftware.com/peekaboo/)
    Keep in mind heat or speed issues. It may sound funny, but you may want to try opening the computer case and making sure the board has enough air flow to keep it cool.
    These are just some ideas for now, I hope they help.
    Alejandro Asenjo
    Applications Engineer
    National Instruments

  • TC measurements with PXI 4351 DAQ Card

    (I am using version 6i of LabVIEW). I am trying to create a VI that will use a PXI 4351 Card with a TBX-68T to take 4 thermocouple continuous measurements. I am also acquiring 8 voltages with a 6030E and TBX-68 and writing them to a file. My voltage data acquisition is modeled after "Buffered Continuous Analog Input.vi" I would like to aquire voltages and temperatures in the same vi, but using different devices and accessories. (I need a higher frequency for the voltage acquisition, and more precision with the temperatures). Is there a subvi I can use to collect the temperature data in the same vi as my voltage? I don't want the thermocouple DAQ to interfere with the voltage DAQ, either.
    I tried the NI435x thermocouple.vi
    but I couldn't get the Built-in Cold Junction Sensor to work or figure out how to combine it with my exisiting voltage acquisition. I also got NaN for my readings, and I checked the wire connections in all the sub vi's as suggested by another solution.
    Any comments would be great. Thanks in advance.

    Claudia-
    Thanks for the response.
    Regarding the CJC- When I switch it on, the temperature readings I get are very random, roughly negative 1 degrees. (I am operating right now at room temperature, and will be using J-type TC's to measure ~43 degrees C). Also, when I use the built-in CJC, the aquisition rate seems to slow down considerably. When I use the "user specified" everything seems to be ok, including the aquisition rate.
    I measured the resitance of the Thermistor on the TBX-68T and it was about 5000 Ohms, as expected.
    Just to make sure: When using the TBX-68T, do I need to hard-wire a thermocouple to Channel 1/auto-zero and another to channel 0/CJC? Because I connected a TC to channel 0 right now, but I wasn't 100%
    sure.
    I've attached my main vi and two sub vi's that I am using for the voltage aquisition part of my project. (Note:the current measurements are just voltage measurements multiplied by the recipricol of the resistance it was measured across, ie. 10).
    I would like to keep this file as is because it writes to a file exactly the way I want it to. I'd like to have the temperature aquisition with the 4351 in the same vi as the 6030E so that they both stop and start at the same time. I am just not sure how and where to log the temperature data since there will be fewer data points than the voltage data. Any suggestions? Should I write two separate files? can I somehow append them?
    Thanks again. Hope to here from you soon.
    Attachments:
    EBlackMainDAQ.vi ‏107 KB
    Save_Data8.vi ‏45 KB
    Build_String_Array5.vi ‏33 KB

  • Oriental Motor control with labview

    I am trying to control third party (Oriental Motors) stepper motor
    controllers with Labview. I have managed serial communication, but command
    aren't being sent. Can anyone help me?

    Hi Azim,
    It looks like Maxon posted a driver for the DES servoamplifier here: 
    http://shop.maxonmotor.com/maxon/assets_external/Katalog_neu/eshop/Downloads/maxon_motor_control/4-Q...
    The DES can communicate via a command voltage from a motion controller, in the NI case you would use a PCI or PXI 7340 or 7350 series motion controller, and set the drive to +-10V command input mode. 
    It can also communicate over Serial RS-232 or CAN. I believe the above linked driver implements serial communication, but I haven't had a chance to look at it, so I'm not positive. 
    See description of modes and comm interfaces here:
    http://shop.maxonmotor.com/maxon/assets_external/Katalog_neu/eshop/Downloads/maxon_motor_control/4-Q...
    Best Regards,
    Nate

  • Simple motor control with Labview

    Can anyone suggest a simple motor to be controlled by labview. I am interested in making a small scale elevator that is controlled with a labview interface. If anyone could point me in the right direction it would be greatly appreciated. - Bryan

    Attached is the vi for the program.  I will also try and attach the C code for the project.  It took a lot of failed attempts to get it working so I hope this works for you.  I don't have a schematic for you, but if you look over the C code it should let you know.  Also I used the CCS development kit 16F877A.  I'm not great at programming in C so there is a good chance you can clean it up a bit.
    I'll keep an eye on this post if you have any questions, when winter comes I'll probably work on this some more.
    Message Edited by nutmegzzzz on 09-19-2005 01:56 PM
    Attachments:
    Serial Read with Timeout version 1b.vi ‏169 KB
    LED and Motor Control from LabView - Complete.c ‏3 KB

  • Dc motor control with H-Bridge..DAQ

    So I have a USB DAQ 6008, DC motor, Hbridge and 2 Limit switches...
    What I need to have done is to control a DC motor so that it turns on for a 1 second and turn off for 2 seconds....and then as it approaches a limit switch it continues in the opposite dirrection and then for the switch vise versa...
    So far i can only turn on the motor but no timing sequence...
    I am kinda new to labview...so any help would work such as a tutorial or some guidance...thanks

    Hi cool,
    I'm not sure if the 6008 is the best option.  You may be able to do it by setting up a continuous analog output task.  Then you can use the DAQmx Stop VI to stop the task after 1 second and then the DAQmx start to start it again after 2 seconds.
    Justin D.
    Applications Engineer
    National Instruments

  • Feedback application for a maxon brushed motor controlled with a EPOS2

    Hi,
    I want to implement a VI that controls a linear stage moving vertically. On the platform that is mounted on the linear stage i sitting a load cell. The platform has to move up and down in a sinusoidal kind of way, maintaining a constant load on the load cell (one can imagine a piston and cam system, where the piston is applying the load).
    The load cell is connected through a PCI 6014 and is working fine. 
    The computer can communicate with the motor through the "EPOS studio" provided by maxon, but it cannot perform such an advanced task and therefore I decide to use labview.
    I'm trying to modify the VI that is provided by maxon by implementing a feedback with the voltage from the load cell. I want the motor to move in such a way to maintain the voltage from the load cell constant. 
    I'm not very proficient with labview and I would like to know if this is possible and if so can anyone give some directions?
    Thank you very much,
    Matteo 

    Dear Jochen,
    Thank you for your answer.
    1. Which type of EPOS drive are you using? Could you please provide a link to a datasheet? 
    I am using a EPOS2 50/5, see attached pdf.
    2. Are you using a CANopen interface to the EPOS drive and is there also an option to use an analog signal as torque command?
    No, I'm not using the CANopen interface, but the labview VI provided by maxon (see attached).
    No, the controller has no input analog signal capability. 
    3. Are you using LabVIEW for Windows?
    Yes. 
    4. What's the voltage level of your load cell signal?
    +10V to - 10V 
    5. Do you have any idea about the required control loop timing?
    I'm not even sure I understand what you mean, so no, I don't.
    I just want to add that my application won't require a high speed. The vertical motion will be around 2 cm/s at most 3 cm/s and I was considering that quasi-static.
    Thanks a lot,
    Matteo 
    Attachments:
    EPOS2-50-5-347717_09_EN_303.pdf ‏472 KB
    maxon EPOS.zip ‏1520 KB

  • Spindle motor control with labview

    Hi
    I want to control the spindle motor with Labview. It is maxon motor EC 32 with encoder and controller. I can control it with the GUI software. But, I am not sure that there have any such options in labview to control the motor? Please let me how I can control this spindle with the help of labview.
    Thank you for your co-operation.
    Best Regards
    Azim

    Hi Azim,
    It looks like Maxon posted a driver for the DES servoamplifier here: 
    http://shop.maxonmotor.com/maxon/assets_external/Katalog_neu/eshop/Downloads/maxon_motor_control/4-Q...
    The DES can communicate via a command voltage from a motion controller, in the NI case you would use a PCI or PXI 7340 or 7350 series motion controller, and set the drive to +-10V command input mode. 
    It can also communicate over Serial RS-232 or CAN. I believe the above linked driver implements serial communication, but I haven't had a chance to look at it, so I'm not positive. 
    See description of modes and comm interfaces here:
    http://shop.maxonmotor.com/maxon/assets_external/Katalog_neu/eshop/Downloads/maxon_motor_control/4-Q...
    Best Regards,
    Nate

  • Step motor control with a time delay

    Hi all,
    I am trying to control a step motor to move in vertical direction by Labview2010. The specific Labview function blocks are created by the manufacturer of the step motor. Now the axis can move up/down properly but my question is that I want it to move with a time interval. For example, we set the desired position to 10mm and waiting time 1s. When I click on the start button once only the axis moves 1mm and wait 1s. Then axis moves another 1mm and wait 1s. This action will obviously repeat 10 times until the axis reaches 10mm position.
    I will be very thankful if someone could give me some hints.
    Best regards,
    Nicky
    Solved!
    Go to Solution.

    You're welcome
    You should some more to the code so that it's more reliable. There might be some miscalculation between the travel distance and the resolution, i.e. 5mm travel and 2mm resolution will give the forloop 2,5. This should be either 2 or 3. I'm not quite sure how the for loop handles this. I think it will round to nearest. You should anyways check it out. Also avoid using 0mm.
    Good look with your project 
    Regards,
    Even
    Certified LabVIEW Associate Developer
    Automated Test Developer
    Topro AS
    Norway

  • Step motor control with a time interval

    Hi all,
    I am trying to control a step motor to move in vertical direction by Labview2010. The specific Labview function blocks are created by the manufacturer of the step motor. Now the axis can move properly but my question is that I want it to move with a time interval. For example, we set the desired position to 10mm and waiting time 1s. When I click on the start button once only the axis moves 1mm and wait 1s. Then axis moves another 1mm and wait 1s. This action will obviously repeat 10 times until the axis reaches 10mm position.
    I will be very thankful if someone could give me some hints.
    Best regards,
    Nicky

    You're welcome
    You should some more to the code so that it's more reliable. There might be some miscalculation between the travel distance and the resolution, i.e. 5mm travel and 2mm resolution will give the forloop 2,5. This should be either 2 or 3. I'm not quite sure how the for loop handles this. I think it will round to nearest. You should anyways check it out. Also avoid using 0mm.
    Good look with your project 
    Regards,
    Even
    Certified LabVIEW Associate Developer
    Automated Test Developer
    Topro AS
    Norway

Maybe you are looking for

  • Export/import buffer swap high

    hi friends; I  am with ERP Ecc6 system.in oracle 10g & aix5.3 I am facing an issue with Export/import buffer shows a HitRatio 83% and swaps is 1,195,697. can anybody please suggest me how to solve the performance issue regards seethy

  • PDF Files don't load

    Get a black screen. Can down load and read with preview. Also, Safari won't load in 32 bit. Message says that adblocker loader causing it.

  • How to solve the error " The installation process encountered an error while installing Shared Technologies.

    I had bought the adobe photoshop elements 12 online and I am not able to complete my installation although i tried many times . An error "The installation process encountered an error  while installing Shared Technologies. Please restart your compute

  • Simple : how to add title attribute to af:InputText

    Hi Guys, I have a simple question, is there a way to have the title attribute to af:InputText as the value of input field? Thanks Abhi

  • Is there a point?

    Last night I finally tried to install the new iOS4 onto my iPhone 3G. Like most people, it was nothing but problems. I waited over 2 hours for it to backup, before I finally gave in, and stopped it. I tried again thinking something had just glitched