Jump to content

SharkM

Members
  • Posts

    3
  • Joined

  • Last visited

    Never

SharkM's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Thank you for the links. I think the 100% CPU usage is coming from the fact that the VISA read is continuously waiting for all the bytes to arrive. I should omit this. I already got rid of the initialization vi after every read, and now execute this one before the loop. The serial devices are all different. Two of the serial devices have indeed an termination character included (and I use it), the other two generate messages of a specific length (3000-4000 bytes, transfer time about 2.5 seconds).
  2. This really isn't a homework assignment. I was just wondering whether there is any documentation/example available on reading from multiple serial ports in a parallel process (the same while loop), since it seems to make the CPU running at 100%. Of course the processes can be put after one another, but then there will be some synchronization problems. Is there any smart way to do this? I will post a screenshot when the occasion arises.
  3. I am building an application that needs to read and store (ascii) data from sensors at six serial ports, every minute. The state machine (inside a while loop) I use is divided in three cases: initialization: the six serial ports are initialized (serial settings, timeout, end character etc.). A check is performed on the actual time to see whether a new minute has started. This case runs every second (wait time). If a new minute has started, the state machine turns to the read case. Otherwise the initialization is repeated. read: a poll is carried out for each initialized serial port (VISA write). When a message is received (VISA read), or when the time out has elapsed, it is decoded by a separate subVI for each sensor and the necessary parameters are determined from the message. Furthermore, the received message is concatenated with a date/time stamp and stored in a text file. When no message is received for a certain serial port, only the time stamp is stored for that one. A check is carried out to see whether a new hour has started. If that is the case, the processing case is executed, otherwise the program returns to initialization. processing: hourly parameters are derived from the 60 one minute values, and stored afterwards. The program now returns to initialization. The problem is mostly in the second (read) case. I don't actually know what is the best way to poll (and read) multiple serial ports in the same VI. Currently, I have put them all six below each other so the processes are carried out parallel and the timing is depending on the last one to finish. I think this is not ideal and it could be done easier and more efficiently. Moreover, in this way the CPU usage is very high. Every time a new minute triggers the state machine to execute the processes in the read case, it increases to 100% for the complete polling time. However, polling them in a certain sequence is not really an option I think, since I prefer to poll the sensors synchronously, if possible. Anyone with a good idea or example? Thanks in advance.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.