BeckHoff <---> Keyence (MD-X)激光 刻印机 Profient 通讯
目录
一、 设备介绍
一、设备图片
二、设备描述
1、主要特点:
2、技术参数
3、应用场景
二、PLC通讯接配置
2.1 PLC里添加 GSDML 文件
2.2 输入变量实例化,并映射到通讯端口
2.3 输出变量实例化,并映射到通讯端口
三、设备通讯接口数据类型定义
3.1 定义激光刻印机结构体
3.2 定义激光刻印机结构体-input
3.3 定义激光刻印机结构体-Output
3.4 定义 定义激光刻印机 通讯商品全局变量
四、"FB_TYP_172_Laser_Marker_X450"通讯功能块变量声明
五、"FB_TYP_172_Laser_Marker_X450"通讯功能块程序
六、"FB_TYP_172_Laser_Marker_X450"通讯功能块程序分析
6.1 整体架构与核心功能
6.2 关键数据结构与变量
6.3 状态机执行流程解析
6.4 设备交互与命令协议
6.5 错误处理与诊断机制
6.6 优化与扩展点
6.7 总结
七、"FB_TYP_172_Laser_Marker_X450"通讯功能块描述
7.1 改进空间分析
1. 代码结构优化
2. 错误处理增强
3. 性能优化
4. 配置灵活性
5. 用户交互与监控
6. 安全机制
7. 功能扩展
8. 代码健壮性
7.2 改进示例:模块化重构
八、附录
8.1 ACfinalCopyData 子程序
一、 设备介绍
一、设备图片
二、设备描述
基恩士 MD - X 系列激光刻印机是一款在工业领域具有广泛应用的高精度激光加工设备,
1、主要特点:
- 高精度刻印:采用先进的激光技术,能够实现高精度的文字、图案、二维码等刻印。可以在各种材料表面刻画出精细的线条和清晰的图案,字符最小可达到微米级别,满足了对微小零件或高精度标识有要求的行业需求,如电子、医疗、汽车零部件等行业。
- 多种刻印方式:支持多种刻印方式,包括打点、划线、填充等,可以根据不同的刻印需求进行灵活选择。此外,还能实现旋转刻印、曲面刻印等特殊功能,适应各种形状和尺寸的工件加工。
- 高速刻印:具备较高的刻印速度,能够在短时间内完成大量的刻印任务,提高生产效率。例如,对于一些简单的文字和图案,每秒可完成多个刻印动作,适用于自动化生产线的高速作业。
- 操作简便:配备直观的操作界面和易于使用的软件,操作人员可以快速上手。通过软件可以方便地进行图案设计、参数调整、刻印预览等操作,无需复杂的编程知识。同时,设备还支持多种文件格式导入,如 DXF、AI、PDF 等,方便用户直接使用现有的设计文件。
- 稳定性高:采用高品质的激光器和精密的机械结构,确保设备在长时间运行过程中保持稳定的性能。具有良好的散热系统和防尘设计,能够适应不同的工作环境,减少因环境因素导致的设备故障,提高设备的可靠性和使用寿命。
2、技术参数
- 激光波长:根据不同的型号和应用需求,可能提供多种激光波长选择,如常见的 1064nm(光纤激光器)、355nm(紫外激光器)等。不同波长的激光适用于不同的材料和刻印效果要求,例如紫外激光器更适合对精细度要求高的材料进行加工。
- 激光功率:功率范围通常在几瓦到几十瓦之间,具体功率大小根据型号而定。较高的激光功率可以实现更深的刻印深度和更快的刻印速度,但对于一些薄型材料或对热影响敏感的材料,则可以选择较低功率的激光器,以避免材料过热或变形。
- 刻印范围:可支持的刻印范围大小有所不同,一般常见的有 100mm×100mm、200mm×200mm 等规格,也有一些大型号设备能够实现更大范围的刻印。用户可以根据实际工件的大小选择合适的刻印范围。
- 重复精度:重复精度通常可达到 ±0.01mm 甚至更高,确保每次刻印的位置和精度都能保持高度一致,这对于需要进行多批次、高精度刻印的生产过程非常重要。
3、应用场景
- 电子行业:用于在电子元器件、电路板、手机外壳等表面刻印型号、序列号、生产日期、二维码等信息,以便于产品的追溯和管理。同时,高精度的刻印能够满足电子元件小型化、精细化的发展趋势。
- 汽车制造:可在汽车零部件如发动机缸体、轮毂、车身等部位刻印标识、图案、VIN 码等。激光刻印的永久性和高精度有助于提高汽车零部件的质量追溯性和品牌标识的清晰度,同时也能满足汽车生产线上的高速自动化生产需求。
- 医疗领域:在医疗器械、药品包装、医用耗材等方面有广泛应用。例如,在注射器、输液器等一次性医疗用品上刻印批次号、有效期等信息;在骨科植入物、牙科器械等医疗器械上刻印产品型号、规格、序列号等,便于产品的跟踪和管理,保障医疗安全。
- 五金制品:对各种金属制品如刀具、工具、锁具等进行刻印,可刻上品牌标识、规格参数、花纹图案等,提升产品的附加值和美观度,同时也起到了防伪和品牌宣传的作用。
- 塑料及复合材料:适用于在塑料零件、塑料包装、复合材料等表面进行刻印。可以实现清晰的文字和图案标记,并且通过调整激光参数,能够控制对材料的热影响,避免材料变形或损坏。
二、PLC通讯接配置
2.1 PLC里添加 GSDML 文件
2.2 输入变量实例化,并映射到通讯端口
2.3 输出变量实例化,并映射到通讯端口
三、设备通讯接口数据类型定义
3.1 定义激光刻印机结构体
3.2 定义激光刻印机结构体-input
TYPE ST_Laser_Marker_Input :
STRUCTReady :BOOL; //Whether it is Ready state appears. Bit "1" accepts operations such as setting change, character string edition, program no. fixation input, and others.
Error :BOOL; //Whether an abnormal error has occurred or not appears.
Warning :BOOL; //Whether or not there is a warning on the laser marker.
IO_Error :BOOL; //Whether or not there is an error caused by the I/O terminal. For example, the laser is under remote interlock or shutter control.
Shutter :BOOL; //Whether the internal shutter is opened or closed.
Network :BOOL; //The status of the Fieldbus network communication.
Job_Change_Ready:BOOL; //Whether or not the laser is ready to accept a program change request.
Distance_Laser_Ready :BOOL; //Displays the Ready state of the distance laser.
Laser_Emitted :BOOL; //The laser excitation status.
Shutter_Control :BOOL; //Whether the shutter control I/O input is on or off.
Remote_Interlock :BOOL; //Whether the remote interlock I/O input is on or off.
Laser_Safety_Module :BOOL; //Displays whether the laser safety module control input is on or off.(0: OFF (Close).1: ON (Open))
Logging_Trigger :BOOL; //Displays whether the logging trigger input is on or off
External_Lighting_Control:BOOL;//Displays whether the external lighting control output is on or off
Spare_Byte1_6 :BOOL;
Spare_Byte1_7 :BOOL;
Busy :BOOL; //This bit is "1" when any one of bits of busy status is "1."
Marking_Busy :BOOL; //Whether or not the laser is marking.
Guide_Laser_Busy :BOOL; //Whether the guide laser or distance pointer is in operation.
Job_Change_Busy_Status :BOOL; //Whether or not the settings are being expanded. Expansion occurs during operations such as program change and character string change.
Communication_Priority_Error:BOOL; //This bit is "1" when the laser marker has been connected to other PLCs or control devices and this device does not have priority.
Job_Edit_Busy :BOOL; //Whether or not the program is being edited.
Mark_Check_2DC_Read_Busy :BOOL; //Whether OR NOT marking verification OR 2D code reading is in progress.
Window_Monitoring_Busy :BOOL; //Turns on during the lens inspection
Spare_Byte3 :BYTE;
Trigger_Lock :BOOL; //Whether the trigger lock I/O input is on or off.
Operation_Stop :BOOL; //Whether or not the marking laser is stopped with the shutter open
Laser_Control :BOOL; //Whether or not the marking laser is stopped with the shutter closed.
Date_Hold :BOOL; //Whether or not he date hold I/O input is on or off.
Internal_Lighting :BOOL; //Displays whether the internal lighting control input is on or off
Distance_Laser_Stop :BOOL; //Displays whether the distance laser stop input is on or off
Spare_Byte4_6 :BOOL;
Spare_Byte4_7 :BOOL;
Date_Attach :BOOL; //while the date hold input is ON. This bit value remains “1” for as long as the date hold input is held on.
Counter_End1 :BOOL; //Whether or not the specified counter has completed marking the final value.
Counter_End2 :BOOL; //
Counter_End3 :BOOL; //
Counter_End4 :BOOL; //
Mark_Check_2DC_Read_OK1 :BOOL; //Displays whether the marking verification function or 2D code grade assessment result is OK or not
Mark_Check_2DC_Read_NG1 :BOOL; //Displays whether the marking verification function or 2D code grade assessment result is OK or not.*
Marking_Complete_1 :BOOL; //Whether the trigger lock I/O input is on or off.
Mark_Check_2DC_Read_OK2 :BOOL; //Displays whether the marking verification function or 2D code grade assessment result is OK or not
Mark_Check_2DC_Read_NG2 :BOOL; //Displays whether the marking verification function or 2D code grade assessment result is OK or not.*
_3Axis_Tracking_OK :BOOL; //Turns on for a fixed time when using the XY tracking/Z tracking function
_3Axis_Tracking_NG :BOOL; //Turns on for a fixed time when using the XY tracking/Z tracking function
Spare_Byte6_4 :BOOL;
Spare_Byte6_5 :BOOL;
Spare_Byte6_6 :BOOL;
Spare_Byte6_7 :BOOL;
Spare_Byte7 :BYTE;
Marking_Complete_2 :BOOL; //Whether the marking has been completed or not appears.
Guide_Laser_Complete :BOOL; // Whether or not the guide laser marking has completed.
Laser_Stop_Complete :BOOL; //Whether or not the marking stop operation has been completed
Error_Clear_Complete :BOOL; //Whether or not the error clearing operation has completed.
_2DC_Read_Complete :BOOL; //Whether or not the 2D code reading operation has completed.
Window_Monitoring_Complete:BOOL; //Turns on when completing the lens inspection
Spare_Byte8_6 :BOOL;
Spare_Byte8_7 :BOOL;
Job_Edit_Complete :BOOL; //Whether or not the setting change has been completed.
Spare_Byte9_1 :BOOL;
Spare_Byte9_2 :BOOL;
Spare_Byte9_3 :BOOL;
Spare_Byte9_4 :BOOL;
Spare_Byte9_5 :BOOL;
Spare_Byte9_6 :BOOL;
Spare_Byte9_7 :BOOL;
Job_Change_Complete :BOOL; //Whether the setting no. has been changed or not appears.
Rank_Change_Complete :BOOL; //Whether the rank value has been changed or not appears.
Counter_No_Complete :BOOL; //Whether or not the counter no. has been changed.
Counter_Value_Complete :BOOL; //Whether or not the counter value has been changed.
Counter_Up_Complete :BOOL; //Whether or not the counter has been incremented.
Counter_Down_Complete :BOOL; //Whether or not the counter has been decremented.
Counter_Reset_Complete :BOOL; //Whether or not the counter has been reset.
Spare_Byte10_7 :BOOL;
System_Info_ID_Change_Complete :BOOL; //Displays the changing completion of the operation information ID by System Info ID Change Request
Spare_Byte11_1 :BOOL;
Spare_Byte11_2 :BOOL;
Spare_Byte11_3 :BOOL;
Spare_Byte11_4 :BOOL;
Spare_Byte11_5 :BOOL;
Spare_Byte11_6 :BOOL;
Spare_Byte11_7 :BOOL;
Set_String_Read_Complete :BOOL; //Whether or not the set character string has been loaded.
Marked_String_Read_Complete:BOOL; //Whether or not the marked character string has been loaded.
String_Change_Complete :BOOL; //Whether or not the character string has been set.
Spare_Byte12_3 :BOOL;
Spare_Byte12_4 :BOOL;
Spare_Byte12_5 :BOOL;
Spare_Byte12_6 :BOOL;
Spare_Byte12_7 :BOOL;
Spare_Byte13 :BYTE;
Spare_Byte14 :BYTE;
Command_Send_Complete :BOOL; //Whether the command communication has been sent.
XY_Tracking_Result_Read_Complete :BOOL; //Display the completion status of XY Tracking Result Request
Z_Tracking_Result_Read_Complete :BOOL; //Display the completion status of Z Tracking Result Request
Spare_Byte15_3 :BOOL;
Spare_Byte15_4 :BOOL;
Spare_Byte15_5 :BOOL;
Spare_Byte15_6 :BOOL;
Spare_Byte15_7 :BOOL;
Start_Marking_Request_Error:BOOL; //Whether or not there is an error with the Start Marking Request.
Guide_Laser_Request_Error :BOOL; //Whether or not there is an error with the Guide Laser Request.
Stop_Marking_Request_Error:BOOL; //Whether or not there is an error with the Stop Marking Request.
Error_Clear_Request_Error :BOOL; //Whether or not there is an error with the Error Clear Request.
_2DC_Read_Request_Error :BOOL; //Whether or not there is an error with the 2D Code Read Request.
Window_Monitoring_Request_Error :BOOL; //If a Window Monitoring Request fails in the lens inspection operation, it turns on
Spare_Byte16_6 :BOOL;
Spare_Byte16_7 :BOOL;
Job_Edit_Error :BOOL; //Whether the setting edition error status is active or not appears.
Spare_Byte17_1 :BOOL;
Spare_Byte17_2 :BOOL;
Spare_Byte17_3 :BOOL;
Spare_Byte17_4 :BOOL;
Spare_Byte17_5 :BOOL;
Spare_Byte17_6 :BOOL;
Spare_Byte17_7 :BOOL;
Job_Change_Request_Error :BOOL; //Whether or not there is an error with the Program Change Request.
Rank_Change_Request_Error :BOOL; //Whether or not there is an error with the Rank Change Request.
Counter_No_Change_Request_Error :BOOL; //Whether or not there is an error with the Counter No. Change Request.
Counter_Value_Change_Request_Error:BOOL; //Whether or not there is an error with the Counter Value Change Request.
Counter_Up_Request_Error :BOOL; //Whether or not there is an error with the Counter Up Request.
Counter_Down_Request_Error :BOOL; //Whether or not there is an error with the Counter Down Request.
Counter_Reset_Request_Error:BOOL; //Whether or not there is an error with the Counter Reset Request.
System_Info_ID_Change_Error:BOOL; //a change of the operation information ID with a System Info ID Change Request fails, it turns on
Spare_Byte19 :BYTE;
Set_String_Request_Error :BOOL; //Whether or not there is an error with the set string request.
Marked_String_Request_Error:BOOL; //Whether or not there is an error with the marked string request.
String_Change_Request_Error:BOOL; //Whether or not there is an error with the String Change Request.
Spare_Byte20_3 :BOOL;
Spare_Byte20_4 :BOOL;
Spare_Byte20_5 :BOOL;
Spare_Byte20_6 :BOOL;
Spare_Byte20_7 :BOOL;
Spare_Byte21 :BYTE;
Spare_Byte22 :BYTE;
Command_Send_Request_Error:BOOL; //Whether or not there is an error with the Command Send Request