前言:
而今同学们对“信捷plc编程软件教程”大概比较关怀,同学们都需要了解一些“信捷plc编程软件教程”的相关资讯。那么小编同时在网络上收集了一些对于“信捷plc编程软件教程””的相关文章,希望看官们能喜欢,大家快快来了解一下吧!信捷PLC编程软件XDPPro,里面有arm-none-eabi的gcc程序,测试所用型号的SOC为ST的Cortex-M7。用C语言编程的自由度很高,如果有能力接管编译过程,各种高级数据结构更是锦上添花。
初步测试了GCC的调用过程,从抓取到的一些信息看,用户手册中未详述的魔术操作,在源码中反而直白明了。
如果利用C语言开发出实用的数据结构和算法,这种小型PLC的应用场景还是很多的,毕竟有1MB的程序空间,要填满真不容易。附上gcc调用参数和文件核心内容:源码 -> *.c -> *.i
//XDPPro v3.7.4b, PLC XL5E-16//调用记录arm-none-eabi-*.exe2021-11-20 23:32:57.655 C:\XDPPro\TOOL\XD\bin\arm-none-eabi-gcc.exe -save-temps //保留临时文件,在*-gcc.exe同层文件夹中:FUNC1.i FUNC1.s..\..\..\tmp\PrjFuncB\FUNC1.c -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -nostartfiles -o ..\..\..\tmp\PrjFuncB\FUNC1.o -I ..\inc -c -fsigned-char -g -ffunction-sections -mlittle-endian2021-11-20 23:33:03.871 C:\XDPPro\TOOL\XD\bin\arm-none-eabi-ld.exe -T ..\..\..\tmp\PrjFuncB\stm32_flash.ld -Map=..\..\..\tmp\PrjFuncB\xd.map -s -o ..\..\..\tmp\PrjFuncB\xd.out ..\..\..\tmp\PrjFuncB\Ladder1.o ..\..\..\tmp\PrjFuncB\FUNC1.o..\..\..\tmp\PrjFuncB\sysRegAddr.o ..\..\..\tmp\PrjFuncB\sysFuncAddr.o -L ..\lib\M7 -lm -lgcc -lc2021-11-20 23:33:04.257 C:\XDPPro\TOOL\XD\bin\arm-none-eabi-objdump.exe -s -D -marm ..\..\..\tmp\PrjFuncB\xd.out2021-11-20 23:33:07.555 C:\XDPPro\TOOL\XD\bin\arm-none-eabi-ld.exe -T ..\..\..\tmp\PrjFuncB\stm32_flash.ld -Map=..\..\..\tmp\PrjFuncB\xd.map -s -o ..\..\..\tmp\PrjFuncB\xd.out ..\..\..\tmp\PrjFuncB\TGLadder1.o -L ..\lib\M7 -lm -lgcc -lc2021-11-20 23:33:07.930 C:\XDPPro\TOOL\XD\bin\arm-none-eabi-objdump.exe -s -D -marm ..\..\..\tmp\PrjFuncB\xd.out//end_//调用记录//file:源文件_FUNC1/************************************************************************* FunctionBlockName: FUNC1 Version: 1.0.0 Author: thj UpdateTime: 2021-11-14 16:39:43 Comment: abcd 12345678**************************************************************************/#define thj_FUNC1void FUNC1(WORD W, BIT B){#define SysRegAddr_HD_D_HM_M unsigned long* p0 = (unsigned long*)&D[0]; (*p0)++;#define pD4_Float (( float * ) &D[4]) * pD4_Float = 1.2345; //* ( ( float * ) &D[4] ) = 1.2345; strcpy((char*)&D[20], "a一二b1234"); //GB18030 *((wchar_t*)&D[30]) = L'\x1234'; *((double*)&D[40]) = sqrt(2); *((double*)&D[50]) = 1122334455.0;}//end_源文件//file:FUNC1.c#define ARM_M7#include "funcb.h" #define thj_FUNC1void FUNC1(WORD W, BIT B){ asm("PUSH {R0}"); asm("MRS R0,CONTROL"); asm("ORR R0,R0,#0x1"); asm("MSR CONTROL,R0"); asm("POP {R0}"); short NeedCompileSysRegAddr; extern short __HD; short* HD = (short*)&__HD; char* B_HD = (char*)&__HD; extern short __D; short* D = (short*)&__D; char* B_D = (char*)&__D; extern char __HM; INT32U HM = (INT32U)&__HM; extern char __M; INT32U M = (INT32U)&__M; unsigned long* p0 = (unsigned long*)&D[0]; (*p0)++;#define pD4_Float (( float * ) &D[4]) * pD4_Float = 1.234; strcpy((char*)&D[20], "a一二b1234"); *((wchar_t*)&D[30]) = L'\x1234'; *((double*)&D[40]) = sqrt(2); *((double*)&D[50]) = 1122334455.0; asm("svc 0x01");}//end_FUNC1.c//file:FUNC1.ivoid FUNC1_i(INT16S* W, INT32U B){ asm("PUSH {R0}"); asm("MRS R0,CONTROL"); asm("ORR R0,R0,#0x1"); asm("MSR CONTROL,R0"); asm("POP {R0}");#define SysRegAddr_HD_D_HM_M short NeedCompileSysRegAddr; extern short __HD; short* HD = (short*)&__HD; char* B_HD = (char*)&__HD; extern short __D; short* D = (short*)&__D; char* B_D = (char*)&__D; extern char __HM; INT32U HM = (INT32U)&__HM; extern char __M; INT32U M = (INT32U)&__M;//end_define unsigned long* p0 = (unsigned long*)&D[0]; (*p0)++; *((float*)&D[4]) = 1.234; strcpy((char*)&D[20], "a一二b1234"); *((wchar_t*)&D[30]) = L'\x1234'; *((double*)&D[40]) = sqrt(2); *((double*)&D[50]) = 1122334455.0; asm("svc 0x01");}//end_FUNC1.i
标签: #信捷plc编程软件教程 #信捷plc编程实例 #信捷plc编程手册 #信捷plc编程软件手机版