📄 wtx801.c
字号:
#include "include/mcuapi.h"#define MaxThread 12int main(void){ void *retval[MaxThread]; int k, res, iPort[MaxThread]; pthread_t thread_a[MaxThread]; FlashCopyOut(MyFlashBuff, 0, MaxAccess); //从FLASH中读取后台设置的参数 InitSubDevice(); //参数初始化 TcpInit(); //网络初始化,端口开始 SYS_SetVersion("WTX-801",2,30); //设置程序版本号,计算CRC码 Init_Timer(); //启动定时器,在定时器里刷新看门狗(只监视了A_NetRecv和B_NetRecv) for( k = 1 ; k <= MaxThread ; k++ ) { switch( k ) { case 1: //负责处理接收来自后台A网的命令 res = pthread_create(&thread_a[k-1], NULL, A_NetRecv, (void *)(&iPort[k-1])); break; case 2: //负责处理接收来自后台B网的命令 res = pthread_create(&thread_a[k-1], NULL, B_NetRecv, (void *)(&iPort[k-1])); break; case 3: //负责向后台转发数据 res = pthread_create(&thread_a[k-1], NULL, NetSend, (void *)(&iPort[k-1])); break; case 4: //ModbusTCP res = pthread_create(&thread_a[k-1], NULL, MBTCP, (void *)(&iPort[k-1])); break; default :///////////////////////建立8个串口的数据处理线程/////////////////////////////////// iPort[k-1] = k - 4; switch(COM_Para[iPort[k-1]].Protocol) { case 1://许继800系列保护,串口103规约 res=pthread_create(&thread_a[k-1], NULL, Thread_XJ800BH, (void *)(&iPort[k-1])); break; case 2://GEPLC(MCU801为Modbus主站) res=pthread_create(&thread_a[k-1], NULL, Thread_GEPLC, (void *)(&iPort[k-1])); break; case 3://GR100电量采集装置 res=pthread_create(&thread_a[k-1], NULL, Thread_GR100, (void *)(&iPort[k-1])); break; case 4://天辰温度巡检XSL res=pthread_create(&thread_a[k-1], NULL, Thread_TCWDXJ, (void *)(&iPort[k-1])); break; case 5://SMER-D励磁,只是针对一个装置(规约同福州大学励磁) res=pthread_create(&thread_a[k-1], NULL, Thread_SMER_LC, (void *)(&iPort[k-1])); break; case 6://YWT武汉博士容达水电公司调速器 res=pthread_create(&thread_a[k-1], NULL, Thread_YWT_TSQ, (void *)(&iPort[k-1])); break; case 7://电度表(DL645规约) res=pthread_create(&thread_a[k-1], NULL, Thread_DL645, (void *)(&iPort[k-1])); break; case 8://许继WZCK-11(许继规约) res=pthread_create(&thread_a[k-1], NULL, Thread_WZCK11, (void *)(&iPort[k-1])); break; case 9://许继WCK-3(许继规约) res=pthread_create(&thread_a[k-1], NULL, Thread_WCK3, (void *)(&iPort[k-1])); break; case 10://通过串口以Modbus规约向PLC写数据,功能码0x10 res=pthread_create(&thread_a[k-1], NULL, Thread_MB_Master, (void *)(&iPort[k-1])); break; case 11://GZDW直流系统 res=pthread_create(&thread_a[k-1], NULL, Thread_GZDW, (void *)(&iPort[k-1])); break; case 12://长控所调速器 res=pthread_create(&thread_a[k-1], NULL, Thread_CKSTS, (void *)(&iPort[k-1])); break; case 13://广州电科院励磁 res=pthread_create(&thread_a[k-1], NULL, Thread_DKYLC, (void *)(&iPort[k-1])); break; case 14://辅机控制箱(GE VersaMax PLC) res=pthread_create(&thread_a[k-1], NULL, Thread_FJKZ, (void *)(&iPort[k-1])); break; case 15://Modbus 从站 res=pthread_create(&thread_a[k-1], NULL, Thread_MB_Slave, (void *)(&iPort[k-1])); break; case 16://福建三明TDS温度巡检 res=pthread_create(&thread_a[k-1], NULL, Thread_TDSWDXJ, (void *)(&iPort[k-1])); break; case 17://福建三明TDS转速信号 res=pthread_create(&thread_a[k-1], NULL, Thread_TDSZSXH, (void *)(&iPort[k-1])); break; case 18://西安恒新调速器,励磁 res=pthread_create(&thread_a[k-1], NULL, Thread_PP41, (void *)(&iPort[k-1])); break; case 19://GEC-2 励磁装置 res=pthread_create(&thread_a[k-1], NULL, Thread_GEC2, (void *)(&iPort[k-1])); break; case 20://在串口转串口方案中用于和800保护通讯 res=pthread_create(&thread_a[k-1], NULL, Thread_103COM, (void *)(&iPort[k-1])); break; case 21:////宜昌能达励磁 2005.9.6 scm res=pthread_create(&thread_a[k-1], NULL, Thread_STDLC, (void *)(&iPort[k-1])); break; case 22: //STD调速器装置,宜昌能达电气 res=pthread_create(&thread_a[k-1], NULL, Thread_STDTS, (void *)(&iPort[k-1])); break; case 23://SWL-2 励磁装置 res=pthread_create(&thread_a[k-1], NULL, Thread_SWL2, (void *)(&iPort[k-1])); break; case 24: //武汉BWST调速器 res=pthread_create(&thread_a[k-1], NULL, Thread_BWST, (void *)(&iPort[k-1])); break; case 25: //艾默生公司PSM-A10直流装置CDT规约 res=pthread_create(&thread_a[k-1], NULL, Thread_PSMA10, (void *)(&iPort[k-1])); break; case 26: //西蜀电气SGE-III励磁系统 res=pthread_create(&thread_a[k-1], NULL, Thread_SGE_III, (void *)(&iPort[k-1])); break; case 27: //西蜀电气PCC-2调速器系统(CAN转485后的规约) res=pthread_create(&thread_a[k-1], NULL, Thread_PCC2, (void *)(&iPort[k-1])); break; case 28: //WKLF励磁系统 res=pthread_create(&thread_a[k-1], NULL, Thread_WKLF, (void *)(&iPort[k-1])); break; case 29://杭州萧山之江电控设备厂 调速器 res=pthread_create(&thread_a[k-1], NULL, Thread_XSDK_TS, (void *)(&iPort[k-1])); break; case 30://杭州萧山之江电控设备厂 励磁 res=pthread_create(&thread_a[k-1], NULL, Thread_XSDK_LC, (void *)(&iPort[k-1])); break; case 31://东方电机控制设备公司,HGS调速器,福建黄滩水电站 res=pthread_create(&thread_a[k-1], NULL, Thread_HGS, (void *)(&iPort[k-1])); break; case 32://东方电机控制设备公司,GES励磁装置,福建黄滩水电站 res=pthread_create(&thread_a[k-1], NULL, Thread_GES, (void *)(&iPort[k-1])); break; case 33://KLSF励磁装置,四川金子滩水电站 res=pthread_create(&thread_a[k-1], NULL, Thread_KLSF, (void *)(&iPort[k-1])); break; case 34://RDTSQ调速器装置,四川金子滩水电站 res=pthread_create(&thread_a[k-1], NULL, Thread_RDTSQ, (void *)(&iPort[k-1])); break; case 35://苏州智能控制器(湖南若水电站) res=pthread_create(&thread_a[k-1], NULL, Thread_ST2, (void *)(&iPort[k-1])); break; case 36://南自线路保护(103规约) 四川竹格多电站 res=pthread_create(&thread_a[k-1], NULL, Thread_NZBH, (void *)(&iPort[k-1])); break; case 37://四方保护(103规约) 四川竹格多电站 res=pthread_create(&thread_a[k-1], NULL, Thread_SFBH, (void *)(&iPort[k-1])); break; case 38: //蝶阀控制柜,FX2N PLC 四川竹格多电站 res=pthread_create(&thread_a[k-1], NULL, Thread_FX2N, (void *)(&iPort[k-1])); break; case 39: //卓越辅机,Modbus规约 四川竹格多电站 res=pthread_create(&thread_a[k-1], NULL, Thread_ZhuoYue, (void *)(&iPort[k-1])); break; case 40: //南京深瑞励磁 四川竹格多电站 res=pthread_create(&thread_a[k-1], NULL, Thread_SRLC, (void *)(&iPort[k-1])); break; case 41: //EN3800振摆装置,Modbus规约 四川竹格多电站 res=pthread_create(&thread_a[k-1], NULL, Thread_EN3800, (void *)(&iPort[k-1])); break; case 42: //FX2N RS232接口 湖北桥河一级水电站 res=pthread_create(&thread_a[k-1], NULL, Thread_FX2N232, (void *)(&iPort[k-1])); break; case 43: //天骄调速器 res=pthread_create(&thread_a[k-1], NULL, Thread_TJTSQ, (void *)(&iPort[k-1])); break; case 44: //南自DGT801保护 res=pthread_create(&thread_a[k-1], NULL, Thread_DGT801, (void *)(&iPort[k-1])); break; case 45: //绵阳富邦直流,云南雷达滩 res=pthread_create(&thread_a[k-1], NULL, Thread_FBZL, (void *)(&iPort[k-1])); break; case 46: //台安PLC,四川金子滩主阀控制箱 res=pthread_create(&thread_a[k-1], NULL, Thread_TAPLC, (void *)(&iPort[k-1])); break; case 47://南瑞励磁SAVR2000,云南雷打滩 res=pthread_create(&thread_a[k-1], NULL, Thread_NRLC, (void *)(&iPort[k-1])); break; case 48://天传所励磁USS规约,福建建设水电站 res=pthread_create(&thread_a[k-1], NULL, Thread_USS, (void *)(&iPort[k-1])); break; case 49://武汉三联调速器莫迪康PLC,四川竹格多电站 res=pthread_create(&thread_a[k-1], NULL, Thread_WHSL, (void *)(&iPort[k-1])); break; case 50: //天传所调速器 三菱FX2N可编程控制器 res=pthread_create(&thread_a[k-1], NULL, Thread_TCTSQ, (void *)(&iPort[k-1])); break; case 51: //TDS5000仪表(水位测量) res=pthread_create(&thread_a[k-1], NULL, Thread_TDS5000, (void *)(&iPort[k-1])); break; case 52: //KSX196-H型(一段母线、博为消谐装置) res=pthread_create(&thread_a[k-1], NULL, Thread_KSX196H, (void *)(&iPort[k-1])); break; case 53: //KSX196-HX型(2~4段母线、博为消谐装置) res=pthread_create(&thread_a[k-1], NULL, Thread_KSX196HX, (void *)(&iPort[k-1])); break; case 54: //LH-WLT02双微机励磁装置(武汉联华电气) 一个串口只能接1个励磁装置 res=pthread_create(&thread_a[k-1], NULL, Thread_LHLC, (void *)(&iPort[k-1])); break; case 55: //长沙华能调速器(长沙华能) 三菱FX2N可编程控制器 一个串口只接1个调速器装置 res=pthread_create(&thread_a[k-1], NULL, Thread_HNTSQ, (void *)(&iPort[k-1])); break; case 56: //DJKQ直流监控系统(深圳奥特讯) res=pthread_create(&thread_a[k-1], NULL, Thread_DJKQ, (void *)(&iPort[k-1])); break; case 57: //WZLT型微机励磁装置(武汉星联系统有限公司) res=pthread_create(&thread_a[k-1], NULL, Thread_WZLT, (void *)(&iPort[k-1])); break; case 58: //TCM100巡检仪(四川鲍尔) 422接口,主动上传方式,一个串口只能接1个装置 res=pthread_create(&thread_a[k-1], NULL, Thread_TCM100, (void *)(&iPort[k-1])); break; case 59: //HWJT-08C系列励磁(武汉洪山电工) RS232接口,主动上传方式,一个串口只能接1个装置 res=pthread_create(&thread_a[k-1], NULL, Thread_HWJT08, (void *)(&iPort[k-1])); break; case 60: //LH-WLT01微机励磁装置(武汉联华电气) res=pthread_create(&thread_a[k-1], NULL, Thread_WLT01, (void *)(&iPort[k-1])); break; case 61: //百特仪表(福州福光百特工控) res=pthread_create(&thread_a[k-1], NULL, Thread_BTYB, (void *)(&iPort[k-1])); break; case 62: //CJWT-PLC系列调速器(武汉四创) 台达触摸屏通讯规约 res=pthread_create(&thread_a[k-1], NULL, Thread_TAIDA, (void *)(&iPort[k-1])); break; case 63: //浙江华源直流,福建台江水电站 res=pthread_create(&thread_a[k-1], NULL, Thread_ZJHYZL, (void *)(&iPort[k-1])); break; case 64: //长控所调速器,FX2N系列(遥信、遥测全用字表示),云南勐弄河水电站 res=pthread_create(&thread_a[k-1], NULL, Thread_CKSTSQ, (void *)(&iPort[k-1])); break; case 65: //南自94规约,云南雷打滩水电站 res=pthread_create(&thread_a[k-1], NULL, Thread_NZ94, (void *)(&iPort[k-1])); break; case 66: //西河辅机,三菱PLC,四川西河水电站 res=pthread_create(&thread_a[k-1], NULL, Thread_XHFJ, (void *)(&iPort[k-1])); break; case 67: //西河闸门,三菱PLC,四川西河水电站 res=pthread_create(&thread_a[k-1], NULL, Thread_XHZM, (void *)(&iPort[k-1])); break; case 68: //河北工大电工厂WLZ系列励磁装置,四川西河水电站 res=pthread_create(&thread_a[k-1], NULL, Thread_WLZLC, (void *)(&iPort[k-1])); break; case 69: //球阀控制箱、球阀油压控制箱,四川天生水电站 res=pthread_create(&thread_a[k-1], NULL, Thread_QFKZ, (void *)(&iPort[k-1])); break; case 70: //ABB电度表 res=pthread_create(&thread_a[k-1], NULL, Thread_ABBDDB, (void *)(&iPort[k-1])); break; case 71: //天津科音PCC调速器,广东牛歧水电站 res=pthread_create(&thread_a[k-1], NULL, Thread_PCC, (void *)(&iPort[k-1])); break; case 72: //江苏国瑞同期装置WX98,湖南团湾水电站 res=pthread_create(&thread_a[k-1], NULL, Thread_WX98, (void *)(&iPort[k-1])); break; case 73: //ZDMER-2励磁,湖南大兴二级水电站 res=pthread_create(&thread_a[k-1], NULL, Thread_ZDMER2, (void *)(&iPort[k-1])); break; case 74: //河北工大DWLZ励磁 res=pthread_create(&thread_a[k-1], NULL, Thread_DWLZ, (void *)(&iPort[k-1])); break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -