Jelajahi Sumber

changed to assembly object instances for the demo project to be in the 8 bit range

Alois Zoitl 14 tahun lalu
induk
melakukan
24dc7a531a
2 mengubah file dengan 26 tambahan dan 24 penghapusan
  1. 3 3
      data/opener_sample_app.eds
  2. 23 21
      src/ports/platform-pc/main.c

+ 3 - 3
data/opener_sample_app.eds

@@ -67,7 +67,7 @@ $ EZ-EDS Version 3.9 Generated Electronic Data Sheet
                 ,,                      $ config #2 size, format
                 "Exlusive Owner",       $ Connection Name
                 "",                     $ help string
-                "20 04 25 00 03 03 2D 00 02 03 2D 00 01 03";    $ Path
+                "20 04 24 97 2C 96 2C 64";    $ Path
         Connection2 =
                 0x02000002,             $ 0-15    = supported transport classes
                                         $ 16      = trigger: cyclic
@@ -112,7 +112,7 @@ $ EZ-EDS Version 3.9 Generated Electronic Data Sheet
                 ,,                      $ config #2 size, format
                 "Input Only",           $ Connection Name
                 "",                     $ help string
-                "20 04 25 00 03 03 2D 00 04 03 2D 00 01 03";    $ Path
+                "20 04 24 97 2C 98 2C 64";    $ Path
         Connection3 =
                 0x01000002,             $ 0-15    = supported transport classes
                                         $ 16      = trigger: cyclic
@@ -157,5 +157,5 @@ $ EZ-EDS Version 3.9 Generated Electronic Data Sheet
                 ,,                      $ config #2 size, format
                 "Listen Only",          $ Connection Name
                 "",                     $ help string
-                "20 04 25 00 03 03 2D 00 05 03 2D 00 01 03";    $ Path
+                "20 04 24 97 2C 99 2C 64";    $ Path
 

+ 23 - 21
src/ports/platform-pc/main.c

@@ -12,17 +12,19 @@
 #include "cipcommon.h"
 #include "trace.h"
 
-#define DEMO_APP_INPUT_ASSEMBLY_NUM                0x301
-#define DEMO_APP_OUTPUT_ASSEMBLY_NUM               0x302
-#define DEMO_APP_CONFIG_ASSEMBLY_NUM               0x303
-#define DEMO_APP_HEARBEAT_INPUT_ONLY_ASSEMBLY_NUM  0x304
-#define DEMO_APP_HEARBEAT_LISTEN_ONLY_ASSEMBLY_NUM 0x305
-#define DEMO_APP_EXPLICT_ASSEMBLY_NUM              0x306
-
-/* global variables for demo application (4 assembly data fields) */EIP_UINT8 g_assemblydata301[32]; /* Input */
-EIP_UINT8 g_assemblydata302[32]; /* Output */
-EIP_UINT8 g_assemblydata303[10]; /* Config */
-EIP_UINT8 g_assemblydata306[32]; /* Explicit */
+#define DEMO_APP_INPUT_ASSEMBLY_NUM                100 //0x064
+#define DEMO_APP_OUTPUT_ASSEMBLY_NUM               150 //0x096
+#define DEMO_APP_CONFIG_ASSEMBLY_NUM               151 //0x097
+#define DEMO_APP_HEARBEAT_INPUT_ONLY_ASSEMBLY_NUM  152 //0x098
+#define DEMO_APP_HEARBEAT_LISTEN_ONLY_ASSEMBLY_NUM 153 //0x099
+#define DEMO_APP_EXPLICT_ASSEMBLY_NUM              154 //0x09A
+
+
+/* global variables for demo application (4 assembly data fields)  ************/
+EIP_UINT8 g_assemblydata064[32]; /* Input */
+EIP_UINT8 g_assemblydata096[32]; /* Output */
+EIP_UINT8 g_assemblydata097[10]; /* Config */
+EIP_UINT8 g_assemblydata09A[32]; /* Explicit */
 
 extern int newfd;
 
@@ -112,16 +114,16 @@ IApp_Init(void)
 {
   /* create 3 assembly object instances*/
   /*INPUT*/
-  createAssemblyObject(DEMO_APP_INPUT_ASSEMBLY_NUM, &g_assemblydata301[0],
-      sizeof(g_assemblydata301));
+  createAssemblyObject(DEMO_APP_INPUT_ASSEMBLY_NUM, &g_assemblydata064[0],
+      sizeof(g_assemblydata064));
 
   /*OUTPUT*/
-  createAssemblyObject(DEMO_APP_OUTPUT_ASSEMBLY_NUM, &g_assemblydata302[0],
-      sizeof(g_assemblydata302));
+  createAssemblyObject(DEMO_APP_OUTPUT_ASSEMBLY_NUM, &g_assemblydata096[0],
+      sizeof(g_assemblydata096));
 
   /*CONFIG*/
-  createAssemblyObject(DEMO_APP_CONFIG_ASSEMBLY_NUM, &g_assemblydata303[0],
-      sizeof(g_assemblydata303));
+  createAssemblyObject(DEMO_APP_CONFIG_ASSEMBLY_NUM, &g_assemblydata097[0],
+      sizeof(g_assemblydata097));
 
   /*Heart-beat output assembly for Input only connections */
   createAssemblyObject(DEMO_APP_HEARBEAT_INPUT_ONLY_ASSEMBLY_NUM, 0, 0);
@@ -130,8 +132,8 @@ IApp_Init(void)
   createAssemblyObject(DEMO_APP_HEARBEAT_LISTEN_ONLY_ASSEMBLY_NUM, 0, 0);
 
   /* assembly for explicit messaging */
-  createAssemblyObject(DEMO_APP_EXPLICT_ASSEMBLY_NUM, &g_assemblydata306[0],
-      sizeof(g_assemblydata306));
+  createAssemblyObject(DEMO_APP_EXPLICT_ASSEMBLY_NUM, &g_assemblydata09A[0],
+      sizeof(g_assemblydata09A));
 
   configureExclusiveOwnerConnectionPoint(0, DEMO_APP_OUTPUT_ASSEMBLY_NUM,
       DEMO_APP_INPUT_ASSEMBLY_NUM, DEMO_APP_CONFIG_ASSEMBLY_NUM);
@@ -173,8 +175,8 @@ IApp_AfterAssemblyDataReceived(S_CIP_Instance *pa_pstInstance)
   case DEMO_APP_OUTPUT_ASSEMBLY_NUM:
     /* Data for the output assembly has been received.
      * Mirror it to the inputs */
-    memcpy(&g_assemblydata301[0], &g_assemblydata302[0],
-        sizeof(g_assemblydata301));
+    memcpy(&g_assemblydata064[0], &g_assemblydata096[0],
+        sizeof(g_assemblydata064));
     break;
   case DEMO_APP_EXPLICT_ASSEMBLY_NUM:
     /* do something interesting with the new data from