Example project for the Rioux Chem control box

Dependencies:   mbed MODSERIAL

Dependents:   screentest

Rioux Chem Control Box

/media/uploads/emh203/ccb.jpg

This is the example project for the Rioux Chem Control Box. I have posted some youtube videos to guide you through the hardware and software:

Rioux Chem Control Box - Hardware

http://www.youtube.com/watch?v=MoZ92GRYa4s

Rioux Chem Control Box - Software - Part I

http://www.youtube.com/watch?v=_MwaTLL4dyA==

Rioux Chem Control Box - Software - Part II

http://www.youtube.com/watch?v=j_P89izfgoQ

Files at this revision

API Documentation at this revision

Comitter:
wavenumber
Date:
Wed Oct 06 14:27:21 2021 +0000
Parent:
7:de452fceafc1
Child:
9:c830667212f4
Commit message:
Added the ability to change baud rate on the ports. Port 1 sends both a carraige return and line feed for the valve

Changed in this revision

DRIVERS/CHEM_BOX_COMMON.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/DRIVERS/CHEM_BOX_COMMON.cpp	Mon Sep 20 01:32:52 2021 +0000
+++ b/DRIVERS/CHEM_BOX_COMMON.cpp	Wed Oct 06 14:27:21 2021 +0000
@@ -137,7 +137,7 @@
     
     RS232_0.baud(19200);
   
-    RS232_1.baud(19200);
+    RS232_1.baud(9600);
     
 
 }
@@ -557,6 +557,8 @@
 void TerminalCmd_BPIN(char *arg);
 void TerminalCmd_P0(char *arg);
 void TerminalCmd_P1(char *arg);
+void TerminalCmd_P0B(char *arg);
+void TerminalCmd_P1B(char *arg);
 
 //Populate this array with the callback functions and their terminal command string
 TerminalCallbackRecord MyTerminalCallbackRecords[] ={   {"reset",TerminalCmd_Reset,"Resets the CHEM box"},
@@ -605,11 +607,14 @@
                                                     
                                                         {"BPIN",TerminalCmd_BPIN,"Reads the Back pressure regulator feedback.   I.E. BPIN "},
                                                     
-                                                        {"P0",TerminalCmd_P0,"Sends a command over RS232 port 0 to the Pump.  A carriage return will be added automatically."},
+                                                        {"P0",TerminalCmd_P0,"Sends a command over RS232 port 0.  A carriage return will be added automatically."},
                                                   
-                                                        {"P1",TerminalCmd_P1,"Sends a command over RS232 port 0 to the Pump.   A carriage return will be added automatically."},
+                                                        {"P1",TerminalCmd_P1,"Sends a command over RS232 port 1.   A carriage return and line feed will be added automatically."},
                                                     
-                                                        
+                                                        {"P0B",TerminalCmd_P0B,"Change the baud rate of Port 0 (default 19200)"},
+                                                  
+                                                        {"P1B",TerminalCmd_P1B,"Change the baud rate of Port 1 (default 9600)"},
+                                                   
                                                         {"ECHO_OFF",TerminalCmd_ECHO_OFF,"Disables echoing of characters"}
                                                     };
 
@@ -656,6 +661,12 @@
     RS232_0.printf("%s\r",arg);
 }
 
+void TerminalCmd_P1(char *arg)
+{
+    ResetRS232_Response(1);
+    RS232_1.printf("%s\r\n",arg);
+}
+
 
 void ProcessRS232()
 {
@@ -711,12 +722,25 @@
 }
 
 
-void TerminalCmd_P1(char *arg)
+void TerminalCmd_P0B(char *arg)
 {
-    ResetRS232_Response(1);
-    RS232_1.printf("%s\r",arg);
-}
+    int Baud = 0;
+    if(sscanf(arg,"%d",&Baud) == 1)
+    {
+         RS232_0.baud(Baud);
+         PC.printf("Port  0 baud changed to %d",Baud);
+    }
+ }
 
+void TerminalCmd_P1B(char *arg)
+{
+    int Baud = 0;
+    if(sscanf(arg,"%d",&Baud) == 1)
+    {
+         RS232_1.baud(Baud);
+         PC.printf("Port  1 baud changed to %d",Baud);
+    }
+ }
 
 void TerminalCmd_MFCI(char *arg)
 {