Using LPT to generate pulses

hi..
im new to labview,
im trying to generate clock , strobe and data signals
( data to be user defined ) using the wave form generator function in LabView 7.1..the data has a different time period as compared to the other pulses..
my end purpose is to use the parallel port to output these signals on an oscilloscope....
could u please suggest how i should go about it?
thank you,
Sairaj.
ps:i have attached the file tht generates the pulses, i have no idea how to use the parallel port after this, especially considering tht there are so many timing issues involved.Message Edited by Sairaj on 06-09-2005 01:00 AM
Attachments:
signal generator.vi ‏78 KB

what a stupid shi...... - NI cancelled the attachment during preview post - here again.......
hi retour,
find attached a modified vi ( was for AD9835 - numerically controlled Oscillator ).
You should be able to understand the principle and change these vi's for your needs.
My intention was - to be fast and copy things together.................
regards
Werner
Attachments:
AD9835 SPI variation test1.zip ‏151 KB

Similar Messages

  • PCI 6602:How can I use the digital lines of the board and in the same time to generate pulse train using a counter?

    Hello!
    My problem appeared when I tried to update my code from Traditional NI-DAQ Legacy to DAQmx.
    I am using 2 counters (counter 5 and counter 7)  from PCI-6602, to generate pulse train, and also the Digital I/O lines of the port 0 (the lines form 0 to 7). What I do in my application is that I am starting to generate the pulse train on the output of the 2 counters, and after that I am playing with the state of the digital lines.
    In traditional there was no problem using the counters and the digital lines in the same time, everything was going perfectly, but in DAQmx this is not possible.
    What happens: I start to generate pulse train on the output of the counters,  no errors encountered, but when I try to modify the state of one line of the digital port the generation of the pulse train is stopped. This is happening when I start the task associated to the digital port.
    My question is: it is possible to create a channel on the digital lines without altered the channels created for the counters?
    Another thing what I manage to see using the  "Measurement & Automation Explorer" and Test panels for PCI-6602, basically is the same thing, I generate pulse train on the output of the counter 7 and try to start a task on the digital line, but I get one error :
    "Error -200022 occurred at Test Panel
    Possible Reason(s):
    Measurements: Resource requested by this task has already been reserved by a different task.
    Device: Dev4
    Terminal: PFI8"
    Instead if I use the counter 0 or counter 1 to generate pulse train I don't encounter the same problem.
    Which resources are used by the counters 2 to 7 from the PCI-6602 board and the counters 0 and 1 do not use?
    Thank in advance for any replies!
    Ciprian
    Solved!
    Go to Solution.

    Hello Jordan, thank you for your reply.
    I am sorry but I can not see or run your example, I don't use LabView, I use Visual C++ for developing.
    Here is the code for generating the pulse train:
    GeneratePulseTrain(unsigned long ulCount1, unsigned long ulCount2)
        short nStatus = 0;
        nStatus = DAQmxCreateTask("",&m_taskHandle);
        nStatus = DAQmxCreateCOPulseChanTicks (m_taskHandle, "Dev4/count5", "", NULL, DAQmx_Val_Low, 0.0, ulCount1,ulCount2);
        if( bTriggerMode == true) // if hardware trigger is enabled
            nStatus = DAQmxSetTrigAttribute (m_taskHandle, DAQmx_ArmStartTrig_Type, DAQmx_Val_DigEdge);
            nStatus = DAQmxSetTrigAttribute (m_taskHandle, DAQmx_DigEdge_ArmStartTrig_Edge, DAQmx_Val_Rising);
            nStatus = DAQmxSetTrigAttribute (m_taskHandle, DAQmx_DigEdge_ArmStartTrig_Src,"Dev4/PFI17" );
        //set the internal timebase
        nStatus = DAQmxSetCOCtrTimebaseSrc(m_taskHandle,"Dev4/count5","20MHzTimeBase" );
        nStatus = DAQmxStartTask(m_taskHandle);
        return nStatus;
    And the code where I try to set the digital line:
    SetChannelState(short nState)
        short nStatus = 0;
        uInt8 wrtBuf0[1]={0};
        nStatus = DAQmxCreateTask("",&m_taskHandle);
        // Configure line as output 
        nStatus = DAQmxCreateDOChan (m_taskHandle, "Dev4/port0/line0", "", DAQmx_Val_ChanPerLine);
        nStatus = DAQmxStartTask(m_taskHandle);
        wrtBuf0[0] = nState;
        nStatus =DAQmxWriteDigitalLines (m_taskHandle, 1, 0, 0, DAQmx_Val_GroupByScanNumber , wrtBuf0, NULL, NULL);
        nStatus = DAQmxWaitUntilTaskDone(m_taskHandle,10);
        nStatus = DAQmxStopTask(m_taskHandle);
        nStatus = DAQmxClearTask(m_taskHandle);
        m_taskHandle = 0;
        return nStatus;      

  • How do I configure a counter to generate pulses using DAQmx?

    How do I configure a counter to generate pulses using DAQmx?
    Is says in the DAQmx C reference help
    "CtrnInternalOutput—The signal at this internal terminal is where the pulsed or toggled output of the counter appears. The output of a counter pulses or toggles when the counter reaches terminal count. When counting down, the counter reaches terminal count when the count reaches zero. When counting up, the counter reaches terminal count when the counter rolls over. To configure the counter to toggle or generate pulses, use the Export Signal function/VI with Counter Output Event as the signal name."
    I've tried this but can't get it to work, I may have the parameters wrong or something. The DAQmxExportSignal() function is very unintuitive to me. Here is my counter config code...
    int ret = 0;
    ret = DAQmxCreateTask("",&task_);
    errorMsg(ret);
    if (ret != 0)
    throw ret;
    // Configure the counter
    ret = DAQmxCreateCOPulseChanTicks( task_, "Dev1/ctr0", "", "/Dev1/PFI8", DAQmx_Val_Low, 0, divider, divider );
    errorMsg(ret);
    ret = DAQmxCfgImplicitTiming( task_, DAQmx_Val_ContSamps, 1000 );
    errorMsg(ret);
    // Change to pulse mode
    ret = DAQmxExportSignal( task_, DAQmx_Val_CounterOutputEvent, "/Dev1/Ctr0InternalOutput" );
    errorMsg(ret);
    // Start the counter
    ret = DAQmxStartTask(task_);
    errorMsg(ret);
    The above code works fine, in toggle mode, if I just comment out the DAQmxExportSignal() part.
    HELP!!!
    Stefan

    The problem is due to the DAQmxExportSignal call.  By default, when you create a counter output pulse train task, the driver will automatically set the output of the counter to toggle when the count for each high ticks and low ticks expire.  The driver also automatically routes the signal present at Ctr0InternalOutput terminal (the output of the counter internal to the device) to the Ctr0Out terminal (the I/O pin available externally).  Using the line
     ret = DAQmxExportSignal( task_, DAQmx_Val_CounterOutputEvent, "/Dev1/Ctr0InternalOutput" );
    will tell the driver to tristate the Ctr0Out terminal and not output the signal to the external I/O pin.  Using the DAQmxExportSignal function is generally only useful if you want to route the signal to some other terminal internal to the board without having the output show up on the external connector, route the signal to some other external pin other than the default pin, or if you want to have the output show up at multiple locations. 
    If you want to change the output behavior from toggle to pulse, you need to use the DAQmxSetExportedCtrOutEventOutputBehavior function.  However, this is generally only useful if all you care about are edges (not the duty cycle of the pulse train), and you want to generate higher frequency signals.  For example, with a 20 MHz timebase as the source of your counter, you can only generate a 5 MHz pulse train by default.  This is because the minimum value for the low and high ticks parameter is 2 (20 MHz / 4 = 5 MHz).  By changing the output behavior form toggle to pulse, you can generate a pulse train at 10 MHz since the output is now pulsing instead of toggling.  However, the width of each pulse is not programmable so you will no longer have a 50% duty cycle signal.  I don't remember exactly what the width of each pulse is, but I believe it's in the neighborhood of 50 - 100 nanoseconds in width.  I hope this information helps.

  • Can I generate pulse trains on more than one counter output at the same time?

    I have a PCI 6601 card with a BNC 2121 to connect the signals to two devices. The card is used as a trigger for both devices and I want to be able to generate pulse trains on two output channels at the same time, with a time delay between the two. How do I do that in Labview 7.1 Development with DAQmx?

    I feel foolish for not being able to figure this out, but it still doesn't work. Attached is the VI I use now. Counter 0 generates a finite pulse train and I programmed Counter 1 to generate a retriggerable single pulse triggered by CtrOinternaloutput. I still get the same error message: -50103 The specified resource is reserved. The operation could not be completed as specified.
    The same happens if I set the trigger for counter 1 at PFI36 (default output of counter 0) or any other PFI line. If I try a pulse train generation on only one of the counters, both work fine.
    If I try the example in traditional DAQ for multiple counter outputs with phase delay, it works fine.
    Can you tell me what I'm doing wrong?
    Attachments:
    Shutter_AND_lamp_trigger.vi ‏103 KB

  • Generated Pulse waveform is distorted when I deliver the signal to the output port in the DAQmx

    Problem: Generated Pulse waveform is distorted when I deliver the signal to the output port in the DAQmx.
    Environment: Windows XP sp3 (32bit), Visual Studio 2010 sp1, NI-Measurement Studio 2010
    Device: NI - DAQmx PCI 6251
     Analog Input: 1.00MS/s multi-channel (aggregate)
     Analog Output: 2 Channel 2.00MS/s
    Reference Example: AO_ContGenVoltageWfm_IntClk / AI_ContAcqVoltageSamples_IntClk
    Generated Pulse:
    1) AO0 = Square Waveform /0-5V / 8KHz / 0.5㎲/sample / sample 50% Duty
    2) AO1 = Square Waveform /0-5V / 8KHz / 0.5㎲/sample / (Reverse Image)
    Description: I’d like to deliver the waveform stream satisfied with specified constraints to the 2 channel output port in the DAQmx. To verify accuracy of the generated waveform, I did an electrical wiring from the Analog output channel (2 channels) to the Analog Input channel (2 channels) in DAQmx. As a result of this experiment, I could get a result which has signal distortion. Since the waveform has to satisfy with both high frequency (8KHz) and very short moment interval time (△t = 0.5㎲/sample) between samples, I cannot handle some parameters of the function in the referenced VC++ example. Following formulas shows an approach to deliver the generate pulse waveform to output port satisfied with constraints.
    Analog Output Channel
     Frequency = 8,000 cycles/sec (constraint)
     Sample per Buffer = 2,000,000 = 2*106 samples/buffer
     Cycles per Buffer = 80,000 cycles/buffer
     Sample per Channel = 1,000,000 = 1*106 samples/channel
     Sample Rate  = Frequency * (Sample per Buffer / Cycle per Buffer)
                              = 8,000 * (2*106 / 80,000) = 2*106 samples / sec
     △t  = 1 sec / 2*106 samples / sec
               = 0.5 * 10-6 sec/sample (constraint)
     Buffer Cycle  = Sample Rate / Sample per Channel
                              = (2*106 samples / sec) / (1*106 samples/channel)
                              = 2 channel / sec
    Analog Input Channel
    Sample per Channel = 1,000,000 = 1*106 samples/channel
     Sample Rate  = 1 MS/s * (2 Channel) = 5 * 105 Samples / Sec
    Program Code
    AO_ContGenVoltageWfm_IntClk / AI_ContAcqVoltageSamples_IntClk (VC++ Example)
    Result: The proposed approach was implemented in the experiment environment (VS2010, MStudio2010). As shown in Figure 1, we could get the unsatisfied result. Although I intended to make a ‘square’ pulse wave, the result looks like ‘trapezoid’ pulse wave (Figure.1). However, there is other result which was undertaken with different parameter condition. It looks like the square shape not the trapezoid shape.
    Please let me know what the conditions make the problem of signal distortion. (AO0 = Green line / AO1 = Red line)
    [Figure. 1] Frequency 8000 Hz / Cycle per Buffer = 8000 Result
    [Figure. 2] Frequency 1000 Hz / Cycle per Buffer = 1000 Result
    Questions: Please let me know following questions.
    1) Is it possible to deliver the generated pulse wave satisfied with constraints (f= 8KHz), △t = 0.5㎲/sample) to the output port without distortion using PXI 6251?
    (Is it possible to solve the problem, if I use the LabView or MAX?)
    2) Are there some mistakes in the proposed approach? (H/W or S/W program)
    3) What is the meaning of the Cycle per Buffer?, It could effect to the result?

    Hi Brett Burger,
    Thanks for your reply. For your information, I have set the sampling rate as 10000 as for the sound format, I have set the bits per sample as 16 bit, the rate as 11025 and the sound quality as mono. I tried using your method by changing the sampling rate as 8K but still my program encounter the same problem.
    I wish to also create a button that is able to generate a preformatted report that contains VI documentation, data the VI returns, and report properties, such as the author, company, and number of pages only when I click on the button.  I have created this in my program, but I am not sure why is it not working. Can you help troubleshoot my program. Or do you have any samples to provide me. Hope to hear from you soon.
    Many thanks.
    Regards,
    min
    Attachments:
    Heart Sounds1.vi ‏971 KB

  • Using a SCC counter pulse train to control a SCC digital out signal

    I am trying to send a digital high signal on a SCC-Digital ouput module for a certain number of pulses generated by a SCC-Counter/timer pulse train. I have found examples of how to route such signals through PFI12 etc on an M-series board but I am trying to achieve this without referring to the card, just the SCC modules themselves.
    I cannot find a way to use the sample clock from the counter generated pulse train to synchronise the digital output.
    Is there any way I can do this without referring to the connected M-series DAQ card channels?
    Thanks in advance for your assistance.
    Cheers.

    Hi Phil,
    The SCC carrier is only conditioning your signals (i.e. if your signals are not in optimal ranges, bandwidth or need external excitation). The actual counters and all digital lines are controlled directly by the M-series board. This means you will never be able to refer to a counter in the SCC module.
    If you route the signals of the M-Series board, is as if you had done so externally from the SCC. Look at this example and might give you more insight to how to implement it (This is software timing). The hardware timing would be doing correlation DIO. Here is an example that needs to be modified to adapt to your timing: http://zone.ni.com/devzone/cda/epd/p/id/4414
    Hope this helps,
    Yardov
    Gerardo O.
    RF Systems Engineering
    National Instruments
    Attachments:
    Finite Dig Output High.vi ‏31 KB

  • Problem using counter to generate gate signal

    Hello,
    Is there a way to have a counter output a logical high for n input pulses and a low for the rest of the time? I am running into problems implementing this simple task due to idle-state behavior of CreatePulseChannelTicks and CreateCountEdgesChannel.
    The output of the counter is used to gate the device that generates the pulses that are being count. As long as the gate is 'low', no pulses are generated. I run in the following problem:
     When I configure a counter with CreateCountEdgesChannel and use ExportSignals.ExportHardwareSignal to export the 'CounterOutputEvent', the initial state of the output is low. However, I need it to be high to start pulse generation.
     When I configure a counter as a one-shot pulse generator, I have to configure an idle state, delay-, high- and low-count. I tried two combinations:
    idle state low, delay 0, in high the pulse count I want, and low-count very high. However, despite the 'delay=0', the initial output state is low. Thus, my device does not start generating pulses.
    ide state high, delay set to the number of pulses I want, and low- and high-count very high. This does generate the desired gate signal. However, when I stop the counter task, the gate is set 'high' and my device again starts generating pulses. This is undesirable.
    Is there a way to set the IdleState when using CreateCountEdgesChannel? Is there a way to have daqmx to ignore the initial delay and immediately start with the counter output in the inverted IdleState?
    Thanks,
    Maarten van Kampen

    Short update:
    I found the method to set the IdleState when using CreateCountEdgesChannel: .ExportSignals.CounterOutputEventIdleState = CounterOutputEventIdleState.High.
    Howerver, now I run into the same problem with CreateCountEdgesChannel as with CreatePulseChannelTicks: when stopping the task, the output of the counter is always set high. And I want it to remain low when stopping the counter.
    Regards,
    Maarten van Kampen

  • Can some body help me to develop labview code for generating pulse to drive ac servo motor

    can some body help me to develop labview code for generating pulse to drive ac servo motor... i am using NI 9401 card ....tnx

    Driving an AC servo motor would (I missed AC on the previous msg) requires some complex hardware. This is generally done by drivers specifically designed for this purpose. I doubt you will be able to accomplish this with the hardware you currently have and it might be cheaper to just buy a driver for it and control the speed through the driver.

  • How can I generate pulse trains whenever the value of the gate changes?

    I need to generate pulse train both at the rising edge and falling of the gate signal. My DAQ board has only two counters.
    Have a nice day,
    Jun

    Jun;
    As your DAQ board has only two counters available, I'm assuming you are working with either one of the E-series board or SMIO boards.
    If that is the case, your board doesn't have the capability of generating triggered pulse trains. And that is what you need.
    You will need to use the 660x family instead. Those boards have the trigger pulse train capability. Regarding the second part of your application; none of the DAQ boards has the capability of triggering a pulse train generation at both rising and falling edges of the same trigger pulse. You can configure either as rising or falling edge of the trigger pulse. Then, to accomplish wath you need, you will need to configure two counters, both having the same trigger pulse triggering a pulse train gen
    eration, and one configured to trigger the pulse train at the raising edge of the trigger pulse and the other to trigger at the falling edge of the trigger pulse; then have an external OR Gate which the two inputs are the outputs of those two counters.
    Hope this helps.
    Filipe

  • Generate PULSE TRAIN VI & Measure Frequency VI

    Can I RUN both Generate pulse train VI and Measure Frequency VI without either slowing down? Is Generate pulse train VI same as generate PWM VI? I have only attached the generate pulse train VI as I can only attached one file at a time.
    Attachments:
    Generate Pulse Train VI.vi ‏15 KB

    Hi labview1958,
    This depends on the kind of frequency you'd like to generate, and the range of frequency you'd like to measure. You didn't mention the kind of hardware and software (version) being used, so I'll assume you're using an E Series DAQ device and programming in LV 7.1. If you're generating a continuous pulse train, only one counter is required, hence there should be another counter available (for most DAQ devices). If you're generating a finite pulse train, two counters are required, and there'll be no counter available for frequency measurement. Also, frequency measurement can use one or two counters depending on the frequency range. You can find LV shipping examples (Help >> Find Examples) for both pulse train generation and frequency measurement. These make a good starting point for your development. In the case that you don't have a counter available for frequency measurement, you can also use the "Extract Single Tone Information" VI to measure the frequency in software.
    These tutorials will provide more details:
    Generating a Pulse Train with a Counter
    Making Accurate Frequency Measurements
    Hope this helps,
    Lesley Y.

  • Generate Pulse Train.vi

    I am updating a legacy application using LabView 5.1 and the DAQCard-500.  I have NI-DAQ ver 6.9.3 installed.  I installed NI-DAQ after LabView.  I have no other versions of LabView installed on this machine.
    I am using the generate pulse train.vi and get the following error message:
    Error -10403 occurred at CTR Group Config.
    Possible Reasons:
    NI-DAQ LV: The specified device does not support the requested action (the driver recognizes the device, but
    the acion is inappropriate for the device).
    Looking a bit deeper I see that CTR Group Config is called in a subvi of Generate Pulse Train.vi but I do not understand why I would get the error message on the presumption that the Generate Pulse Train.vi is matched to the DAQCard-500.
    Where might I be going wrong?
    Is there a definitive way to know if I am using the correct .vi for the DAQCard-500?
    How could I troubleshoot this further?
    I have attached a .jpeg snapshot of the vi call just to show how I have wired the inputs.
    Thanks in advance,
    Bernie
    Attachments:
    Pulse Train Snap.jpg ‏10 KB

    Ok the next thing to check is whether you can successfully access the board from the test panels inside MAX. If that works, I would try to find an example that sort of does what you are wanting to do and see if it works. If that works, start comparing the example code to the VIs that are in your example.
    Mike...
    Message Edited by mikeporter on 06-05-2007 08:32 PM
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Measure pulse width and generate pulse depends on the width

    Hi,
    i have a serias of pulses ... 600 micro,30 micro,30 micro (around 10 times) ........ nothing for 1 mili second ..
    so i need to generate a pulse after the first pulse arrives ... (its width around 600microSecond)
    1. use the first counter to measure the pulses ...
    2. if arrived pulse ... 500microSecond<the pulse width<700microSeconds .... then generate pulse with second timer ....
    the problem is that i dont want to use the while loop inside the labview ...
    can i programm the counters to make the width calculation and if the width is bigger to generate trigger to the second counter .... ?
    the hardware is 6014 sample card ....
    thanks
    gena
    (see attached)
    Attachments:
    F0087TEK.JPG ‏27 KB

    Hi Gena,
    I am assuming you are using the DAQmx drivers in LabVIEW for your
    PCI-6014.  Avoiding a While loop may be difficult if you need to
    perform this measurement many times and you might not know when the
    signal is going to begin.  Without a While loop, you'll have to
    set up your timeout period long enough so the pulses will begin before
    your VI stops.
    With this in mind, you may want to look at some of the shipping
    examples with the DAQmx driver.  You can find these in LabVIEW's
    Help menu by going to Find Examples.  For measuring the pulse
    width, browse the folders in the Example finder by going to Hardware
    Input and Output>>DAQmx>>Counter Measurements>>Period
    or Pulse Width.  In this folder, there is the Meas Pulse Width.vi,
    which measures the pulse width once and stops.  You should be able
    to take the pulse width measurement you get from here and check to see
    if it's in your range, then output a pulse on the other counter if it
    is in the range.  The pulse output examples can be found in
    Hardware Input and Output>>DAQmx>>Generating Digital
    Pulses>>Gen Dig Pulse.vi.
    Thaison V
    Applications Engineer
    National Instruments

  • Using SQVI to generate report of open and released delivery schedule lines

    All,
    I'm using SQVI  to generate an excel spreadsheet for some buyers to show open released schedule lines because they are a 1 line item per scheduling agreement company.
    I used the logical database MEPOLDB instead of a table joint and pulled fields from EKKO(vendor, SA #,&purchasing group), EKPO(Material Number), EKEH(schedule line type), and EKET(delivery date, scheduled qty,previous qty).
    Does this sound like I'll get the results I want on paper as long as I use the right selection criteria, because the report I'm getting isn't quite what I expect? I am unable to identify which lines are authorized to ship vs. trade-off zone, planning, etc. in the report thus far.

    Hi Mark,
                 I have faced same requirement. I am not sure about transporting to TST and PROD. I done by this way.
    After generating SQVI program in DEV , I assigned that program  to a transaction and tested in DEV. Later i have regenarated SQVI in Production. then I assigned the generated Program to same transaction in DEV. And transported the Tcode assignment of program to Production..
    About authorization , if its not sensitive report, BASIS can restrict at transaction level.
    Regards,
    Ravi.

  • I want to use the Function Generator VI to send command signals through the NI 7344 motion controller. This will be a closed loop servo valve system. I want to be able to change from say a square wave to a sine wave on the fly. Idea's?

    I am going to run tests that require an actuator to move using various types of arbitrary waveforms such as sine or square. The NI 7344 is hooked to the UMI that is going through a driver for a servo valve. The loop is analog and it is closed. I have played with some of the examples but can't get it to work. I have used the function generator VI to generate a signal but I think I am using the wrong input VI to the motion control board. When I use what I have it moves the servo and then stops. It doesn't continually generate the signal.
    I would love to use the controls on the function generator vi to control frequency and amplitude ect. Any help or pointer would be helpful. Thank you in advance.

    Hello,
    I'm not clear on exactly how you want to use the generated data but I'm assuming they will be used as your target points.
    There's a built-in example for motion called 'One-Axis Contour Move.vi'. This example demonstrates how to provide your target points as 1-D array. All you need to do is to replace the input array with the output of the function generator. In order to have it run continuously, use a while loop. You can further program your application so that it'll change the waveform on the fly by monitoring the user interface but this might be little little tricky as you will need to reset the move and load the new generated points while keeping track of your current position.
    I hope this helps. Let me know if you have further questions regarding this
    application.
    Best regards,
    Yusuf C.
    Applications Engineering
    National Instruments

  • Using mathscript to generate multiple digital outputs for switch control

    Hello 
    I am new to this NI LV and a have kind of a basic question. I would like to use Mathscript to generate an array of bolean numbers which will be used to control the Digital I/O lines. I am using NI 6251 USB device and the Mathscript code runs well. But I have a problem using this array to control the Digital output. So I created a simple test programme where I set the DAQ assitant to generate 4 digital outputs(P0.0 ~ P0.3) and it gives error that  ".. number of channels in the data does not match the number of channels in the task..." (see attachment) . How can I solve this problem thank you.
    Attachments:
    K-9.jpg ‏36 KB

    looks like you did not initialize all 4 of the elements in the bool array....

Maybe you are looking for