Write data to serial port every two minutes

Hi,
   I use VISA-Write to write data to serial port. I want to write a byte every two minutes. What should I do?
  Thanks!

hengfo,
that question is not connected to LV nor to VISA. Its more a systematic question....
So let's view at this a bit more abstract:
You want to "toogle" between two different messages sent to your interface. So you have to know:
- What was the last state i sent?
- When do i have top send the new state?
Even more abstract:
- How can i switch between the states?
Since the states are known before your program is executed, you can insert them into an array. Next, you have to read out the appropriate index from the array which contains your new state. Send the state and go to the next state. Propably you want to change timing, but that's easy too.
See attached screenshot for a possible solution:
hope this helps,
NorbertMessage Edited by Norbert B on 09-11-2007 07:57 AM
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Attachments:
StateSwitching.PNG ‏8 KB

Similar Messages

  • Problem while reading data from Serial Port

    Hi All,
    I am facing some problem while reading data from Serial Port.
    As per the requirement I am writing the data on Serial Port and waiting for response of that data.
    Notification for data availabilty is checked with method public void serialEvent(SerialPortEvent event) of javax.comm.SerialPortEventListener.
    When we are writing data on the port one thread i.e. "main" thread is generated and when data availability event occures another thread "Win32SerialPort Notification thread" is generated. This creates problem for me as we can't control thread processing.
    So can anybody pls explain me how to overcome this problem?
    Regards,
    Neha

    My Problem is:-
    I am simoultaneouly wrting data on port & reading data from port.
    First I write data on port using outputStream.write() method. Now when target side sends me response back for the request on serial port DATA_AVAILABLE of SerialPortEventListner event occured,we are reading data from serial port.Now till the time we didn't get the response from target next command can't be written on the serial port. When we are writing data on port main thread is executed.Now my problem starts when DATA_AVAILABLE event occured.At this point another thread is created.Due to this my program writes data of next command without reading response of previous command.To solve this prob. I have used wait() & notify() methods as follows.But again due to this my pc hangs after execution of 2 commands. (PC hang in while loop in a code provided below.)
    From SOPs I could figure it out that after 2 commands we are not able to write data on serial port so DATA_AVAILABLE event doesn't occure n pro. goes in wait state.
    Can anybody help me to solve this issue.
    Neha.
    Code:
    public void serialEvent(SerialPortEvent event)
              switch (event.getEventType())
                   case SerialPortEvent.BI:
                   case SerialPortEvent.OE:
                   case SerialPortEvent.FE:
                   case SerialPortEvent.PE:
                   case SerialPortEvent.CD:
                   case SerialPortEvent.CTS:
                   case SerialPortEvent.DSR:
                   case SerialPortEvent.RI:
                   case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
                                 break;
                   case SerialPortEvent.DATA_AVAILABLE:
                        try
                             dataThread = Thread.currentThread();
                             dataThread.setPriority(10);
                             dataAvailable = true;
                                                                                    byte[] tempArray=new byte[availableBytes];
                                        inputStream.read(tempArray);
                                                                       catch (IOException io)
                             SOP(io, "Error in serialEvent callback call for event DATA_AVAILABLE");
    public void  writetoPort(byte[] data) throws IOException
                             outputStream.write(data);
                              while(finalTimeOut >= actualTime)
                            if( ! dataAvailable)
                                    actualTime = System.currentTimeMillis();
                           else
              synchronized (mainThread)
                   mainThread = Thread.currentThread();
                   mainThread.wait();
    public  void sendDatatoUser(byte[] b) throws Exception, HWCCSystemFailure
              obj.returnData(b);
              synchronized(mainThread)
                   mainThread.notify();
                                                           

  • How to save a datas from serial port?

    How to save a datas from serial port?

    Hi
    I need some help about rs-232 communication. I want to make a vi witch can do this things:
    -read a txt file (to simulate a serial port like when the datas are coming)
    i will get 3 different data in serial port (like this: 121 213 135)
    i want to save in a txt file what datas get my vi
    so
    -write in a txt file or draw in a diagram (or both)
    so my problem is: read in serial port and save in a file and draw a diagram.
    if anybody can help pls HELP ME because im a beginner in this problem.
    I already do something but Im not sure that good.
    Thx for all.

  • Write string to serial port ?

    Hello! Thanks all, who help me build up this attached VI !!!
    Small problem.
    In a few words: I received date from serial port, my VI work with it, and I want pass string “sting I need write to port” to serial port. (see attached VI).
    Data all time read from port and write to port.
    I know, how work serial VISA, but I don’t know, how connect wire.
    And second question: how insert subVI in VI from .llb?
    Thanks!
    Mikhail.
    Attachments:
    string_to_serial_port.vi ‏170 KB

    Hi  Dai!
    Thanks for answer.
    I did as you said, but something  I did wrong.
    Please, look at my VI. What is wrong?
    Mikhail.
    Attachments:
    string_to_serial_port.vi ‏171 KB

  • Network glitch every two minutes

    I'm trying to troubleshoot an issue where by applications sending data between 2 Solaris 10 x86 machines (v40z) will hang for about 1 second every two minutes. The interval between the hang is very regular (2 minutes almost to the milisecond) but it doesn't land on a predicitable second each test (eg, 12:34:52, 12:36:52 in one test, 13:13:20, 13:15:20 in another).
    It appears to be independant of the application. I can see it during long file transfers using scp as well as internal applications that push steady streams of data. The usual checks with prstat and such don't show anything spiking on the nic, cpu, etc. Packet captures don't show anything unusual coming or going at the times of the hangs. It lasts for 1-1.5 seconds.
    The July Recommended set is applied.
    Has anyone else seen anything like this?

    FYI, this ended up being two different situations. In one spot there was a bogus route in the table that was theoretically benign, but removing it made the spikes disappear. The other situation was revolved by removing ipmp from a high-load situation.
    My conclusion is that there is something in the driver or stack that is configured to happen every two minutes which can make itself obvious when in the presence of certain networking misconfigurations. I have not patched and retested the ipmp stuff since the original post, but I don't know that that would necessarily be conclusive if it still existed, what with all the ipmp patches coming out lately.

  • Unable to capture data from Serial port using LVRT2010 in single core pentium 4 machine

    I am using application written in Labview using windows Labview
    Runtime environment 2010. Application creates a tunnel to intercept data from
    Serial port.
    My problem is, Currently, I am using single core Pentium
    processor. When I am trying to intercept the data between COM1 and COM7 (COM 7
    is a virtual port) it is not able to capture data.
    When I am running Labview RT environment using dual core
    processor machine it is running normally. I wonder whether it could be the compatibility issues with
    single core Pentium processor.

    Hi Magnetica
    Are both of the machines running the same runtime engine,
    drivers ect?
    Have you had RT applications running on this
    machine before?
    Is the development computer a 64bit machine?
    The processor is a supported model (See link below).
    http://zone.ni.com/devzone/cda/tut/p/id/8239
    Regards
    Robert
    National Instruments UK & Ireland

  • Downloaded new iOS for iPhone 5. Now the handset is running hot, keeps freezing on different screens, won't charge on official charger ( only charges on crap poundland one) and battery is loosing 1% every two minutes!

    Downloaded new iOS for iPhone 5. Now the handset is running hot, keeps freezing on different screens, won't charge on official charger ( only charges on crap poundland one) and battery is loosing 1% every two minutes! I've closed all apps and reset the complete phone but no luck. Any one know what else I can try apart from a new phone?

    I have done a factory reset at 45% battery. After the reset it's still hot and at 35% now

  • How send data to serial port from forms 6i

    How send data to serial port to activate hardware connect.
    The hardware is a drawer for cash the point of sales.

    Andres,
    I do the exact thing you are looking for,
    I spool out a text file using text_io
    the file will either contain a double ^G or an epson escape sequence, depending on the drawer type connected.
    I then copy this file to the port using a copy function id d2kwutil
    Works perfectly, but god knows how I'll do it if we want to run the point of sale over the web :)
    John

  • W520 beeps 4 times every two minutes

    This morning I started up my computer from its sleeping mode, and it beeped four times. It keeps on happening consistently every two minutes.
    Basically, it does this, within two seconds:
    beepbeep...beepbeep...beepbeep...beepbeep
    It is incredibly annoying, and searching on the Internet has proved fruitless. I am able to all functions normally, except listen to sound because it overlays any other sound. I don't know what it means. If anyone could help, it would be much appreciated.

    TrimHopp,
    Welcome to the Support Forums
    What is your exact machine type of W520? what operating system it is running? The machine type can be found on a sticker on the bottom of the unit. Any recent changes to the computer?
    When you boot into BIOS does the machine still make the beeping noise?
    Thank you for being a part of the Lenovo Family,
    Catie
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
    Donate KUDOS and Click "Accepted Solution"

  • My podcasts stop every two minutes - how can I fix?

    Hi all,
    I'm hoping someone may be able to suggest how I can fix this annoying problem:
    When I listen to podcasts on my iPod nano, they stop every two minutes. I have to then press wake button and then the play button. Then it stops again after about two minutes as if it had gone to sleep. So I repeat the above steps ad infinitum. Only had it a few days and don't think this is normal or know how to fix or if should take it in for a serviceperson to look at. Can anyone with similar experience or any advice please respond. Thanks Ben.

    The most likely problem is that the headset jack is not fully inserted. With the 1.1 update,there is a feature that senses when a headset is inserted. If there is not one, it pauses playback when the screen goes dark to preserve battery life.
    Many folks have had an issue with not fully inserting the headset. When the headset is fully seated, you will hear and feel it click into position. You should not be able to see ANY of the silver of the plug when the headset jack is fully inserted, if you can, it is not in far enough. If you have have pushed it in as far as you can - as hard as you can, then there may be debris in there. Any debris could cause this, since the sensor that tells the nano that the headset is seated is at the bottom of the hole for the headset jack
    i.

  • I have iphone 3gs and it keeps shut dowm by itself every two minutes idunno if this problem related to the battery life or what? please help me solve this problem

    i have iphone 3gs and it keeps shut dowm by itself every two minutes idunno if this problem related to the battery life or what? please help me solve this problem

    See Here for Device continually restarts...
    http://support.apple.com/kb/HT1808

  • Buzz/alert sound every two minutes

    Since installing Yosemite, my iMac has starting making and annoying buzzer/alert sound approximately every two minutes. I've captured a recording of it here.
    Can anyone tell me what this is? It's driving me crazy! I've installed Sound Bunny which shows you all the applications that a making sound and it's not reporting any applications. I don't have any notifications and have closed all applications.
    Thanks

    do you happen to use airmail 2? I had the exact same problem and I went to settings -> general -> sounds and unchecked that box and that solved the problem.

  • Apple TV dropping WiFi connection every two minutes

    Hey there,
    So I bought an Apple TV a couple days ago. Product looks great and looks absolutely gorgeous on the TV I have. My only problem (and its a HUGE problem) is that the device drops my WiFi every two minutes. Specifically when watching videos.
    So in effect I cant stream any video - be it from YouTube, iTunes, NFL, Vimeo or even over AirPlay - because every time I do the signal drops and I'm thrown back to the main screen.
    My WiFi pretty good. I have an iPhone, an iPad, two PC laptops and a Samsung smart phone that use the same network without any issues.
    Please help me with this problem. I really really like the product but its practically useless with this issue.

    Other devices working doesn't rule out a network issue.
    Try connecting Apple TV via ethernet
    Go to istumbler, netstumbler or similar to get a network report. Look for signal strength, noise, and nearby networks.

  • MacBook Pro Medio 2012 freezes literally once every two minutes?

    Hello Apple Support Community,
    I have a MacBook Pro Medio 2012 running the latest edition of OS X Mountain Lion which I have been enjoying for almost a year now. I must say that it's the best machine I've ever owned and I have never encountered any problems with it. Until last friday. I was using it at home before school, browsing internet, listening to music and chatting on IRC. I then closed it down and went to school. When I started it at the school it suddenly was really slow and literally froze every two minutes. I spent most of the day figuring how to solve this really annoying issue and I searched a lot on Google a lot. I gave up and decided to do a complete re-install of OS X through the menu you can open when booting (cmd + r).
    I have this one time earlier and this time it took far more time than last time. It took me 12 hours this time.. Anyway, it finished the install of OS X and I configured my account and such. I now thought that everything should be well, but no. I have the exact same issues as before and I can't seem to figure out how to solve this annoying issue. Which is also the reason for me to come and ask you guys.
    Things I already have tried:
    - Re-installing OS X
    - Clearing the SMC
    I hope this problem can be solved without any costs. I'm a student which obviously means that I don't have a lot of money to spent on such things.
    Regards
    Daniel

    Honesty you have already test it. When you have the original RAM installed the system did Not Freeze, Correct?
    Then you installed this other RAM and Now the system Freezes. The RAM you installed is either Bad or not the correct type for your Model Mac.
    Sure there could be some other reason, But I doubt it. Simple test. Reinstall the original RAM. If the system does not freeze then you have your Proof, the new RAM you bought is either Bad or the wrong type.

  • Problem in reading data from serial port continuously- application hangs after sometimes

    I need to read data from two COM port and order of data appearance from COM port is not fixed. 
    I have used small timeout and reading data in while loop continously . If my application is steady for sometime it gets hangs and afterwards it doesnt receive any data again. 
    Then I need to restart my application again to make it work.
    I am attaching VI. Let me know any issue.
    Kudos are always welcome if you got solution to some extent.
    I need my difficulties because they are necessary to enjoy my success.
    --Ranjeet
    Attachments:
    Scanning.vi ‏39 KB

    billko wrote:
    Ranjeet_Singh wrote:
    I need to read data from two COM port and order of data appearance from COM port is not fixed. 
    I have used small timeout and reading data in while loop continously . If my application is steady for sometime it gets hangs and afterwards it doesnt receive any data again. 
    Then I need to restart my application again to make it work.
    I am attaching VI. Let me know any issue.
    What do you mean, "not fixed?"  If there is no termination character, no start/stop character(s) or even a consistent data length, then how can you really be sure when the data starts and stops?
    I probably misunderstood you though.  Assuming the last case is not ture - there is a certain length to the data - then you should use the bytes at port, like in the otherwise disastrous serial port read example.  In this case, it's NOT disastrous.  You have to make sure that you read all the data that came through.  Right now you have no idea how much data you just read.  Also, if this is streaming data, you might want to break it out into a producer/consumer design pattern.
    Not fixed means order is not fixed, data from any com port can come anytime. lenght is fixed, one com port have 14 byte and other 8 byte fixed..
    Reading data is not an issue for me as it works nice but I have a query that why my application hangs after sometime and stops reading data from COM PORT.
    Kudos are always welcome if you got solution to some extent.
    I need my difficulties because they are necessary to enjoy my success.
    --Ranjeet

Maybe you are looking for