Pages: [1]   Go Down
Author Topic: MRMP - Arrays, Generic Controller  (Read 766 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
MRMP - Microcontroller Remote Management Protocol developer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Microcontroller Remote Management Protocol (MRMP)
 Tutorial - Arrays, Generic Controller
Revised 2009-01-18

Original article: http://www.mmcs.com/~gmatthews/FAV1-00012D85/FOV1-00012FAD/S00053310-00053318

Introductory thread: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1232140631

In this tutorial we will explore the use of MRMP to get and put variables using Generic_Controller.pde.
In an another tutorial we will explore the use of MRMP to control a fictional sketch, Water Control, that monitors, fills and drains a water tank.


Sketch setup

- Install Ardurino 0011 or 0012.
- Download 'Generic_Controller' from http://www.mmcs.com/~gmatthews/FAV1-00012D85/S0005027B-0005027B

- Within Ardurino 0011 (0012) create  a new folder 'Generic_Controller'. Copy 'Generic_Controller to 'Generic_Controller'.
      The result: Ardurino 0012 > Generic_Controller > Generic_Controller.pde

- Open Generic_Controller.pde
- Under Tools > Board > (select the Ardurino board )
- Under Tools > Serial Port > (select the Ardurino board serial port).

- On the window's tool bar, select 'Upload to I/O Board'
- When done uploading, select 'Serial Port Monitor'.

You should see the build: "Controller1-08.12.002" or similar.
and a dump of the EEPROM records.
Most likely all -1 and a two lines 'a' and 'b' records for a unit that has never used EEPROM.


Authenticate

The controller has a simple trusted authentication mechanism. You simply pass it your user ID and Group. The ID and Group is used to control access to your coded functions. The Bridge, on the other hand, has a more secure authentication mechanism as it is the entry point to the Ardurino MRMP wire network.


In the Serial monitor send field type... Is0vA2,1,a#  
       K0sv#
       R0svE,0#

To fully understand what those MRMP packets mean please review this reference.  http://www.mmcs.com/~gmatthews/FAV1-00012D85/S00050299-00050299
Basically that reply says 'Okay'... 'No error'.

If you make a typo, all that you will see is a line feed. On the Bridge, a typo tosses your authenticated session.
If you do nothing for 10 minutes, your authentication will be tossed.
      You will then see R0s?E,1#
      You must reauthenticate... Is0vA2,1,a#  



'Get' and 'Put' exercise.

In the Serial monitor send field type...  Rs0vG1,501#
      R0svG,501,856#  

'856' is the number of seconds since startup. This is suppose to represent the 'Real local time', so in order to set the clock we will get the 'UNIX' time and 'Put it into array variable '501'.
Get the local UNIX time... http://www.epochconverter.com/

In the Serial monitor send field type...  Rs0vP2,501,1232287567#     '1232287567' represents what I found and copied.
      R0svE,0,P,501#

Basically reply says 'Okay on Put to 501'... 'No error'.      

In the Serial monitor send field type...  Rs0vG1,501#
      R0svG,501,1232287644#

'1232287644' is the current UNIX time now incremented by the code on your Ardurino board. It can, and is used for, time stamps of records. "taskEveryDay()", "taskEveryHour()", "taskEveryMinute()" are three functions that rely on the absolute UNIX time in '501'.
However, if the power is lost, the '501' time will revert to a starting point of '0'. Using a crontab scrit via the Bridge, it is my common practice to refresh the UNIX time on all controllers using MRMP every hour. There are many realtime clock alternatives that could be 'plumbed in' but RAM is at a premium on many projects.



In the Serial monitor send field type...  Rs0vG1,500#  
      R0svG,500,1466#  

'1466' is the number of seconds since startup. This alternate timer is never adjusted, and is used to time events.


If you do nothing for 10 minutes, your authentication will be tossed.
To log out immediately, type... Bs0v#
      B0sv#

Summary

You have now successfully uploaded a generic MRMP environment to Ardurino. You have used MRMP packets to send and retrieve data from 500 series variables. There are other packet types, such as temperature, volts, bits, state and records. However your bare bones board is not coded or does not yet have a sensor attached to test those packet types.

These same packets are used to communicate over Wire network from the Bridge. This makes the task of testing using MRMP packets on a local serial port convenient and easy.

I hope that helps you better understand MRMP.

Logged

Pages: [1]   Go Up
Jump to: