etherlab/EthercatCIA402Slave.py
changeset 2363 9c7da6ff6a34
parent 2362 6d31ef14f396
child 2364 4ea781f30555
equal deleted inserted replaced
2362:6d31ef14f396 2363:9c7da6ff6a34
   190              "location", "AXIS_REF", self.CTNName(), ""))
   190              "location", "AXIS_REF", self.CTNName(), ""))
   191 
   191 
   192     def CTNGenerate_C(self, buildpath, locations):
   192     def CTNGenerate_C(self, buildpath, locations):
   193         current_location = self.GetCurrentLocation()
   193         current_location = self.GetCurrentLocation()
   194 
   194 
   195         location_str = "_".join(map(lambda x:str(x), current_location))
   195         location_str = "_".join(map(lambda x: str(x), current_location))
   196         slave_pos = self.GetSlavePos()
   196         slave_pos = self.GetSlavePos()
   197         MCL_headers = Headers
   197         MCL_headers = Headers
   198 
   198 
   199         # Open CIA402 node code template file
   199         # Open CIA402 node code template file
   200         plc_cia402node_filepath = os.path.join(os.path.split(__file__)[0],
   200         plc_cia402node_filepath = os.path.join(os.path.split(__file__)[0],
   329                                 "cia402node_%s.c" % location_str)
   329                                 "cia402node_%s.c" % location_str)
   330         cia402nodefile = open(Gen_CIA402Nodefile_path, 'w')
   330         cia402nodefile = open(Gen_CIA402Nodefile_path, 'w')
   331         cia402nodefile.write(plc_cia402node_code % locals())
   331         cia402nodefile.write(plc_cia402node_code % locals())
   332         cia402nodefile.close()
   332         cia402nodefile.close()
   333 
   333 
   334         return [(Gen_CIA402Nodefile_path, '"-I%s"' % os.path.abspath(self.GetCTRoot().GetIECLibPath()))],"",True
   334         return [(Gen_CIA402Nodefile_path, '"-I%s"' % os.path.abspath(self.GetCTRoot().GetIECLibPath()))], "", True