Code covered by the BSD License  

Highlights from
RS485/MODBUS Communication with JLD416PVA Power Meter

image thumbnail

RS485/MODBUS Communication with JLD416PVA Power Meter


W. (view profile)


04 Apr 2012 (Updated )

Reads power, voltage and current data via RS485/MODBUS from a JLD416PVA meter.

function [s] = serialstart(opt)
% Funtion for initializing a serial interface in matlab for interfacing
% with modbus Eaton ELC PLC controllers over RS-232 serial connections
% mode 1 initializes the connection using the com port specified in
% opt.serial
% Functions using the serial port must be passed the serial port object s
% in order for the serial port to be acessable. 
% Originally by Steven Edmund

if nargin == 0
    mode = 1; 
    opt.serial = 'COM4'; % must be set according to your system.

% Initialize serial port on specified com port
s = serial(opt.serial);

% Specify connection parameters

%Open serial connection

% Specify Terminator - not used for binary mode (RTU) writing
s.terminator = 'CR/LF';

% Set read mode

Contact us