NI FGEN problem

Hello, All!
We using the NI-5411 PCI arbitrary waveform generator board in our
laboratory. My application written in LabView requires to send pulsed
signals periodically. To do that I use an arbitrary sequence mode with
software trigger for AWG programming. I use the internal LabView "Wait until
next" function to control of repetition time . Actually, I'd like to send
next pulse after a short time after the previous one. Which way I can know
about actual AWG status during playing? Can write new waveforms into AWG
memory immediately after previous play finished? Can I make this
programmatically in LabView environment?
Thanks,
Sergey Yakovlev, Berlin,
[email protected]

Thank You for reply.
When i put this sequence into WHILE or FOR loop and try to run the app step by step, it finishes without errors, but Oscilloscope blocks have no acquired samples on theirs outputs.
I'm using oscilloscope channel 1 as a trigger source in the first and the third Oscilloscope.vis. In the second block I'm using immediate triggering mode, because I just need some timeout between two measurements. Maybe this is not the best way to do it, but it is not so necessary. I've connected FGEN pin on prototyping board to BNC 1 and BNC 1 to SCOPE CH1. 
As I said, my app without loop, after turning on continuous execution, runs some number of iterations and then unexpectedly stops with error.
However, I prefer running my application in a loop to doing this by continuous execution.
I try do to this, because i need to repeat this sequence of measurements multiple times just to watch changes in average value of resistance that is calculated in the first frame of sequence.
I've written another application, that is a little bit simpler. Maybe this would be better than the first. SCOPE configurations are the same as in the first application. 
Attachments:
Untitled 11.vi ‏301 KB

Similar Messages

  • NI-FGEN Problems in TestStand using IVI Calls

    Hello:
    I have a problem. When using a 5411 under TesStand, making IVI calls the 5411 O/P is distorted when I configure it to O/P a simple Waveform ( 1.544 MHz, 5Vp-p 0V DC Offset). The same setup using either a CVI application utilizing the function panel or the soft front panel yields a fantastic O/P. If I can not make IVI calls from TestStand then what is the use?
    Help.... Very fruntrared and on a deadline
    cheers...

    Hello Craig -
    I've quickly looked over the CVI IVIclass demos including the quick bit of Fgen code, if you run this project and monitor the output in MAX you are seeing good results? If so, yes I'd check the settings in your IVI steps in TestStand. (If you haven't seen it yet try \CVI\samples\iviclass\fgen.prj)
    CVI also ships with function-by-function class help files which on my machine are located at C:\vxipnp\winnt\niivi\Help, I point this out since the demo sequence for IVI in TestStand makes a direct DLL call to set up the soft front panel as a non-interactive window... there are a few other cases where features of the driver are not accessible just by editing the step properties, but that is across the board, so again if it worked in CVI it should work here.
    I'm going to attach a quick little TestStand sequence (written for TS 2.0.1f1 the current release) to this project as a way of you just loosely troubleshooting, all it will do is launch the soft front panel and use the controls to try and set up your waveform... Try it once with the simulated instrument, or just go straight to altering the FileGlobal variable to point to your logical name and tell me if you get better or worse response?
    To alter the internals of the call to hardware right-click on the second step and choose 'edit Fgen'... you may want to examine your clock, the channel settings and extensions to make sure anything you configured in your code is configured here... The only thing I am still unsure of is whether you were using the default sine waves or if you were definining something arbritrary, the 5411 does have the ability to set sample counts/ waveform size /sampling rate. You may want to try setting your Arb SampleRate higher, or fall back on a quick DLL call to set some attributes manually if you can't access them any other way.
    You can use the IVI operation "get Information" on a particular logical name to aquire the current/default settings of your instrument.
    Below is some text I extracted from a LabVIEW example (I don't know how useful the actual code will be, but perhaps this is the cause of your undersampled data?) Jitter can also be a symptom of undersampling. I will try and check with the hardware team for you and post if I have any other ideas...
    -Regards
    Elaine R.
    National Instruments
    http://www.ni.com/ask
    --Extracted from an example "Generating Segments of Larger Waveforms with the NI 5411" --
    >>To set up sample counts, pass the array of sample counts you want to use to create a new arbitrary sequence. The array must have at least as many elements as the value you specify in the Sequence Length parameter. Each Sample Counts array element corresponds to a Waveform Handles array element and indicates how many samples of the given waveform to generate. Each element of the Sample Count array must be larger then the minimum waveform size and a multiple of the waveform quantum. You can obtain these values by calling niFgenQueryArbWfmCapabilities.
    For the NI 5411, you can use a minimum of 256 Sample Counts, with a quantum of 8, which is the same as creating a waveform for the NI 5411. The other restriction is that you cannot use a number greater than the number of samples in the waveform.
    In terms of use, the NI 5411 only generates the number of samples that are indicated by the Sample Count number regardless of how many actual samples are in the waveform array downloaded to the NI 5411.
    Attachments:
    fgen.seq ‏50 KB

  • IVI FGEN problems with HP 33120A

    Hi,
    I'm trying to control a HP 33120A using IVI through CVI. The basics work
    well, but when I try to do arbitrary waveforms of amplitude modulation if
    get errors.
    I have include the code snipets with error handling removed for brevity.
    Unfortunately I can not find a sample with either of these two cases, and
    the error codes do not shed any lights. I have looked at the IVI.h file and
    documentation to try and get more insight but I'm hitting a brick wall.
    I would appreciate any examples/solution even partial.
    Cheers
    Peter
    // Snipet of code for ARG gen.
    iError = IviFgen_AbortGeneration (instHndARBGen);
    iError = IviFgen_ConfigureOutputMode(instHndARBGen, IVIFGEN_VAL_OUTPUT_ARB);
    iError = IviFgen_ClearArbWaveform (ins
    tHndARBGen,
    IVIFGEN_VAL_ALL_WAVEFORMS);
    // returns an error of 0xBFFA2006
    iError = IviFgen_CreateArbWaveform (instHndARBGen, NPoints, Values,
    &hWaveForm);
    iError = IviFgen_ConfigureArbWaveform(instHndARBGen, "1", hWaveForm,
    Amplitude, 0.0);
    iError = IviFgen_InitiateGeneration(instHndARBGen);
    iError = IviFgen_EnableOutput(instHndARBGen, "1");
    // Snipet of code for Aplitude Modulation
    iError = IviFgen_AbortGeneration (instHndARBGen);
    iError = IviFgen_ConfigureOutputMode (instHndARBGen,
    IVIFGEN_VAL_OUTPUT_FUNC);
    // returns an error of 0xBFFA0010
    iError = IviFgen_EnableAM (instHndARBGen, "1", IVIFGEN_VAL_INTERNAL);
    iError = IviFgen_ConfigureAMInternal (instHndARBGen, Depth,
    IVIFGEN_VAL_WFM_SQUARE, FrequencyModulation);
    iError = IviFgen_InitiateGeneration (instHndARBGen);
    iError = IviFgen_EnableOutput (instHndARBGen, "1");

    Hi,
    I guess the two instruments have a similar command set. I am also guessing that you are using the standard VISA type instrument driver for the 33120A and not the IVI.
    You will have to switch of the Query because the query string returned will have 33120A related text. This should get you passed the Initialisation.
    Have you not tried Agilent web site for a HP1441A driver?
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • I'm getting an error Starting up FGEN-SFP

    I'm getting an error starting up NI-FGEN Soft Front Panel v1.4. On the splash screen that starts up with the application, in the midst of loading NI configuration manager, the following error appears: "NI-FGEN for DAQ 2.0.0 or higher was found, but it could not be loaded. To run this software you need NI-FGEN for DAQ 2.0.0 or higher"
    I'm running on Win 2000.

    It sounds like there may have been a problem with the NI-FGEN install. I would suggest re-installing the NI-FGEN driver and seeing if that clears up the error.
    Here is the link to the 2.1 driver.
    NI-FGEN Version 2.1 for Windows 2000/98/ME/NT/XP
    NI-FGEN Version 2.2.1 for Windows 2000/NT/XP
    EvanMessage Edited by Molly K on 02-18-2005 11:58 PM

  • Downloading correct version of NI-FGen

    Am trying to download NI-FGEN v2.0. I'm starting at the correct location (i.e., http://digital.ni.com/softlib.nsf/websearch/49B4D2E501A1315886256D8600728463?OpenDocument&node=)
    When I try to download the file, I'm directed to here:
    (ftp://ftp.ni.com/support/instr_drivers/multienv/ivi/windows/current/library/ivifgen/ni-fgen.exe)
    which is version 2.2.
    How do I get to version 2.0?
    Thank you.

    I can definitely see that there is a link problem here. I'll make sure to report the problem so that it gets fixed... thanks for letting us know.
    I would suggest the latest version of the driver (2.2) in most cases, but if you would like version 2.0 of NI-FGEN, I have put a copy of it on our ftp site (NI-FGEN 2.0 Web Installer.zip):
    ftp://ftp.ni.com/outgoing/
    Best Regards,
    Jeremy R.
    Applications Engineer

  • Fgen by duration, am I missing something

    Hello all,
      First time posting but have found many good solutions here.  Anyway, I have been wrestling with the Fgen by Duration vi and have seen many discussions about this.  I opened the vi added a graph to the front panel and ran it after looking at the diagram.  When looking for a ramping solution, duration has nothing to do with the ramp on this vi other than change the output ramp rate.  Am I missing something in my code?  Best I can tell, duration only pertains to the number of COMPLETE cycles of a wave given as an output for a given sample amount.  IE  Sample rate=100 duration=1 gives one complete cycle of a wave with 100 pts in that cycle,  keeping the samples the same, increasing duration to 2, gives 2 complete cycles with 50 pts per cycle and so on.
      I have tried to find an simple way around this problem by I think using the ramp.vi in combination with slope calcs and loop may be an easier solution.
      Basically I am needing a vi to go from a min (n) to some max (n+#) in x seconds.
    Any thoughts,
    M. P.
    Attachments:
    ramp tester.vi ‏98 KB

    Hi,
    It's sounds like what you want is to be able to specify a number of points per cycle, rather than the number of points for the entire signal.  If you have code which allows you to specify the number of cycles and a total number of point, all you have to do is compute a new total number of points, which in this case is just your current number of cycles*your current number of points.  That way you get your current number of points for EACH cycle.
    Does this answer your question?
    AG

  • HI, I'm having problems initializi​ng object for CNiFgen class.

    Hello, I'm having problems initializing object for CNiFgen class, I declare a pointer *m_pFgen to the CNiFgen class, then m_pFgen = new CNiFgen(m_driver, true, true) and then it gives me an error message Primary Error: (Hex 0xBFFA000C) Invalid attribute.

    Here is how to make a call to initialize a session to niFgen:
    //Create a new session on the device
    _session = new CNiFgen(m_resourcename);
    Also. I'm attaching an example on how to generate standard waveforms with the class interface for Fgen.
    Let me know if you have any other questions,
    Jack Arnold
    Applcation Engineer
    National Instruments
    Attachments:
    niFgen_Function_Generator_Ex.zip ‏5569 KB

  • NI-FGEN Arb Express Responsiveness

    Hi,
    I am trying to play around with the NI-FGEN Arb Express VI (with NI PXI-5421) in order to learn how to create my own VI to generate arbitrary pulses.  However, I am finding that when I click "Run" in the express window, my o-scope never seems to receive the waveform properly.  I am using the sample sine wave, and when I click "Run" with it set to "Start Continuous" the o-scope screen will update several seconds later with a fragment of a sine wave, and it does not continuously update.  The Test Panels for the 5421 work fine with the o-scope, so I am not sure what is going wrong.
    Any help is appreciated.
    Thanks,
    Billy Maier
    EDIT:  Never mind, the problem resolved itself.  I'm not sure how to delete threads.
    Solved!
    Go to Solution.

    Glad to hear that you found an answer to your probem, one additional piece of advice is to move beyond the express VIs as quickly as you can. The simplified interface they provide comes at a price. Banely, these VIs will nake assumptions that don`t always work in your favor.
    Mike...
    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

  • PXIe-5122 triggering problem

    I have some problem in triggering the signal in my scope. I use PXIe-512214-bit 100MS/s Digitizer. What I did is I route Board Clock to RTSI0 and then in niScope Configure Triger Digital.vi, I use RTSI0 as the trigger source. But it always reported error "Source terminal to be routed could not be found on the device"and Destination Terminal is: PXI_Trig0. When I route RTSI clock to RTSI0, program runs, but the scope does not show any signal. What should I do now? Do you have any suggestions? Thank you very much

    Hi, Tunde
    Thanks for your reply. I am only using PXIe-5122 for Impedance Analyzer Software. Right now the scope has some problem in getting the signal. It always shows "Insufficient Signal Level on Reference Signal Increase: FGEN Amplitude". What I did is to route Board clock to RSTI0 using niFgen Route Signal Out.vi and then in niScope Configure Trigger Digital.vi I use RTSI 0 as trigger source. But it always reported error "Source terminal to be routed could not be found on the device"and Destination Terminal is: PXI_Trig0. I also tried routing RTSI clock to RTSI0, program runs and again it shows "Insufficient Signal Level on Reference Signal Increase: FGEN Amplitude". I am right now quite confused about what could be the problem. Attached is the code. The change that I made is in Initialize Scope.vi and Initialize Function Generator.vi. Thanks!
    Attachments:
    Impedance Analyzer Software June 2012.vi ‏419 KB

  • NI-FGEN to trig NI-DMM

    Hi
    I have to stimulate a circuit with a 200Hz square signal (NI-PXI5421 waveform generator), but only with 3 periods, after that I have to wait a little and then repeat it a couple of times. The task is to measure the response of the circuit with a NI-PXI4070 DMM, but I can’t figure out how to synchronies the two devices, so that I measure when the 3 pulse are applied. It seams as a standard operation but it is not working for me, is there anybody that has a suggestion to solve my problem??
    Thanks
    Funding

    Hi Funding
    This is indeed possible by using NI-TCLK. There is an example showing this but its using NI-SCOPE instead of NI-DMM. Using the Scope is more appropriate but as I said its possible to use the DMM's too. The example is shown here. This example is based on two examples installed with LabVIEW when NI-FGEN and NI-Scope was installed. You would have to find the NI-Scope example and see what changes that are implemented. You should find an appropriate example from NI-DMM and implement that in the above given example. I would recommend you look at the examples doing continuous acquisition either in the triggers or multi-point measurements folder.
    Regards
    Mohadjer, NI-DK

  • NI-FGEN 2.0 not working with IVI 2.1

    I just installed NI-DAQ 7.1 with the included IVI Compliance Package 2.1. Now when I try to install NI-FGEN 2.0, it complains that the IVI Compliance Package 2.0 or higher must be installed. Do I need to downgrade my IVI to make FGEN happy?

    From IVI 2.0 to IVI 2.1, the format for the registry keys was changed. One of these keys holds the version of IVI that is installed. The NI-FGEN, NI-SCOPE, and NI-HSDIO Web Installers all look at that particular key.
    The drivers work fine with IVI 2.1, and with the CD Installers shipped with the boards. It is only a problem with the Web Installers.
    The developers are currently working on a fix to the web installers, and I will post here again once those are available for download over the Web.
    The following is for people who cannot wait for that fix, and are very familiar with computers and their operation:
    The registry key that the installers look for is located at
    HKEY_LOCAL_MACHINE\SOFTWARE\National Instruments\IVI\CurrentVersion
    and the key na
    me is Version. The Web installers are checking that it is 2.0.0 or higher. After installing IVI 2.1, you can edit the registry to say 2.0.0, install the Web Installers, and then edit it back to say 2.0 again.

  • Fgen : Synchronisation + Delay insertion

    Hello everybody !
    I have a PXI system in which I have a 5422 FGen allowing me to generate a "10 periods sinusoidal burst".
    The 5422 FGen also has the following connections : ch0 ; Clk in ; PFI 0 ; PFI 1
    I would like to insert a "timing reference" signal (in PFI0 e.g.) and generate my burst "x" ms later. Is there a function directly related to the fgen allowing to perform such a thing (synchro + delay) ? Do I have to use DAQmx possibilities (I must admit I am a little bit lost with the DAQmx functions ...).
    Here is the part of my code  where I assume I could insert the function I am looking for.
    Can anyone help me ? Thank you in advance !
     

    Hi Collin !
    Please find my answers in this post in green.
    Is there any way to connect the output to that oscilloscope? To verify with the same system if it gives the same output?
    Since the "NI TClk Initiate.vi" provides from using the "scope read.vi", this is quite tricky. I am forced to use the "scope fetch.vi" in order to collect data and this provides me only one frozen graph while the vi is running. However, it is already possible to see that the burst is not generated with a constant time delay from the original pulse, anyway.
    Also, if you only send the burst, so with no trigger and no original pulse, what is being displayed in labview?
    The expected burst, without any problem. May I add 2 things :
    1) The graph contained in the "actual" video is not in LabVIEW (but in Tomoview, the software used to control the DUT and to display the data).
    2) The burst observed in the video is rectified.
    To me it seems that the burst is not equal to the frequency of the original pulse, and thus generating time difference for display. But on the expected video it is. What do you think of this?
    Indeed, that's the problem. On the "expected" video, we used a tektronix generator synchronized via its "trigger channel" and that was it ! With NI material, triggering just seems to start the signal generation but it doesn't necessarily implies that the signal generated will be synchronized with the triggering signal, just like if a kind of "repetition frequency" should be tuned as well. If yes, how can we do this ?
    I think we should start to verify exactly what is being output on both systems and compare that. Also try to output only one and when those are correct lets try to synchronize them. But first verify without triggers and sync. if they output correctly.
    According to the answers above, I think the outputs are understood correctly and I would rather say there is a poor management of "triggering and synchronization" from my side ...
    What do you think ?
    Kind regards,
    Geoffrey

  • A problem with threads

    I am trying to implement some kind of a server listening for requests. The listener part of the app, is a daemon thread that listens for connections and instantiates a handling daemon thread once it gets some. However, my problem is that i must be able to kill the listening thread at the user's will (say via a sto button). I have done this via the Sun's proposed way, by testing a boolean flag in the loop, which is set to false when i wish to kill the thread. The problem with this thing is the following...
    Once the thread starts excecuting, it will test the flag, find it true and enter the loop. At some point it will LOCK on the server socket waiting for connection. Unless some client actually connects, it will keep on listening indefinatelly whithought ever bothering to check for the flag again (no matter how many times you set the damn thing to false).
    My question is this: Is there any real, non-theoretical, applied way to stop thread in java safely?
    Thank you in advance,
    Lefty

    This was one solution from the socket programming forum, have you tried this??
    public Thread MyThread extends Thread{
         boolean active = true;          
         public void run(){
              ss.setSoTimeout(90);               
              while (active){                   
                   try{                       
                        serverSocket = ss.accept();
                   catch (SocketTimeoutException ste){
                   // do nothing                   
         // interrupt thread           
         public void deactivate(){               
              active = false;
              // you gotta sleep for a time longer than the               
              // accept() timeout to make sure that timeout is finished.               
              try{
                   sleep(91);               
              }catch (InterruptedException ie){            
              interrupt();
    }

  • A problem with Threads and MMapi

    I am tring to execute a class based on Game canvas.
    The problem begin when I try to Play both a MIDI tone and to run an infinit Thread loop.
    The MIDI tone "Stammers".
    How to over come the problem?
    Thanks in advance
    Kobi
    See Code example below:
    import java.io.IOException;
    import java.io.InputStream;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.lcdui.Image;
    import javax.microedition.lcdui.game.GameCanvas;
    import javax.microedition.media.Manager;
    import javax.microedition.media.MediaException;
    import javax.microedition.media.Player;
    public class MainScreenCanvas extends GameCanvas implements Runnable {
         private MainMIDlet parent;
         private boolean mTrucking = false;
         Image imgBackgound = null;
         int imgBackgoundX = 0, imgBackgoundY = 0;
         Player player;
         public MainScreenCanvas(MainMIDlet parent)
              super(true);
              this.parent = parent;
              try
                   imgBackgound = Image.createImage("/images/area03_bkg0.png");
                   imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
                   imgBackgoundY = this.getHeight() - imgBackgound.getHeight();
              catch(Exception e)
                   System.out.println(e.getMessage());
          * starts thread
         public void start()
              mTrucking = true;
              Thread t = new Thread(this);
              t.start();
          * stops thread
         public void stop()
              mTrucking = false;
         public void play()
              try
                   InputStream is = getClass().getResourceAsStream("/sounds/scale.mid");
                   player = Manager.createPlayer(is, "audio/midi");
                   player.setLoopCount(-1);
                   player.prefetch();
                   player.start();
              catch(Exception e)
                   System.out.println(e.getMessage());
         public void run()
              Graphics g = getGraphics();
              play();
              while (true)
                   tick();
                   input();
                   render(g);
          * responsible for object movements
         private void tick()
          * response to key input
         private void input()
              int keyStates = getKeyStates();
              if ((keyStates & LEFT_PRESSED) != 0)
                   imgBackgoundX++;
                   if (imgBackgoundX > 0)
                        imgBackgoundX = 0;
              if ((keyStates & RIGHT_PRESSED) != 0)
                   imgBackgoundX--;
                   if (imgBackgoundX < this.getWidth() - imgBackgound.getWidth())
                        imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
          * Responsible for the drawing
          * @param g
         private void render(Graphics g)
              g.drawImage(imgBackgound, imgBackgoundX, imgBackgoundY, Graphics.TOP | Graphics.LEFT);
              this.flushGraphics();
    }

    You can also try to provide a greater Priority to your player thread so that it gains the CPU time when ever it needs it and don't harm the playback.
    However a loop in a Thread and that to an infinite loop is one kind of very bad programming, 'cuz the loop eats up most of your CPU time which in turn adds up more delays of the execution of other tasks (just as in your case it is the playback). By witting codes bit efficiently and planning out the architectural execution flow of the app before start writing the code helps solve these kind of issues.
    You can go through [this simple tutorial|http://oreilly.com/catalog/expjava/excerpt/index.html] about Basics of Java and Threads to know more about threads.
    Regds,
    SD
    N.B. And yes there are more articles and tutorials available but much of them targets the Java SE / EE, but if you want to read them here is [another great one straight from SUN|http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html] .
    Edited by: find_suvro@SDN on 7 Nov, 2008 12:00 PM

  • J2ME problem with threads

    Hi all,
    I would like to ask you for a help. I need to write a small program at my university. I started to write a midlet which function would be to countdown time for sports activities. I woul like to start a new thread - the one that counts down - and at the same time make the main thread sleep. After the "countdown" thread finishes, the main thread wakes up and waits for user input. The problem is that when the "countdown" thread finishes his work, I've got Uncaught exception java/lang/NullPointerException. error and the midlet halts.
    Below you can find the code
    import java.lang.*;
    import java.util.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    public class intervals extends MIDlet implements CommandListener
    public Display ekran;
    private SweepCanvas sweeper;
    private Form rundy;
    private TextField round0, round1, round2, round3, round4, round5, round6, round7, round8;
    private long czas,x;
    private Command exitCommand;
    private Command addRound;
    private Command delRound;
    private Command start;
    private TextField repeat;
    private Form odliczanie;
    private Alert ostrz;
    Licznik thread;
    String test;
    StringItem test1;
    int parz,i,j,k;
    static int l;
    int ilrund;
    int ilpowt;
    Item sec;
    long sec1;
    public intervals()
        rundy = new Form("Interwa&#322;y sportowe");
        exitCommand = new Command("Wyj&#347;cie", Command.EXIT, 2);
        addRound = new Command("Dodaj","Dodaj rund&#281;", Command.ITEM,1);
        delRound = new Command("Usu&#324;","Usu&#324; ostatni&#261; rund&#281;", Command.ITEM,1);
        start = new Command("Start", Command.ITEM,1);
        odliczanie = new Form("Odliczanie");
        TextField dodaj(TextField kolej)
            kolej=new TextField("Podaj czas (s) rundy "+parz,null, 4, TextField.NUMERIC);//stworzenie nowej instancji do wybierania czasu trwania rundy
            if(rundy.size()==0)
                rundy.insert(rundy.size(),kolej);
                else
                    rundy.insert(rundy.size()-1, kolej);
            return kolej;
        void odliczanie(TextField round)
            monitor m=new monitor();
            k=Integer.parseInt(round.getString());
            ekran.setCurrent(odliczanie);
            thread=new Licznik(k,odliczanie);
            thread.start();
            ekran.setCurrent(rundy);
    public void startApp()// throws MIDletStateChangeException
        rundy.deleteAll();
        repeat = new TextField("Podaj ilo&#347;&#263; powtórze&#324;",null,1,TextField.NUMERIC);
        rundy.addCommand(addRound);
        rundy.addCommand(exitCommand);
        rundy.setCommandListener(this);
        Canvas obrazek = new MyCanvas();
        ekran = Display.getDisplay(this);
        ekran.setCurrent(obrazek);
        czas=System.currentTimeMillis();
        while (System.currentTimeMillis()<czas+1000)
            continue;
        ekran.setCurrent(rundy);
    public void pauseApp()
    public void destroyApp(boolean unconditional)
        notifyDestroyed();
    public void commandAction(Command c, Displayable s)
        if (c == exitCommand)
            destroyApp(false);
            notifyDestroyed();
        else if(c==addRound)
            if(rundy.size()==0)//Sprawdzenie ilo&#347;ci elementów w celu poprawnego wy&#347;wietlania liczby rund w formie
                parz=1;
                else
                parz=rundy.size();
            switch(parz)
                case 1:
                    round0=dodaj(round0);break;
                case 2:
                    round1=dodaj(round1);break;
                case 3:
                   round2= dodaj(round2);break;
                case 4:
                    round3=dodaj(round3);break;
                case 5:
                    round4=dodaj(round4);break;
                default:
                    ostrz=new Alert("Uwaga","Maksymalna liczba rund wynosi 9", null, AlertType.INFO);
                    ostrz.setTimeout(3000);
                    ekran.setCurrent(ostrz);
            if(rundy.size()==1)
                rundy.append(repeat);
                rundy.addCommand(start);
            rundy.addCommand(delRound);
        else if(c==delRound)
            if(rundy.size()!=0)
                rundy.delete(rundy.size()-2);
                if (rundy.size()==1)
                    rundy.deleteAll();
                if(rundy.size()==0)
                    rundy.removeCommand(delRound);
                    rundy.removeCommand(start);
        else if(c==start)
            ilrund=rundy.size()-1;
            if(this.repeat.size()>0)
                ilpowt=Integer.parseInt(this.repeat.getString());
            ekran = Display.getDisplay(this);
            for (i=1; i<=ilpowt;i++)
                odliczanie= new Form("Odliczanie");
                 for (j=0;j<ilrund;j++)
                    switch(j)
                         case 0:
                             odliczanie(round0);
                             break;
                         case 1:
                             odliczanie(round1);
                             break;
                         case 2:
                             odliczanie(round2);
                             break;
                         case 3:
                             odliczanie(round3);
                             break;
                         case 4:
                             odliczanie(round4);
                             break;
                         case 5:
                             odliczanie(round5);
                             break;
                         case 6:
                             odliczanie(round6);
                             break;
                         case 7:
                             odliczanie(round7);
                             break;
                         case 8:
                             odliczanie(round8);
                             break;
    class Licznik extends Thread
        int czas1,k;
        Form forma;
        monitor m;
        public Licznik(int k,Form formap)
            czas1=k;
            forma=formap;
        public synchronized void run()
            while(czas1>0)
                forma.deleteAll();
                forma.append("Czas pozosta&#322;y (s): "+czas1);
                try{Thread.sleep(1000);} catch(InterruptedException e){e.printStackTrace();}
                czas1--;
            if(czas1<=0)
                m.put();
        }and monitor class
    public class monitor
    boolean busy=false;
    synchronized void get()
        if(!busy)
            try
                wait();
            }catch(InterruptedException e){e.printStackTrace();}
        notify();
    synchronized void put()
        if(busy)
            try
            wait();
            }catch(InterruptedException e){e.printStackTrace();}
        busy=true;
        notify();
    }Can anybody help me with this?

    Groovemaker,
    Your Licznik class has a member m of type monitor, which has not been instantiated (in other words is null) hence, when calling m.put() you get NullPointerException. Please also mind, that using Thread.sleep(1000) is not an accurate way of measuring time.
    If I may, please use recommended for Java class naming conventions - some of your names use lower case, while other don't which is confusing to the reader.
    Daniel

Maybe you are looking for

  • Print of ALV report

    Hi .. Is there anybody knows alv report can be printed on microline printer (continuous form) . I tried but all column lines are displayed as # .

  • How to Design a Page for Both Insertion and Updation

    Hi, I have Page where I need to populate a table from Standard PO/AP table and once the save is clicked on the table, the data shoudl be inserted in custoim table. Ex: Ui table wil have 3 columns and say 5 rows - PO# - Line# - Amount for 'X' purpose

  • Calling a pl/sql function.

    Hi, I couldn't manage to call a pl/sql function that takes some arguments or no arguments. I couldn't find an example but searching through previous topics / discussions I could write something like this : ExpressionBuilder expBuilder = new Expressio

  • Blank pages on the Adminui

    I have installed server Jboss.  I am able to log in. I can see the Home, Services, Settings options.  But when I click on user management, the pages are blank! Suggestions? Thank you in advance p.s. it is an Eval copy of ES4 Server

  • Need VZW to deal with this, very uphappy customer

    I’m submitting this complaint, hoping Verizon Wireless management can help me out in a situation in which I feel Verizon Wireless mislead/deceived me. My wife and I have been Verizon Wireless customers for approximately 7-8 years, we always pay our b