loading
 
Roland from South Africa  [107 posts] 1 month
Hi STeven

I've tried to ask this before, but still don't understand the answer.............

I am trying to log and process data from the serial port.

So no matter what I do, I can only get the FPS up to about 60.
So I presume the max rate that data can be processed at, is the FPS, being 60. I presume this is the pipeling speed too?
Is this determined by the screen update rate?

Why can't RR run at a FPS of say 1000. Surely very easily achieved on a modern PC.
So I want to retrieve a string, process the result in VB, and store a result.
There is the displayed values, and a graph on the GUI, but these only need to be updated at say 30FPS, much like a multimeter, for the operators benefit

While data is presumably buffered from the serial (or USB) port, the basic question is; why can't the pipeline speed be much, much faster, and independent of the display FPS?
So this would allow RR to act as a 'proper'? PLC, while having all the benefits of a graphical display. In this application, there is no camera, no image processing.

The actual application is 'Torque plus angle' A strain gauge is read and the result needs to be manipulated and stored at discrete rotary encoder divisions. The incoming data has a rate of approximately 100 SPS, but RR should operate at an order of magnitude faster in order to not see glitches in the graph, ie be more 'real time'

Regards
Roland






Steven Gentner from United States  [273 posts] 24 days
Roland,

We did some testing and while it is possible to get the pipeline up to 200fps its not very stable at that rate since if the PC decides to do something else (like update Windows) that rate will drop drastically and quickly. Its just not quite the right way to get a high speed response rate to serial data.

Instead, you probably want to use an external VBScript that can run in a tight loop or respond to serial interrupts without needing to release control back to a RR processing pipeline. Its really the best way to create a device listener esp. if you need it to be very reactive. While the module in RR is capable of such things its really only meant as a slower interface to send data created from a camera feed. For general purpose systems, its probably best to write more focused scripts.

For example, feeding

"Write a VB Script command line program that listens to a serial port for data and prints the received data."

into ChatGPT produces something you might use to help you get started:

' Create a serial port object
Set serialPort = CreateObject("MSCommLib.MSComm")

' Set serial port properties
serialPort.CommPort = 1
serialPort.Settings = "9600,N,8,1"
serialPort.InputMode = 0 ' Text mode
serialPort.Handshaking = 0 ' None
serialPort.RThreshold = 1 ' Set the number of characters to trigger the OnComm event

' Open the serial port
serialPort.PortOpen = True

' Define the OnComm event handler
Sub serialPort_OnComm
  Dim receivedData
  receivedData = serialPort.Input ' Read the received data

  ' Process the received data here
  WScript.Echo "Received data: " & receivedData
End Sub

' Set the OnComm event handler
serialPort.OnComm = GetRef("serialPort_OnComm")

' Wait for input
WScript.StdIn.ReadLine

' Close the serial port
serialPort.PortOpen = False

 Reply  New Post   Forum Index