Publication date: 07/08/2024

Read in Real-Time Data

The term live data feed describes the way an external data source sends information via a physical or a logical communication link to another device. You can connect JMP to a live data feed through the serial port of your Windows computer to read a stream of incoming data in real time. Remember the following:

The data feed must come through a standard nine-pin serial port. Data cannot be read through a USB port unless there is a driver that can simulate a serial port.

You need to know the exact baud rate, parity, stop bits, and data bits for the attached device.

Once you obtain the numbers for your device, enter them into the Open Datafeed() command in the script below. (The 4800, even, 2, and 7 in the script below are examples, so replace them with your information). Then connect the data feed to your computer and open and run the script:

streamScript = Expr(
	line = feed << Get Line;
	Show( line );
	len = Length( line );
	Show( len );
	If( Length( line ) >= 1,
		Show( "Hi" );
		Show( line );
		field = Substr( line, 5, 8 );
		Show( field );
		x = Num( field );
		Show( x );
		If( !Is Missing( x ),
			dt << Add Row( {:Column1 = x} );
			Show( x );
		);
	);
);
feed = Open Datafeed(
	Baud Rate( 4800 ),
	parity( even ),
	Stop bits( 2 ),
	Data bits( 7 )
);
feed << Set Script( streamScript );
feed << Connect;

To ensure harmony between the communications settings for JMP and the instrument reading data from an external source, select File > Preferences > Communications. Refer to the documentation for your instrument to find the appropriate settings.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).