PLC 16 in / 8 rev / an in-out / CAN

Dependencies:   PCAL955x mbed mbed-rtos AT45

Revision:
1:3768b56b12e7
Parent:
0:d05a7158dbad
diff -r d05a7158dbad -r 3768b56b12e7 src/main.cpp
--- a/src/main.cpp	Sun Feb 07 05:08:51 2021 +0000
+++ b/src/main.cpp	Mon Feb 08 05:14:32 2021 +0000
@@ -101,32 +101,7 @@
 				if(strstr (pc_buffer,"vr000")) { vr000=read_val();  pc.printf( "ok\n"); }
 				if(strstr (pc_buffer,"vr001")) { vr001=read_val();  pc.printf( "ok\n"); }
 				if(strstr (pc_buffer,"vr002")) { vr002=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"vr003")) { vr003=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"vr004")) { vr004=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"vr005")) { vr005=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"vr007")) { vr007=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"vr008")) { vr008=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"vr009")) { vr009=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"vr010")) { vr010=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"vr011")) { vr011=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"vr012")) { vr012=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"vr013")) { vr013=read_val();  pc.printf( "ok\n"); }
 								
-				if(strstr (pc_buffer,"al001")) { al001=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"al002")) { al002=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"al003")) { al003=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"al004")) { al004=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"al005")) { al005=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"al006")) { al006=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"al007")) { al007=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"al008")) { al008=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"al009")) { al009=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"al010")) { al010=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"al011")) { al011=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"al012")) { al012=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"al013")) { al013=read_val();  pc.printf( "ok\n"); }
-				if(strstr (pc_buffer,"al014")) { al014=read_val();  pc.printf( "ok\n"); }
-				
 				if(strstr (pc_buffer,"pr001")) { pr001=read_val();  pc.printf( "ok\n"); }
 				if(strstr (pc_buffer,"pr002")) { pr002=read_val();  pc.printf( "ok\n"); }
 				
@@ -138,32 +113,7 @@
 				if(strstr (pc_buffer,"vr000")) { pc.printf( "vr000:%d\n", vr000); }
 				if(strstr (pc_buffer,"vr001")) { pc.printf( "vr001:%d\n", vr001); }
 				if(strstr (pc_buffer,"vr002")) { pc.printf( "vr002:%d\n", vr002); }
-				if(strstr (pc_buffer,"vr003")) { pc.printf( "vr003:%d\n", vr003); }
-				if(strstr (pc_buffer,"vr004")) { pc.printf( "vr004:%d\n", vr004); }
-				if(strstr (pc_buffer,"vr005")) { pc.printf( "vr005:%d\n", vr005); }
-				if(strstr (pc_buffer,"vr007")) { pc.printf( "vr007:%d\n", vr007); }
-				if(strstr (pc_buffer,"vr008")) { pc.printf( "vr008:%d\n", vr008); }
-				if(strstr (pc_buffer,"vr009")) { pc.printf( "vr009:%d\n", vr009); }
-				if(strstr (pc_buffer,"vr010")) { pc.printf( "vr010:%d\n", vr010); }
-				if(strstr (pc_buffer,"vr011")) { pc.printf( "vr011:%d\n", vr011); }
-				if(strstr (pc_buffer,"vr012")) { pc.printf( "vr012:%d\n", vr012); }
-				if(strstr (pc_buffer,"vr013")) { pc.printf( "vr013:%d\n", vr013); }
-								
-				if(strstr (pc_buffer,"al001")) { pc.printf( "al001:%d\n", al001); }
-				if(strstr (pc_buffer,"al002")) { pc.printf( "al002:%d\n", al002); }
-				if(strstr (pc_buffer,"al003")) { pc.printf( "al003:%d\n", al003); }
-				if(strstr (pc_buffer,"al004")) { pc.printf( "al004:%d\n", al004); }
-				if(strstr (pc_buffer,"al005")) { pc.printf( "al005:%d\n", al005); }
-				if(strstr (pc_buffer,"al006")) { pc.printf( "al006:%d\n", al006); }
-				if(strstr (pc_buffer,"al007")) { pc.printf( "al007:%d\n", al007); }
-				if(strstr (pc_buffer,"al008")) { pc.printf( "al008:%d\n", al008); }
-				if(strstr (pc_buffer,"al009")) { pc.printf( "al009:%d\n", al009); }
-				if(strstr (pc_buffer,"al010")) { pc.printf( "al010:%d\n", al010); }
-				if(strstr (pc_buffer,"al011")) { pc.printf( "al011:%d\n", al011); }
-				if(strstr (pc_buffer,"al012")) { pc.printf( "al012:%d\n", al012); }
-				if(strstr (pc_buffer,"al013")) { pc.printf( "al013:%d\n", al013); }
-				if(strstr (pc_buffer,"al014")) { pc.printf( "al014:%d\n", al014); }
-				
+
 				if(strstr (pc_buffer,"pr001")) { pc.printf( "pr001:%d\n", pr001); }
 				if(strstr (pc_buffer,"pr002")) { pc.printf( "pr002:%d\n", pr002); }
 				
@@ -176,15 +126,15 @@
 				if(strstr (pc_buffer,"an_out")) { pc.printf( "\n--- PLC --- \n> an_out1=%f an_out2=%f \n", Vout_1, Vout_2 ); }
 				if(strstr (pc_buffer,"stime"))  { pc.printf( "\n--- PLC --- \n> work cycle %f / using %f  sec \n", st_cycl, st_task ); }
 				
-				if(strstr (pc_buffer,"sm-1")){ pc.printf( "\n--- modul SM01 adr=1 --- \n> car position-%d  moving-%d  alarm-%d \n> inputs %d-%d-%d-%d  outputs %d-%d \n", sm1_pos, sm1_mov, sm1_alr, a101, a102, a103, a104, b101, b102 ); }
-				if(strstr (pc_buffer,"sm-2")){ pc.printf( "\n--- modul SM01 adr=2 --- \n> car position-%d  moving-%d  alarm-%d \n> inputs %d-%d-%d-%d  outputs %d-%d \n", sm2_pos, sm2_mov, sm2_alr, a201, a202, a203, a204, b201, b202 ); }
-				if(strstr (pc_buffer,"sm-3")){ pc.printf( "\n--- modul SM01 adr=3 --- \n> car position-%d  moving-%d  alarm-%d \n> inputs %d-%d-%d-%d  outputs %d-%d \n", sm3_pos, sm3_mov, sm3_alr, a301, a302, a303, a304, b301, b302 ); }
-				if(strstr (pc_buffer,"sm-4")){ pc.printf( "\n--- modul SM01 adr=4 --- \n> car position-%d  moving-%d  alarm-%d \n> inputs %d-%d-%d-%d  outputs %d-%d \n", sm4_pos, sm4_mov, sm4_alr, a401, a402, a403, a404, b401, b402 ); }
+				if(strstr (pc_buffer,"sm-1"))	{ pc.printf( "\n--- modul SM01 adr=1 --- \n> car position-%d  moving-%d  alarm-%d \n> inputs %d-%d-%d-%d  outputs %d-%d \n", sm1_pos, sm1_mov, sm1_alr, a101, a102, a103, a104, b101, b102 ); }
+				if(strstr (pc_buffer,"sm-2"))	{ pc.printf( "\n--- modul SM01 adr=2 --- \n> car position-%d  moving-%d  alarm-%d \n> inputs %d-%d-%d-%d  outputs %d-%d \n", sm2_pos, sm2_mov, sm2_alr, a201, a202, a203, a204, b201, b202 ); }
+				if(strstr (pc_buffer,"sm-3"))	{ pc.printf( "\n--- modul SM01 adr=3 --- \n> car position-%d  moving-%d  alarm-%d \n> inputs %d-%d-%d-%d  outputs %d-%d \n", sm3_pos, sm3_mov, sm3_alr, a301, a302, a303, a304, b301, b302 ); }
+				if(strstr (pc_buffer,"sm-4"))	{ pc.printf( "\n--- modul SM01 adr=4 --- \n> car position-%d  moving-%d  alarm-%d \n> inputs %d-%d-%d-%d  outputs %d-%d \n", sm4_pos, sm4_mov, sm4_alr, a401, a402, a403, a404, b401, b402 ); }
 				
-				if(strstr (pc_buffer,"dm-1")){ pc.printf( "\n--- modul DM0806  adr=1 --- \n> inputs:%d%d%d%d%d%d%d%d%  \n> outputs:%d%d%d%d%d%d% \n", x101,x102,x103,x104,x105,x106,x107,x108, y101,y102,y103,y104,y105,y106 ); }
-				if(strstr (pc_buffer,"dm-2")){ pc.printf( "\n--- modul DM0806  adr=2 --- \n> inputs:%d%d%d%d%d%d%d%d%  \n> outputs:%d%d%d%d%d%d% \n", x201,x202,x203,x204,x205,x206,x207,x208, y201,y202,y203,y204,y205,y206 ); }
-				if(strstr (pc_buffer,"dm-3")){ pc.printf( "\n--- modul DM0806  adr=3 --- \n> inputs:%d%d%d%d%d%d%d%d%  \n> outputs:%d%d%d%d%d%d% \n", x301,x302,x303,x304,x305,x306,x307,x308, y301,y302,y303,y304,y305,y306 ); }
-				if(strstr (pc_buffer,"dm-4")){ pc.printf( "\n--- modul DM0806  adr=4 --- \n> inputs:%d%d%d%d%d%d%d%d%  \n> outputs:%d%d%d%d%d%d% \n", x401,x402,x403,x404,x405,x406,x407,x408, y401,y402,y403,y404,y405,y406 ); }
+				if(strstr (pc_buffer,"dm-1"))	{ pc.printf( "\n--- modul DM0806  adr=1 --- \n> inputs:%d%d%d%d%d%d%d%d%  \n> outputs:%d%d%d%d%d%d% \n", x101,x102,x103,x104,x105,x106,x107,x108, y101,y102,y103,y104,y105,y106 ); }
+				if(strstr (pc_buffer,"dm-2"))	{ pc.printf( "\n--- modul DM0806  adr=2 --- \n> inputs:%d%d%d%d%d%d%d%d%  \n> outputs:%d%d%d%d%d%d% \n", x201,x202,x203,x204,x205,x206,x207,x208, y201,y202,y203,y204,y205,y206 ); }
+				if(strstr (pc_buffer,"dm-3"))	{ pc.printf( "\n--- modul DM0806  adr=3 --- \n> inputs:%d%d%d%d%d%d%d%d%  \n> outputs:%d%d%d%d%d%d% \n", x301,x302,x303,x304,x305,x306,x307,x308, y301,y302,y303,y304,y305,y306 ); }
+				if(strstr (pc_buffer,"dm-4"))	{ pc.printf( "\n--- modul DM0806  adr=4 --- \n> inputs:%d%d%d%d%d%d%d%d%  \n> outputs:%d%d%d%d%d%d% \n", x401,x402,x403,x404,x405,x406,x407,x408, y401,y402,y403,y404,y405,y406 ); }
 				
 			}