Trouble writing to all three digital ports

I am controlling three motors with 24 digital lines, 8 for each. The code is attached. Two of the motors will run but the third always crashes (vibrates and trips). When I swap the ports on the three port configurations I can get ANY two motors to run smoothly, but never the third. The problem seems to be isolated to the bottom (see attached code) port configuration and write. I have deleted and reinserted fresh vi's, but no luck.
I am running a LabPC 1200 board and have tried this with the same error on a LabPC+.
Is there a better way to write bytes of data to ports?
Thanks a lot!!!
-Kyle
Attachments:
3motor_test.vi ‏122 KB

Thanks for contacting National Instruments. After taking a look at your code, I can see that there are a couple of issues here.
The first is that you are configuring the ports during every iteration of the loop. You should move the port config VIs out of the loop. Having them inside is bad because you really only need to configure the ports once, before you start writing to them. Doing this every iteration adds a lot of overhead, and it also amplifies the effects of the second problem.
The second problem is that your boards are resetting all the ports every time you configure any port. All National Instruments products that have an 8255 or 82C55 digital chip, including the Lab-PC, will exhibit this behavior. When you change the configuration
of one digital port on an 8255, the digital lines on ALL of the ports are reset. This is the way the 8255 chip works. The 8255 consists of three ports, each containing 8 digital lines (24 total). To properly use the chip, all configuring needs to be done prior to setting the output states of the lines.
For more information on this issue, see the linked KnowledgeBase:
http://digital.ni.com/public.nsf/websearch/3E25A9780F2C48B986256120005AF098?OpenDocument
So you can see that moving the config VIs outside of the loop should address both problems. This should do it, but if it doesn�t, please let me know.
-Mike

Similar Messages

  • HT204400 I get no audio from this device.  All my HDMI ports are in use with the cable box, DVR and receiver .  My digital optical cable is also in use to the receiver.  Is there a solution?

    I cannot get audio using this device all my HDMI ports are in use as well as my digital optical cable.  Any solutions?

    How exactly is the ATV connected if all HDMI ports are in use? 
    If connected directly to the TV, then audio is being sent to the TV speakers, not the receiver.

  • Can i Count digital edges with all three channels on a 9421 cDAQ

    Hi!
    We have just purchased a Compact DAQ with NI 9203, NI 9217 and a digital card 9421. In the application for which these parts have been purchased I want to measure flow, power, pressure, temperature and water and energy consumption of a sterilizer. I have connected the flowmeters, and pressuremeters to the analog current card 9203, the RTD termomters to the 9217 and three digital pulse outputs from two flowmeters and a poweranalyser to the 9421 card. I have configured the analog inputs on 9203 and 9217 to my satidafction. But now to my question. I want to configure VI to count the digital edges from the three channels in the 9421. I know that the card only has two counters but since my pulses only has a frequency of approximately 1 Hz I believe that i in some way should be possible to count the edges with a regular digital input channel as well.
    I know I have signal from all three pulse outputs to the 9421 card, since I have tested this in the Measuremnet & Automation explorer.
    Do I need to add an extra DAQ-assistant to be able to acquire the digital signal parallell to the analog signals from the two other cards?
    And is it possible to count the edges of mylow frequency on say for example channel di0, di1 and di2 as i wish and not only on di0 and di5 which I think are the counter-channels?
    Do i need to put the 9421 card in one particular slot on my cDAQ-station, this I also ask since my pulses frequnency is low and I don´t now if i really need to use the counter on slot 5-6 to count my pulses?
    Attachments:
    Measurementbench.vi ‏143 KB

    Hi Gravy Train,
    I'm curious about why you are using 2 loops.   You mentioned one is for monitoring and one is for DAQ....what do you mean by that?   What is the overall goal of this piece of code.   Also, I noticed that you are not closing the task.   Since this is just a subset, I realize you could be closing it in your actual code, but just in case you're not.....it is very important that you close all tasks when you are down acquiring data.
    Best Regards,
    Starla T  

  • We have 3 MacBook Pros in our house, connected by a WiFi network. I am having troubles connecting an external hard drive thru our router, to make back ups of all three computers wirelessly.

    I have purchased a 3rd party external hard drive to back up all three computers. I have done the intial back up by connecting each computer separately to the drive via USB. I was told at the Apple store where I purchased the drive, that I could then connect the hard drive to our router via the USB and then use Time Machine to back up the computers wirelessly. But I can't seem to figure out how to do that. I have connected the device to the router, but don't see it on Finder and when I check with Time Machine, it doesn't recognize any device. Help please!

    First off your external drive must be formatted Mac Extened (Journaled) for it to work with Time Machine. As that is not a widely used format, the Apple Mac format, most routers do not support it so the router will not see it is even connected to the router. For the router to see the drive is must be formatted either FAT32 or on some routers they can see/read/write to the NTFS format. But if you kformat it like that then Time Machine will not backup to it.
    About the only device that can be used for network backups of Mac computers is an Apple Time Capsule.
    So you have 2 options.
    1) Do all the backups by connecting that drive directly to each Mac.
    2) Take it back and get a Refund then buy an Apple Time Capsule. And or some other Network Attached Storage device (a NAS) that cane be formatted Mac Extended (Journaled) and be seen on your LAN and that the Mac's can backup up to.
    <Edited by Host>

  • I am having trouble on all three of my websites with the contact form

    I have created a form for people to contact me with a message on all three websites.  In the form options I have entered my email address to receive the form to read.  However I can not get it to go to that email address.  It just keeps failing and kicking back to my adobe Id email address when I go online to test them.  I have tried several email address to try to send the form to and keeps doing the same thing I have never had this problem before.  any one else having this problem?   Thank you.

    How did you get a Lion OSX install disc? They don't exist. Do you mean the gray disks that came with your 2007 MacBook?
    If you mean the gray disks, try starting up with the "c" key held down.
    What version of OSX is on your MacBook now? Have you tried booting from the Recovery partition?

  • Single virtual channel with multiple digital ports

    Hi all,
    I have created a program that creates a task to read continuously from 3 digital port lines from the same device (PXI-6133). I am trying to figure out how I can retrieve the data from each port line to put into a waveform graph. Currently, I am using the DAQmx Read instance with "1 Channel N Samples" but I get a waveform with all values at the same time or a waveform graph with all three lines transposed.
    I am using Windows XP and LabVIEW 8.6.
    Appreciate any help!
    Solved!
    Go to Solution.

    Hi Matt,
    Thanks for your reply. Unfortunately thats not quite I am looking for. I am sending the DAQmx task the 3 port lines that I want therefore as I have read it bundles them all into one channel by default. What I want to do is take that one channel and parse out the data of each of the 3 port lines to create 3 new waveforms to work with individually.
    After fumbling around a little bit, I was able to sort of get what I wanted. I've attached a screen shot of that portion of the program. The red circle in the bottom right hand corner is how I want to end up. I only did it for one of the pieces of data just to try it out and the conversion to string is just for me to print out what I'm working with. Unfortunately, when I look at the waveform it seems like maybe some extra 0's are being thrown in because its not the same graph that appears from the beginning (when all 3 pieces of data are transposed on each other). Let me know what you think.
    Thanks,
    julissa
    Attachments:
    LabVIEW-ss1.JPG ‏57 KB

  • Trouble writing PDF out of Framemaker 7.1

    Hello,
    I have an old version of Framemaker, 7.1, and I'm having trouble writing a pdf. Our office is all Windows based. On two machines, when I write the pdf, I can't get it to create crop marks and I lose chucks of text, indents are changed and spacing between paragraphs are changed. On a third machine, I get the pdf to render just fine with the crop marks. The settings we use on all three machines is the same. The problem I have is, the good PC is leaving next week when the owner goes traveling on buisness.
    Can anyone offer me any suggestions, please? Thank you.
    Jeff

    My first suggestion would be to provide us with some more info.  ;-  )
    Your OS, exact version of FM(from Help > About --  the p number),  version of Acrobat, and anything else that seems relevant.
    Or to cut to the chase, you could confirm that you have the highest  patch levels of FM and Acrobat, and if you have XP, that you're also  fully patched there -- including the Microsoft HotFix for PS printers  (such as Acrobat) --  http://support.microsoft.com/?id=952909 -- it applies to all PS printers, including the logical PDF you're  using, and one of the fixes is the missing text you mentioned.
    Cheers,
    Art

  • How to write a driver for custom hardware on a digital port

    Hi,
    I am a complete newbie to LabView and so I hope that someone can hint me to the information I need.
    At the moment, I am completely lost.
    I have the CVS-1454 which has a digital I/O port.
    Now I want to plug a custom made converter on this port to convert the digital port into 4 RS232 ports.
    The hardware is not the problem, but how do I write a driver for my box?
    Is there some kind of tutorial on writing drivers available?
    All I found in the official documentation was that you can write your own drivers, but the link to the page which should give more information was invalid :-(
    Thank you for reading and have a nice day,
    FReAK

    Frankly, what you're attempting to do may be beyond the capability of both LabVIEW and the digital I/O. At the very least, it's going to take quite a bit of work. On the transmit side, you're going to have break down characters into binary and then transmit them at a pretty precise rate. I'm not familiar with the CVS-1454 but a lot of digital I/O on NI devices is not hardware timed. Using software timing is going to be risky. You have the same issue on the receive end - just in reverse. I think that if I was forced to convert some digital I/O to serial, I'd try to use commerical parallel to serial converters. The digital I/O is similar to a parallel port and the converters handle all of the conversion, timing, and handshaking for you.

  • Write to serial port and digital port at the same time

    hello,
    I need to write to the digital port and the serial port at the same time. Right now I have the two vi's (to write to the serial port, write to the digital port) in the sequence structure. First I write the digital port, then write the serial port. Using the oscilloscope, the interval between these two executions is 10 ms; and I need to reduce this interval to as small as possible. I would appreciate help in any way. Thank you.

    Hello;
    This is a little tricky. Since the transition from one sequence to another is completely Software timed, and windows manages all tasks that are running at one given time, there isn't a method to reduce that transition time.
    The most you can do is try to optimize your code so all the time expent on the transition is due only to the task management.
    Hope this helps.
    Filipe A.
    Applications Engineer
    National Instruments

  • I write digital port by 'DAQmx Configure Logging.vi​' and receive TDMS file with 8 boolean channels. How can I write to 1 integer channel?

    Hello!
    I want to write 1 digital port from PXI-6536 with streaming to TDMS file.
    I'm writing by 'DAQmx Configure Logging.vi' and become TDMS file with 8 boolean channels.
    How can I write to 1integer channel?
    Attachments:
    1.JPG ‏27 KB

    Hey Atrina,
    The actual data stored on disk is just the raw data (that is, a byte per sample in your case).  It's really just a matter of how that data is being represented in LabVIEW whenever you read back the TDMS file.
    I'm not sure if there is a better way to do this, but here is a way to accomplish what you're wanting:
    Read back the TDMS file as a digital waveform.  Then there's a conversion function in LabVIEW called DWDT Digital to Binary.  This function will convert that set of digital channels into the "port format" that you're wanting.  I've attached an example of what I mean.
    Note: When looking at this VI, there are a few things that the downgrade process did to the VI that I would not recommend for these TDMS files.  It added a 1.0 constant on the TDMS Open function, and it set "disable buffering" on the TDMS Open function to false; you can get rid of both of those constants.
    Message Edited by AndrewMc on 01-27-2010 11:21 AM
    Thanks,
    Andy McRorie
    NI R&D
    Attachments:
    digitalconvert.vi ‏13 KB

  • How do I output three digital waveforms at once?

    I posted this in Digital I/O, but now I think it's actually more appropriate here because it's not a hardware question. I need to output three digital waveforms at a relatively low frequency, 71.9 Hz. I have a PCI DAQ card, the 6024E and am using the NI-DAQmx functions to try to do this. My program basically generates the square wave that I want, and converts it into a digital wave. I do this 3 times for the three separate waves, and then I combine them into an array and send them to my DAQ functions, which are in a while loop so I can get continuous output. My problem is that the waveform that the DAQ is actually outputting is not what I want. It's outputting a wave that has the same duty cycle (approximately) but the frequency is over 2 kilohertz. It's not like this all the time; after it outputs about 7 cycles of this wave, it goes to logic low for a long time, and then repeats itself. When I probe the digital waveform right before it goes into the DAQ functions, it's running correctly at 71.9 Hertz. Am I doing anything wrong with the DAQ functions or the sampling information? Thanks in advance.
    -- Josh Matloff

    Hello Josh,
    I'm pretty sure that the reason that your digital waveforms are not being produced at the correct frequency is because your digital output is not associated with any sort of timing. Unfortunately, with an E series board you can only do software timed digital operations. This means that the frequency at which the values on your digital lines will be updated depends on how fast/often your computer executes the DAQmx Write that is inside of your while loop. If you have an M series board, you can actually correlate the DIO operations with another subsytems clock (AI/AO sample clock, etc.) which means that you can acheive hardware-timed DIO. In the event that you do not have access to an M series board, I think that AnalogKid2DigitalMan was spot on that you would want to use counters to generate pulse trains (that is if your digital waveforms have a constant duty cycle and period). Depending on what the DAQ board is outputting to, you might also want to consider using the Analog Output channels to generate your digital waveform. As long as you continue to use the digital lines on the 6024E, there is not really a way to guarantee the timing of when the digital lines will be updated. You might be able to get close, but you will probably see some "hiccups", especially if your computer needs to service interrupts or give processing time to another application. And lastly, heed geckoee's advice and don't forget to properly close out your tasks! Putting in some error handling may also help in the debugging process.
    Take care,
    E.Lee
    Eric
    DE For Life!

  • How to avoid dependance between output digital port with a PCI 1200 daq card?

    Hello,
    I don't manage to fix the state of a line on one port (PA0 for ex) without change the state of another line of another digital port (PB0 for ex)
    I use a PCI 1200 Daq card with Labview 5.0.1 (under Windows 98)
    How to configure a robust state (high logic level) on a line of a port??
    Does anybody have an idea on this problem?
    Thanks a lot in advance and happy new year to the community
    JF LAVEZARD

    jflab a écrit:
    Hello,
    I don't manage to fix the state of a line on one port (PA0 for ex) without change the state of another line of another digital port (PB0 for ex)
    I use a PCI 1200 Daq card with Labview 5.0.1 (under Windows 98)
    How to configure a robust state (high logic level) on a line of a port??
    Does anybody have an idea on this problem?
    Thanks a lot in advance and happy new year to the community
    JF LAVEZARD
    Hello,
    I've found the problem
    The PCI1200 has a chip 8255 for Digital I/O
    If I use the bad VI, it reconfigures the port and all the lines go in a low logic state
    so I'd to write only on the port or the line without reconfigure the port
    So the good VI in the palett is: Port Write and not Digital Port write!
    See attached file..
    Thanks
    Best Regards
    Attachments:
    port_dio.jpg ‏771 KB

  • Trouble writing Query for Pivoting data from a table

    I am having a little trouble writing a query for converting the below table data into a pivot data. I am trying to write a query for which if I give a single valid report_week date as input it should give me the data for that week and also provide two extra columns, one which gives the data of last week for the same countries and the second column which gives the difference of numbers in both the columns(i.e. COUNT - COUNT_LAST_WEEK).
    REPORT_WEEK     DIVISION     COUNT
    9/26/2009     country1     81
    9/26/2009     country2     97
    9/26/2009     country3     12
    9/26/2009     country4     26
    9/26/2009     country5     101
    10/3/2009     country1     85
    10/3/2009     country2     98
    10/3/2009     country3     10
    10/3/2009     country4     24
    10/3/2009     country5     101
    10/10/2009     country1     84
    10/10/2009     country2     98
    10/10/2009     country3     10
    10/10/2009     country4     25
    10/10/2009     country5     102
    For example, if I give input as 10/10/2009, the output should be as give below.
    REPORT_WEEK     DIVISION     COUNT     COUNT_LAST_WEEK     DIFFERENCE
    10/10/2009     country1     84     85     -1
    10/10/2009     country2     98     98     0
    10/10/2009     country3     10     10     0
    10/10/2009     country4     25     24     1
    10/10/2009     country5     102     101     1
    For example, if I give input as 10/3/2009, the output should be as give below.
    REPORT_WEEK     DIVISION     COUNT     COUNT_LAST_WEEK     DIFFERENCE
    10/3/2009     country1     85     81     4
    10/3/2009     country2     98     97     1
    10/3/2009     country3     10     12     -2
    10/3/2009     country4     24     26     -2
    10/3/2009     country5     101     101     0
    Can anyone please shed some light on Query building for the above scenarios.
    Thank you
    SKP
    Edited by: user11343284 on Oct 10, 2009 7:53 AM
    Edited by: user11343284 on Oct 10, 2009 8:28 AM

    I assume there is no gap in report weeks. If so:
    SQL> variable report_week varchar2(10)
    SQL> exec :report_week := '10/10/2009'
    PL/SQL procedure successfully completed.
    with t as (
               select to_date('9/26/2009','mm/dd/yyyy') report_week,'country1' division,81 cnt from dual union all
               select to_date('9/26/2009','mm/dd/yyyy'),'country2',97 from dual union all
               select to_date('9/26/2009','mm/dd/yyyy'),'country3',12 from dual union all
               select to_date('9/26/2009','mm/dd/yyyy'),'country4',26 from dual union all
               select to_date('9/26/2009','mm/dd/yyyy'),'country5',101 from dual union all
               select to_date('10/3/2009','mm/dd/yyyy'),'country1',85 from dual union all
               select to_date('10/3/2009','mm/dd/yyyy'),'country2',98 from dual union all
               select to_date('10/3/2009','mm/dd/yyyy'),'country3',10 from dual union all
               select to_date('10/3/2009','mm/dd/yyyy'),'country4',24 from dual union all
               select to_date('10/3/2009','mm/dd/yyyy'),'country5',101 from dual union all
               select to_date('10/10/2009','mm/dd/yyyy'),'country1',84 from dual union all
               select to_date('10/10/2009','mm/dd/yyyy'),'country2',98 from dual union all
               select to_date('10/10/2009','mm/dd/yyyy'),'country3',10 from dual union all
               select to_date('10/10/2009','mm/dd/yyyy'),'country4',25 from dual union all
               select to_date('10/10/2009','mm/dd/yyyy'),'country5',102 from dual
    select  max(report_week) report_week,
            division,
            max(cnt) keep(dense_rank last order by report_week) cnt_this_week,
            max(cnt) keep(dense_rank first order by report_week) cnt_last_week,
            max(cnt) keep(dense_rank last order by report_week) - max(cnt) keep(dense_rank first order by report_week) difference
      from  t
      where report_week in (to_date(:report_week,'mm/dd/yyyy'),to_date(:report_week,'mm/dd/yyyy') - 7)
      group by division
      order by division
    REPORT_WE DIVISION CNT_THIS_WEEK CNT_LAST_WEEK DIFFERENCE
    10-OCT-09 country1            84            85         -1
    10-OCT-09 country2            98            98          0
    10-OCT-09 country3            10            10          0
    10-OCT-09 country4            25            24          1
    10-OCT-09 country5           102           101          1
    SQL> exec :report_week := '10/3/2009'
    PL/SQL procedure successfully completed.
    SQL> /
    REPORT_WE DIVISION CNT_THIS_WEEK CNT_LAST_WEEK DIFFERENCE
    03-OCT-09 country1            85            81          4
    03-OCT-09 country2            98            97          1
    03-OCT-09 country3            10            12         -2
    03-OCT-09 country4            24            26         -2
    03-OCT-09 country5           101           101          0
    SQL> SY.

  • I'm having trouble writing a polynomial code.

    I'm having trouble with a polynomial code I'm supposed to conjour it. It's simply a code that adds, subtracts, and multiplies polynomials. However, there are a few methods I do not know how to come up with (I left them blank), and when I test the code write now, it doesn't work. Here's the code -- can anyone help?
    public class Polynomial implements Cloneable {
         private int m_degree;
         private double[] m_coefficient;
         // This is the default constructor
         public Polynomial() {
              super();
              m_degree = 0;
              m_coefficient = new double[5];
         // This allows the user to build a polynomial by putting a constant in
         public Polynomial(double constant) {
              this();
              m_coefficient[0] = constant;
         public Polynomial(Polynomial source) {
         // These are the getters
         public double getCoefficient(int degree) {
              return m_coefficient[degree];
         public int getDegree() {
              return m_degree;
         // These are the setters
         public void addToCoefficient(double amount, int degree) {
              m_coefficient[degree] += amount;
         public void assignCoefficient(double newCoefficient, int degree) {
              m_coefficient[degree] = newCoefficient;
         public void clear() {
              for (int i = 0; i < m_coefficient.length; i++) {
                   m_coefficient[i] = 0;
         public void reserve(int degree) {
         // These are other, useful methods
         public int nextTerm(int k) {
              int value = 0;
              return value;
         public double eval(double x) {
              double value = 0;
              // This goes through all the exponents in the polynomial
              for (int i = 0; i < getDegree(); i++) {
                   // += allows you to add instead of overriding the next term
                   value += getCoefficient(i) * Math.pow(x, i);
              return value;
         // Here is our addition method
         public static Polynomial add(Polynomial p1, Polynomial p2) {
              Polynomial newPolynomial = new Polynomial();
              // We have to find the bigger polynomial so we know how to set the loop
              if (p1.getDegree() >= p2.getDegree()) {
                   for (int i = 0; i < p1.getDegree(); i++) {
                        newPolynomial.addToCoefficient(p1.getCoefficient(i)
                                  + p2.getCoefficient(i), i);
              } else {
                   for (int i = 0; i < p2.getDegree(); i++) {
                        newPolynomial.addToCoefficient(p1.getCoefficient(i)
                                  + p2.getCoefficient(i), i);
              return newPolynomial;
         // Here is our subtraction method
         public static Polynomial subtract(Polynomial p1, Polynomial p2) {
              Polynomial newPolynomial = new Polynomial();
              // We have to find the bigger polynomial so we know how to set the loop
              if (p1.getDegree() >= p2.getDegree()) {
                   for (int i = 0; i < p1.getDegree(); i++) {
                        newPolynomial.addToCoefficient(p1.getCoefficient(i)
                                  - p2.getCoefficient(i), i);
              } else {
                   for (int i = 0; i < p2.getDegree(); i++) {
                        // The order is important with subtraction so they cannot be
                        // switched
                        // The equation is allowed to be negative, but the exponent
                        // cannot be
                        newPolynomial.addToCoefficient(p1.getCoefficient(i)
                                  - p2.getCoefficient(i), i);
              return newPolynomial;
         // Here is our multiplication method
         public static Polynomial multiply(Polynomial p1, Polynomial p2) {
              Polynomial newPolynomial = new Polynomial();
              if (p1.getDegree() >= p2.getDegree()) {
                   for (int i = 0; i < p1.getDegree(); i++) {
                        newPolynomial.addToCoefficient(p1.getCoefficient(i)
                                  * p2.getCoefficient(i), i);
              } else {
                   for (int i = 0; i < p2.getDegree(); i++) {
                        newPolynomial.addToCoefficient(p1.getCoefficient(i)
                                  * p2.getCoefficient(i), i);
              return newPolynomial;
         // Here is our clone method
         public Polynomial clone() {
              Polynomial poly;
              try {
                   poly = (Polynomial) super.clone();
              } catch (CloneNotSupportedException e) {
                   throw new RuntimeException(
                             "Class does not implement cloneable interface");
              return poly;
    }

    We've been working with arrays, and we have to write a code that adds, subtracts, and multiplies polynomials. I'm having trouble with a few of the methods. I've assigned m_degree and m_coefficient as the fields I need to use.
    Right now, as my code stands, when I test it with a polynomial in main, it doesn't work. So right now, there's a mistake preventing what I have so far from properly functioning.
    I am also having trouble writing the following methods:
    reserve: We have to allocate memory to the polynomial every time it changes so we make sure we always have enough space to work with it.
    nextTerm: We need this to jump to the next term in the polynomial, but I'm not quite sure how to do it. I didn't even realize it was possible.
    I'm horrible at commenting and explaining my code, but if you read over it just a little bit, you may be able to get the gist of what I'm trying to do. Thanks for any help, and sorry if I can't explain well.
    public class Polynomial implements Cloneable {
    private int m_degree;
    private double[] m_coefficient;
    // This is the default constructor
    public Polynomial() {
    super();
    m_degree = 0;
    m_coefficient = new double[5];
    // This allows the user to build a polynomial by putting a constant in
    public Polynomial(double constant) {
    this();
    m_coefficient[0] = constant;
    public Polynomial(Polynomial source) {
    // These are the getters
    public double getCoefficient(int degree) {
    return m_coefficient[degree];
    public int getDegree() {
    return m_degree;
    // These are the setters
    public void addToCoefficient(double amount, int degree) {
    m_coefficient[degree] += amount;
    public void assignCoefficient(double newCoefficient, int degree) {
    m_coefficient[degree] = newCoefficient;
    public void clear() {
    for (int i = 0; i < m_coefficient.length; i++) {
    m_coefficient[i] = 0;
    public void reserve(int degree) {
    // These are other, useful methods
    public int nextTerm(int k) {
    int value = 0;
    return value;
    public double eval(double x) {
    double value = 0;
    // This goes through all the exponents in the polynomial
    for (int i = 0; i < getDegree(); i++) {
    // += allows you to add instead of overriding the next term
    value += getCoefficient(i) * Math.pow(x, i);
    return value;
    // Here is our addition method
    public static Polynomial add(Polynomial p1, Polynomial p2) {
    Polynomial newPolynomial = new Polynomial();
    // We have to find the bigger polynomial so we know how to set the loop
    if (p1.getDegree() >= p2.getDegree()) {
    for (int i = 0; i < p1.getDegree(); i++) {
    newPolynomial.addToCoefficient(p1.getCoefficient(i)
    + p2.getCoefficient(i), i);
    } else {
    for (int i = 0; i < p2.getDegree(); i++) {
    newPolynomial.addToCoefficient(p1.getCoefficient(i)
    + p2.getCoefficient(i), i);
    return newPolynomial;
    // Here is our subtraction method
    public static Polynomial subtract(Polynomial p1, Polynomial p2) {
    Polynomial newPolynomial = new Polynomial();
    // We have to find the bigger polynomial so we know how to set the loop
    if (p1.getDegree() >= p2.getDegree()) {
    for (int i = 0; i < p1.getDegree(); i++) {
    newPolynomial.addToCoefficient(p1.getCoefficient(i)
    - p2.getCoefficient(i), i);
    } else {
    for (int i = 0; i < p2.getDegree(); i++) {
    // The order is important with subtraction so they cannot be
    // switched
    // The equation is allowed to be negative, but the exponent
    // cannot be
    newPolynomial.addToCoefficient(p1.getCoefficient(i)
    - p2.getCoefficient(i), i);
    return newPolynomial;
    // Here is our multiplication method
    public static Polynomial multiply(Polynomial p1, Polynomial p2) {
    Polynomial newPolynomial = new Polynomial();
    if (p1.getDegree() >= p2.getDegree()) {
    for (int i = 0; i < p1.getDegree(); i++) {
    newPolynomial.addToCoefficient(p1.getCoefficient(i)
    * p2.getCoefficient(i), i);
    } else {
    for (int i = 0; i < p2.getDegree(); i++) {
    newPolynomial.addToCoefficient(p1.getCoefficient(i)
    * p2.getCoefficient(i), i);
    return newPolynomial;
    // Here is our clone method
    public Polynomial clone() {
    Polynomial poly;
    try {
    poly = (Polynomial) super.clone();
    } catch (CloneNotSupportedException e) {
    throw new RuntimeException(
    "Class does not implement cloneable interface");
    return poly;
    }

  • Connecting inductif approximation sensor to digital port

    Hi,
    As I have little experience in electronics I was wondering how I could
    connect a inductif approximation sensor to one of my digital ports of a
    PCI-MIO DAQ card. This card has 8 digital ports which can be configured as
    either digital in or out.
    The sensor is driven by 24 volts DC, three wires, and is of PNP type.
    Anyone?
    thanks
    I'd like to use this sensor to monitor the speed of a slow rotating machine.
    Ron@ld

    Ronald
    If the signal from the signal is withen TTL specs, you can use it with one of the digital ports on the E-Series boards. TTL specs are 0 - 0.8V for low and 2-5V for high. The rise and fall times will also have to be within TTL specs.
    Brian

Maybe you are looking for