Device::MegaSquirt::Serial - Low level serial commands for MegaSquirt.
use Device::MegaSquirt::Serial; $mss = new Device::MegaSquirt::Serial('/dev/ttyUSB0'); @data = $mss->read_r(9, 0, 0, 256);
This library is used for the low level serial commands needed to communicate with a MegaSquirt  controller.
The only concern at this level is how the data is read and written. The specific details of what the data actually represents is not defined here. That should be defined at a higher level where defintions are made relevant to the Megasquirt version number.
Returns: defined object on success, FALSE otherwise
The new constructor takes a single argument specifying which serial device to use (e.g. '/dev/ttyUSB0'). If initiation of the device is successful the returned objected can be used to call other functions.
Returns: the Megasquirt version number, FALSE on error
Executes the Q command  to read the version number.
$version = $mss->read_Q();
Q' and 'S' commands (both caps) are used to retrieve two indicators of the MS-II code version. The first is the 20-byte ASCII string for the Rev Number of the code version, the second is for a 32-byte Signature string. The latter is changed in the code whenever a new feature is added, the first is changed in the code whenever there has been an input parameter or output variable added. 
Returns: the Megasquirt signature, FALSE on error
Executes the S command  to read the signature.
$version = $mss->read_S();
See also documentation of read_Q();
Returns: hash reference of bytes on success, FALSE on error
Executes the A command  (Burst Mode) to read a frame of live variables.
$dat = $mss->read_A($num_bytes); # process $dat elsewhere
The values of the data that is returned is dependent on the Megasquirt version so the data is returned in its raw form and processing must be done at a higher level.
The size of data is also version dependent so this is given as an argument so that it can it can be tested here to see if the correct amount of data was read.
Returns: array of bytes on success, FALSE on error
Executes the r command  to read bytes from the controller.
$tbl_idx - table index/offset; also called 'page' $offset - offset $num_bytes - the number of bytes to request
Returns: TRUE on success, FALSE on error
Executes the w command  to write bytes to the controller.
$tbl_idx - table index/offset; also called 'page' $offset - offset @bytes - data bytes to be written
It is expected that @bytes are only 1 byte chunks. For example to write a two byte integer it must be broken down in to 2 bytes.
$pack = pack("n", $integer); @bytes = unpack("CC", $pack);
Module Version ------ ------- Device::SerialPort 1.04 The version number given has been tested and shown to work. Other version may also work.
 RS232 communication with Megasquirt 2-Extra http://home.comcast.net/~whaussmann/RS232_MS2E/RS232_MS2_E.htm  MegaSquirt Engine Management System http://www.msextra.com/
Jeremiah Mahler CPAN ID: JERI mailto:email@example.com http://www.google.com/profiles/jmmahler#about
Copyright (c) 2010, Jeremiah Mahler. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.