4638 lines
165 KiB
C
4638 lines
165 KiB
C
|
/********************************************************/
|
|||
|
// CPU<50><55>Ҫ<EFBFBD><D2AA>STM32F103--RAM<41>ڴ治С<E6B2BB><D0A1>64K Flash<73>ڴ治С<E6B2BB><D0A1>128K
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>STM32F103RDT6<54><36>VET6<54><36><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>
|
|||
|
// <20>༭<EFBFBD><E0BCAD><EFBFBD>ڣ<EFBFBD>20150909
|
|||
|
// editor by СС<D0A1><D0A1>
|
|||
|
// <20><><EFBFBD>꣺shop182385147.taobao.com
|
|||
|
/********************************************************/
|
|||
|
|
|||
|
#include "stm32f10x.h"
|
|||
|
#include <stdio.h>
|
|||
|
#include "PLC_IO.h"
|
|||
|
#include "PLC_Dialogue.h"
|
|||
|
#include "math.h" //<2F><>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#include "Gray.h" //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
|||
|
#include "PLC_CONF.H"
|
|||
|
|
|||
|
extern void RST_T_D_C_M_data(void); //ADD 20151214
|
|||
|
extern unsigned char Y0P,Y1P; //
|
|||
|
extern unsigned short Plus_CMP0,Plus_CMP1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־λ
|
|||
|
extern u8 X_DIY; //<2F>˲<EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
extern u16 PLC_RUN_TIME; //ɨ<><C9A8>ʱ<EFBFBD><CAB1>
|
|||
|
extern void RTC_Set(u16 syear,u8 smon,u8 sday,u8 hour,u8 min,u8 sec);//ʱ<><CAB1><EFBFBD>ij<DEB8><C4B3><EFBFBD>
|
|||
|
extern void PLC_IO_Refresh(void); //IOˢ<4F><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
extern u16 PLC_16BIT[12100]; //PLC_RAM<41><4D><EFBFBD>мĴ<D0BC><C4B4><EFBFBD>
|
|||
|
extern void timer_enable(u16 timer_number); //<2F>˴<EFBFBD><CBB4>ڶ<EFBFBD>ʱ<EFBFBD><CAB1>2<EFBFBD><32><EFBFBD>棬<EFBFBD><E6A3AC><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
extern void timer_disble(u16 timer_number); //<2F>˴<EFBFBD><CBB4>ڶ<EFBFBD>ʱ<EFBFBD><CAB1>2<EFBFBD><32><EFBFBD><EFBFBD>
|
|||
|
static u8 PLC_ACC_BIT,PLC_MPS_BIT; //<2F><><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>ר<EFBFBD><D7A8>(<28><><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ)
|
|||
|
static const u16 *PLC_Addr; //PLC<4C><43><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
static const u16 *PLC_Err; //PLC<4C><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
static u8 T_number,C_number; //T&C<><43>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
static u16 T_value; //T<>Ƚϻ<C8BD><CFBB><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
static u16 C_value; //C<>Ƚϻ<C8BD><CFBB><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
static u32 mov_d_addr; //K?M&Y&S&Xָ<58><EFBFBD><EEBBBA>
|
|||
|
static const u16 *PLC_P_Addr[129]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD>ȡָ<C8A1><D6B8>
|
|||
|
static const u16 *p_save[129]; //<2F><><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ִ<EFBFBD>е<EFBFBD>λ
|
|||
|
u8 Flag_bit=0xff,Transfer_bit,Transfer_bit1;//<2F><>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD>k<EFBFBD>ı<EFBFBD>־λ <20><>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CPU<50><55><EFBFBD><EFBFBD>
|
|||
|
u16 process[64]; //<2F><><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD>ֵ
|
|||
|
u32 trade; //<2F><><EFBFBD><EFBFBD><EFBFBD>ڼӼ<DABC><D3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CPU<50><55><EFBFBD><EFBFBD>
|
|||
|
u16 Transfer=0; //<2F><><EFBFBD>ö<EFBFBD><C3B6>ش<EFBFBD><D8B4>ݺͳ<DDBA><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CPU<50><55><EFBFBD><EFBFBD>
|
|||
|
u8 edit_prog; //<2F><><EFBFBD>±<EFBFBD><C2B1>̻<EFBFBD><CCBB><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
extern u8 Write_Pro_flag;
|
|||
|
const unsigned char PLC_BIT_OR[]={0X01,0X02,0X04,0X08,0X10,0X20,0X40,0X80};
|
|||
|
const unsigned char PLC_BIT_AND[]={0XFE,0XFD,0XFB,0XF7,0XEF,0XDF,0XBF,0X7F};
|
|||
|
float_union FLOAT;
|
|||
|
s32_union u32data,u32data1;
|
|||
|
u64_union u64data,u64data2;
|
|||
|
|
|||
|
/***************************************************FOR**************************************************/
|
|||
|
struct
|
|||
|
{
|
|||
|
const u16 *Addr[7]; //FOR <20><>ַ<EFBFBD><D6B7>¼
|
|||
|
u16 cycle[7]; //<2F><>ǰѭ<C7B0><D1AD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
u16 count[7]; //Ŀ<><C4BF>ѭ<EFBFBD><D1AD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
u8 point; //forָ<72><D6B8><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD>
|
|||
|
} FOR_CMD;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/***************************************************STL**************************************************/
|
|||
|
static u16 PLC_STL_Addr; //STLָ<4C><D6B8><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>
|
|||
|
static u8 PLC_STL_Status; //STLָ<4C>ǰ״̬ 0<><30><EFBFBD>׳<EFBFBD><D7B3><EFBFBD>û<EFBFBD><C3BB>STL״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1ΪSTL<54><4C>״̬<D7B4><CCAC>2ΪSTLֹͣ״̬
|
|||
|
static u8 PLC_STL_CMD; //STL<54><4C>־
|
|||
|
static u8 PLC_STL_Count; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȧ<EFBFBD><C8A6><EFBFBD><EFBFBD>
|
|||
|
static u16 PLC_STL_Coil[256]; //<2F><>Ȧ<EFBFBD><C8A6><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
/********************************************************************************************************/
|
|||
|
static u8 PLC_PL_BIT_TEST(u16 x){return((Step_Address[(x)/8] & PLC_BIT_OR[(x)%8])) ? (1) : (0);}
|
|||
|
static u8 PLC_LD_BIT(u16 x){return((PLC_RAM8(RAM_ADDR+((x)/8)) & PLC_BIT_OR[(x)%8])) ? (1) : (0) ;}
|
|||
|
|
|||
|
static u8 PLC_LDP_TEST(void) //<2F>鿴<EFBFBD>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
if(PLC_PL_BIT_TEST(PLC_Addr-PLC_START_Address)==off)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
{
|
|||
|
PLC_PL_BIT_ON(PLC_Addr-PLC_START_Address); //
|
|||
|
return 1;
|
|||
|
}
|
|||
|
else return 0;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if(!(PLC_ACC_BIT&0x01)) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_PL_BIT_OFF(PLC_Addr-PLC_START_Address); //
|
|||
|
return 0;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/*********************************************
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD>PLC<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
err_id=01:ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(δʶ<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>)
|
|||
|
err_id=02:ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD>ݲ<EFBFBD>֧<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>)
|
|||
|
err_id=10:<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>ʶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
err_id=11:<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ȡ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
err_id=12:<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>ַZ<EFBFBD><EFBFBD>ַδ֪)
|
|||
|
err_id=13:<EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>ַZ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|||
|
err_id=20:CJָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
D8061,M8061=PCӲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
D8063,M8063=<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,ͨ<EFBFBD>Ŵ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
D8064,M8064=<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
D8065,M8065=<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
D8066,M8066=<EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
D8067,M8067=<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
D8068,M8068=<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
***********************************************/
|
|||
|
void PLC_PROG_ERROR(u16 err,u16 err_id)
|
|||
|
{
|
|||
|
// PLC_BIT_ON(err); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־ СС<D0A1><D0A1> <20><><EFBFBD><EFBFBD>
|
|||
|
D8012=0; //ɨ<><C9A8>ʱ<EFBFBD><CAB1>
|
|||
|
if (D8068==0)D8067=err_id; //<2F><EFBFBD><EFB7A8><EFBFBD><EFBFBD>
|
|||
|
if (D8068==0)D8068=(PLC_Err-(u16*)(0x800605D)); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>PC<50><43>
|
|||
|
D8069=D8068;
|
|||
|
}
|
|||
|
|
|||
|
static void LD(u16 start_addr) //<2F><>ʼ<EFBFBD><CABC>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
{
|
|||
|
if(PLC_STL_Status == 1) //ΪSTL״̬<D7B4><CCAC> ȫ<>ֲ<EFBFBD><D6B2><EFBFBD>
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(PLC_BIT_TEST(start_addr)&&(PLC_BIT_TEST(PLC_STL_Addr)))
|
|||
|
PLC_ACC_BIT |=0x01;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(PLC_BIT_TEST(start_addr))
|
|||
|
PLC_ACC_BIT |=0x01;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void LDI(u16 start_addr)
|
|||
|
{
|
|||
|
if(PLC_STL_Status == 1) //ΪSTL״̬<D7B4><CCAC> ȫ<>ֲ<EFBFBD><D6B2><EFBFBD>
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if((!(PLC_BIT_TEST(start_addr)))&&(PLC_BIT_TEST(PLC_STL_Addr)))
|
|||
|
PLC_ACC_BIT |=0x01;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(PLC_BIT_TEST(start_addr));
|
|||
|
else
|
|||
|
PLC_ACC_BIT |=0x01;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void AND(u16 start_addr)
|
|||
|
{
|
|||
|
if((PLC_BIT_TEST(start_addr))&&(PLC_ACC_BIT&0X01))
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0XFE;
|
|||
|
}
|
|||
|
|
|||
|
static void ANI(u16 start_addr)
|
|||
|
{
|
|||
|
if((!(PLC_BIT_TEST(start_addr)))&&(PLC_ACC_BIT&0X01))
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0XFE;
|
|||
|
}
|
|||
|
|
|||
|
static void OR(u16 start_addr)
|
|||
|
{
|
|||
|
if((PLC_BIT_TEST(start_addr))||(PLC_ACC_BIT&0X01))
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0XFE;
|
|||
|
}
|
|||
|
|
|||
|
static void ORI(u16 start_addr)
|
|||
|
{
|
|||
|
if((!(PLC_BIT_TEST(start_addr)))||(PLC_ACC_BIT&0X01))
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0XFE;
|
|||
|
}
|
|||
|
|
|||
|
void OUT(u16 start_addr)
|
|||
|
{
|
|||
|
if (PLC_STL_CMD == 1) //<2F>ж<EFBFBD><D0B6>Dz<EFBFBD><C7B2>ǽ<EFBFBD><C7BD>벽<EFBFBD><EBB2BD>ģʽ
|
|||
|
{
|
|||
|
if (PLC_STL_Status == 1) //<2F>Dz<EFBFBD><C7B2>Ǵ<EFBFBD><C7B4><EFBFBD>STLģʽ
|
|||
|
{
|
|||
|
if(start_addr < 0X000A)//<2F>жϿ<D0B6>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD> S000-S009
|
|||
|
{
|
|||
|
if((PLC_ACC_BIT&0x01)==0x01)
|
|||
|
{
|
|||
|
PLC_BIT_OFF(PLC_STL_Addr); //OFF
|
|||
|
PLC_BIT_ON(start_addr); //ON
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if(PLC_BIT_TEST(PLC_STL_Addr))
|
|||
|
{
|
|||
|
if((PLC_ACC_BIT&0x01)==0x01)
|
|||
|
{
|
|||
|
PLC_BIT_ON(start_addr); //ON
|
|||
|
PLC_STL_Coil[PLC_STL_Count++]=start_addr;//<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ON<4F><4E>Ȧ<EFBFBD><C8A6>ַ λ<>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
else
|
|||
|
PLC_BIT_OFF(start_addr); //OFF
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if(start_addr < 0X000A)//<2F>жϿ<D0B6>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD> S000-S009
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT & 0x01)
|
|||
|
{
|
|||
|
PLC_BIT_ON(start_addr); //ON
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0x01)
|
|||
|
PLC_BIT_ON(start_addr); //ON
|
|||
|
else
|
|||
|
PLC_BIT_OFF(start_addr); //OFF
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
PLC_BIT_ON(start_addr); //ON
|
|||
|
else
|
|||
|
PLC_BIT_OFF(start_addr); //OFF
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
static void BIT_SET(u16 start_addr)//λ<><CEBB><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
u8 temp;
|
|||
|
if(PLC_ACC_BIT&0x01)
|
|||
|
{
|
|||
|
if (PLC_STL_Status == 1) //ΪSTL״̬<D7B4><CCAC>
|
|||
|
{
|
|||
|
for(temp=0;temp<=PLC_STL_Count;temp++)
|
|||
|
PLC_BIT_OFF(PLC_STL_Coil[temp]); //<2F><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>ON<4F><4E>Ȧ״̬
|
|||
|
|
|||
|
PLC_BIT_OFF(PLC_STL_Addr); //OFF
|
|||
|
PLC_BIT_ON(start_addr); //ON
|
|||
|
PLC_STL_Count=0; //<2F><><EFBFBD><EFBFBD><EFBFBD>ϴμ<CFB4>¼ON<4F><4E>Ȧ<EFBFBD><C8A6><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
else PLC_BIT_ON(start_addr); //0N
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
static void RST(u16 start_addr)//<2F><>λλ
|
|||
|
{
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
PLC_BIT_OFF(start_addr); //OFF
|
|||
|
}
|
|||
|
|
|||
|
static void RET(void)
|
|||
|
{
|
|||
|
PLC_STL_Status =0; //<2F>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD>ģʽ <20>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ
|
|||
|
}
|
|||
|
|
|||
|
void STL(u16 start_addr) //<2F><><EFBFBD><EFBFBD> ģʽ
|
|||
|
{
|
|||
|
PLC_STL_CMD = 1; //ȫ<>ֳ<EFBFBD><D6B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD>־
|
|||
|
PLC_STL_Status = 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ
|
|||
|
PLC_STL_Addr = start_addr; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(PLC_BIT_TEST(PLC_STL_Addr))
|
|||
|
PLC_ACC_BIT |=0x01;
|
|||
|
}
|
|||
|
|
|||
|
// СС<D0A1>ɣ<EFBFBD>20160926<32>Ż<EFBFBD>
|
|||
|
static void other_function(u8 process_addr)
|
|||
|
{
|
|||
|
switch(process_addr)
|
|||
|
{
|
|||
|
case 0xF8: //<2F>鴮<EFBFBD><E9B4AE> ANB
|
|||
|
{
|
|||
|
PLC_ACC_BIT = (PLC_ACC_BIT >> 1) & ((PLC_ACC_BIT & 0x01)|0xFE);
|
|||
|
break;
|
|||
|
}
|
|||
|
case 0xF9: //<2F>鲢<EFBFBD><E9B2A2> ORB
|
|||
|
{
|
|||
|
PLC_ACC_BIT = (PLC_ACC_BIT >> 1) | (PLC_ACC_BIT & 0x01);
|
|||
|
break;
|
|||
|
}
|
|||
|
case 0xFA: //<2F><>ջ MPS
|
|||
|
{
|
|||
|
PLC_MPS_BIT = (PLC_MPS_BIT << 1) | (PLC_ACC_BIT & 0x01);
|
|||
|
break;
|
|||
|
}
|
|||
|
case 0xFB: //<2F><>ջ MRD
|
|||
|
{
|
|||
|
PLC_ACC_BIT = (PLC_ACC_BIT & 0xfe) | (PLC_MPS_BIT & 0x01);
|
|||
|
break;
|
|||
|
}
|
|||
|
case 0xFC: //<2F><>ջ MPP
|
|||
|
{
|
|||
|
PLC_ACC_BIT = (PLC_ACC_BIT & 0xfe) | (PLC_MPS_BIT & 0x01),PLC_MPS_BIT >>= 1;
|
|||
|
break;
|
|||
|
}
|
|||
|
case 0xFD: // ȡ<><C8A1> INV
|
|||
|
{
|
|||
|
PLC_ACC_BIT = (PLC_ACC_BIT & 0xfe) | (~PLC_ACC_BIT & 0x01);
|
|||
|
break;
|
|||
|
}
|
|||
|
case 0xFF: //ȡ<><C8A1> POP
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
default:
|
|||
|
{
|
|||
|
PLC_PROG_ERROR(M8064,02);
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
static void LPS(void) //M1536~M3071λLPSָ<53><EFBFBD><EEBAAF>
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0x01)
|
|||
|
{
|
|||
|
if(PLC_PL_BIT_TEST(PLC_Addr-PLC_START_Address)==0)
|
|||
|
{
|
|||
|
PLC_PL_BIT_ON(PLC_Addr-PLC_START_Address);
|
|||
|
PLC_BIT_ON((0x2fff&*PLC_Addr));
|
|||
|
}
|
|||
|
else{PLC_BIT_OFF((0x2fff&*PLC_Addr));}
|
|||
|
}
|
|||
|
else{PLC_PL_BIT_OFF(PLC_Addr-PLC_START_Address);}
|
|||
|
PLC_Addr++;
|
|||
|
}
|
|||
|
|
|||
|
static void LPF(void) //M1536~M3071λLPSָ<53><EFBFBD><EEBAAF>
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0x01)
|
|||
|
{
|
|||
|
if(PLC_PL_BIT_TEST(PLC_Addr-PLC_START_Address)==0)
|
|||
|
{PLC_PL_BIT_ON(PLC_Addr-PLC_START_Address);}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if(PLC_PL_BIT_TEST(PLC_Addr-PLC_START_Address))
|
|||
|
{
|
|||
|
PLC_PL_BIT_OFF(PLC_Addr-PLC_START_Address);
|
|||
|
PLC_BIT_ON((0x2fff&*PLC_Addr));
|
|||
|
}
|
|||
|
else{PLC_BIT_OFF((0x2fff&*PLC_Addr));}
|
|||
|
}
|
|||
|
PLC_Addr++;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
static void RESET_T(u8 process_addr) //<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>λ
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0x01) //<2F><>ǰֵ<C7B0>Ƿ<EFBFBD><C7B7><EFBFBD>Ч
|
|||
|
{
|
|||
|
PLC_BIT_OFF(0x600+process_addr); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȧ
|
|||
|
PLC_BIT_OFF(0x2600+process_addr);//ʹ<><CAB9><EFBFBD><EFBFBD>Ȧ
|
|||
|
PLC_BIT_ON(0x2300+process_addr); //<2F><>λ<EFBFBD><CEBB>Ȧ
|
|||
|
PLC_16BIT[0x0800+process_addr]=0;//ʵ<>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
else
|
|||
|
PLC_BIT_OFF(0x2300+process_addr); //<2F><>λ<EFBFBD><CEBB>Ȧ
|
|||
|
}
|
|||
|
|
|||
|
static void RESET_C(u8 process_addr) //<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>λ
|
|||
|
{
|
|||
|
static u16 *p_data;
|
|||
|
if((PLC_ACC_BIT&0x01)==0x01) //<2F><>ǰֵ<C7B0>Ƿ<EFBFBD><C7B7><EFBFBD>Ч
|
|||
|
{
|
|||
|
if((process_addr>=0XC8)&&(process_addr<=0XFF))
|
|||
|
{
|
|||
|
p_data=PLC_16BIT+0x0500+process_addr; //ָ<><D6B8>ֵ<EFBFBD><D6B5>ַ
|
|||
|
*p_data=0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ <20><>λ
|
|||
|
p_data+=1; //<2F><>Ϊ<EFBFBD><CEAA>32λ
|
|||
|
*p_data=0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ <20><>λ
|
|||
|
PLC_BIT_OFF(0x00E0+process_addr); //ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȧ<EFBFBD><C8A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȧ
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
p_data=PLC_16BIT+0x0500+process_addr; //ָ<><D6B8>ֵ<EFBFBD><D6B5>ַ
|
|||
|
*p_data=0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|||
|
PLC_BIT_OFF(0x00E0+process_addr); //ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȧ<EFBFBD><C8A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȧ
|
|||
|
}
|
|||
|
}
|
|||
|
OUT(0X3700+process_addr);
|
|||
|
}
|
|||
|
|
|||
|
static void RST_T_C(void) //<2F><><EFBFBD><EFBFBD>T_CλRSTָ<54><EFBFBD><EEBAAF>
|
|||
|
{
|
|||
|
switch(*PLC_Addr/0x100)
|
|||
|
{
|
|||
|
case 0x86: RESET_T(*PLC_Addr),PLC_Addr++;break;//<2F><>λT
|
|||
|
case 0x8E: RESET_C(*PLC_Addr),PLC_Addr++;break;//<2F><>λC
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
static void MOV_TO_K_H(u8 i,u32 data,u8 addr)//<2F><><EFBFBD><EFBFBD> MOV ?? K?X&Y&S&M <20><>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
u8 LL_BIT; //<2F><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>üĴ<C3BC><C4B4><EFBFBD>
|
|||
|
u16 JOB_ADDR;
|
|||
|
int64_t MOV_DATA_64BIT,MOV_DATA_64BIT_BACKUP,MOV_DATA_BACKUP1; //<2F>ƶ<EFBFBD>32λ<32><CEBB><EFBFBD><EFBFBD>
|
|||
|
mov_d_addr|=addr<<8;
|
|||
|
mov_d_addr+=Transfer; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݺͶ<DDBA><CDB6><EFBFBD>ʱ Transfer<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽʱ<C6BD><CAB1><EFBFBD><EFBFBD>0
|
|||
|
LL_BIT=mov_d_addr%0x20; //<2F><>Ҫ<EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>λ
|
|||
|
JOB_ADDR=(mov_d_addr/0x20)*4; //<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>ʼ<EFBFBD><CABC>ַ
|
|||
|
switch(i)
|
|||
|
{ // <20>ƶ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD>Ҫ<EFBFBD><D2AA>λ<EFBFBD><CEBB> <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
case 0x82: MOV_DATA_64BIT_BACKUP=data&0X0000000F,MOV_DATA_64BIT_BACKUP<<=LL_BIT,MOV_DATA_BACKUP1=~(0X0000000F<<LL_BIT); break;//<2F><><EFBFBD><EFBFBD>K1<4B><31>С
|
|||
|
case 0x84: MOV_DATA_64BIT_BACKUP=data&0X000000FF,MOV_DATA_64BIT_BACKUP<<=LL_BIT,MOV_DATA_BACKUP1=~(0X000000FF<<LL_BIT); break;//<2F><><EFBFBD><EFBFBD>K2<4B><32>С
|
|||
|
case 0x86: MOV_DATA_64BIT_BACKUP=data&0X00000FFF,MOV_DATA_64BIT_BACKUP<<=LL_BIT,MOV_DATA_BACKUP1=~(0X00000FFF<<LL_BIT); break;//<2F><><EFBFBD><EFBFBD>K3<4B><33>С
|
|||
|
case 0x88: MOV_DATA_64BIT_BACKUP=data&0X0000FFFF,MOV_DATA_64BIT_BACKUP<<=LL_BIT,MOV_DATA_BACKUP1=~(0X0000FFFF<<LL_BIT); break;//<2F><><EFBFBD><EFBFBD>K4<4B><34>С
|
|||
|
case 0x8A: MOV_DATA_64BIT_BACKUP=data&0X000FFFFF,MOV_DATA_64BIT_BACKUP<<=LL_BIT,MOV_DATA_BACKUP1=~(0X000FFFFF<<LL_BIT); break;//<2F><><EFBFBD><EFBFBD>K5<4B><35>С
|
|||
|
case 0x8C: MOV_DATA_64BIT_BACKUP=data&0X00FFFFFF,MOV_DATA_64BIT_BACKUP<<=LL_BIT,MOV_DATA_BACKUP1=~(0X00FFFFFF<<LL_BIT); break;//<2F><><EFBFBD><EFBFBD>K6<4B><36>С
|
|||
|
case 0x8E: MOV_DATA_64BIT_BACKUP=data&0X0FFFFFFF,MOV_DATA_64BIT_BACKUP<<=LL_BIT,MOV_DATA_BACKUP1=~(0X0FFFFFFF<<LL_BIT); break;//<2F><><EFBFBD><EFBFBD>K7<4B><37>С
|
|||
|
case 0x90: MOV_DATA_64BIT_BACKUP=data&0XFFFFFFFF,MOV_DATA_64BIT_BACKUP<<=LL_BIT,MOV_DATA_BACKUP1=~(0XFFFFFFFF<<LL_BIT); break;//<2F><><EFBFBD><EFBFBD>K8<4B><38>С
|
|||
|
default: PLC_Addr+=3; break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
MOV_DATA_64BIT=PLC_RAM64(RAM_ADDR+JOB_ADDR);
|
|||
|
MOV_DATA_64BIT&=MOV_DATA_BACKUP1; //<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>͵<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
MOV_DATA_64BIT|=MOV_DATA_64BIT_BACKUP; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
|||
|
PLC_RAM64(RAM_ADDR+JOB_ADDR)=MOV_DATA_64BIT; //<2F><><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD>Ŀ<EFBFBD><C4BF>λ<EFBFBD><CEBB>
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
static signed int MOV_K(u8 Addr) //<2F><><EFBFBD><EFBFBD>K?X&Y&S&M<><4D><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
static u16 LL_BIT,JOB_ADDR; //<2F><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>üĴ<C3BC><C4B4><EFBFBD>
|
|||
|
static uint64_t MOV_DATA_64BIT; //<2F>ƶ<EFBFBD>64λ<34><CEBB><EFBFBD><EFBFBD>
|
|||
|
mov_d_addr|=(Addr<<8);
|
|||
|
mov_d_addr+=Transfer; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݺͶ<DDBA><CDB6><EFBFBD>ʱ Transfer<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽʱ<C6BD><CAB1><EFBFBD><EFBFBD>0
|
|||
|
LL_BIT=mov_d_addr%0x20; //<2F><>Ҫ<EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>λ
|
|||
|
JOB_ADDR=(mov_d_addr/0x20)*4; //<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>ʼ<EFBFBD><CABC>ַ
|
|||
|
MOV_DATA_64BIT=PLC_RAM64(RAM_ADDR+JOB_ADDR),
|
|||
|
MOV_DATA_64BIT>>=LL_BIT;
|
|||
|
return (signed int)MOV_DATA_64BIT;
|
|||
|
}
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>ַ
|
|||
|
u16 D_C_T_addr(u8 l_value)
|
|||
|
{
|
|||
|
static u16 temp;
|
|||
|
switch(*PLC_Addr/0x100)
|
|||
|
{
|
|||
|
case 0x80: temp=l_value+((*PLC_Addr%0x100)*0x100),temp=0x0700+temp/2,PLC_Addr++; break;//<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000
|
|||
|
case 0x82: temp=l_value+((*PLC_Addr%0x100)*0x100),temp=0x0800+temp/2,PLC_Addr++; break;//<2F><><EFBFBD><EFBFBD>T<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>Ϊֵ
|
|||
|
case 0x84: temp=l_value+((*PLC_Addr%0x100)*0x100),temp=0x0500+temp/2,PLC_Addr++; break;//<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>Ϊֵ
|
|||
|
case 0x86: temp=l_value+((*PLC_Addr%0x100)*0x100),temp=0x1000+temp/2,PLC_Addr++; break;//<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>Ϊֵ
|
|||
|
case 0x88: temp=l_value+((*PLC_Addr%0x100)*0x100),temp=0x1000+temp/2+1000,PLC_Addr++; break;//<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000
|
|||
|
}
|
|||
|
return temp;
|
|||
|
}
|
|||
|
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static u16 addr_value(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>PLC<4C><43>ַ<EFBFBD><D6B7>k<EFBFBD><6B>ʵ<EFBFBD><CAB5>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: <20><>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>2<EFBFBD><32>
|
|||
|
// <20><> ע:
|
|||
|
//-------------------------------------------------------------------------------------------------------
|
|||
|
// <20><EFBFBD><DEB8><EFBFBD>:
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>:
|
|||
|
// <20><> ע: <20>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ż<EFBFBD><C5BB>ص<F3B7B5BB>ַ k<><6B><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//-------------------------------------------------------------------------------------------------------
|
|||
|
//=======================================================================================================
|
|||
|
static u16 addr_value(void)
|
|||
|
{
|
|||
|
static u8 temp;static u16 temp1;
|
|||
|
switch(*PLC_Addr/0x100)
|
|||
|
{
|
|||
|
case 0x84: temp=*PLC_Addr,PLC_Addr++,temp1=*PLC_Addr<<8|temp,PLC_Addr++,Flag_bit=0;break;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD> break;//<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
case 0x86: temp=*PLC_Addr,PLC_Addr++;temp1=D_C_T_addr(temp); break;//<2F><><EFBFBD><EFBFBD>D<EFBFBD><44>C<EFBFBD><43>T<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
}
|
|||
|
return temp1;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static u32 addr_value_prog(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>PLC<4C><43>ַ<EFBFBD><D6B7>k<EFBFBD><6B>ʵ<EFBFBD><CAB5>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: <20><>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>23<32><33>
|
|||
|
// <20><> ע:
|
|||
|
//-------------------------------------------------------------------------------------------------------
|
|||
|
// <20><EFBFBD><DEB8><EFBFBD>:
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>:
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static u32 addr_value_prog(void)
|
|||
|
{
|
|||
|
static u32 temp;
|
|||
|
u16 Type_F,temp2,Data1,Data2;
|
|||
|
Data1=*PLC_Addr;PLC_Addr++;Data2=*PLC_Addr;
|
|||
|
temp2=Type_F=0;
|
|||
|
Type_F = (Data1 & 0xff00);
|
|||
|
Type_F |= (Data2 >> 8);
|
|||
|
|
|||
|
temp2 = (Data2 << 8);
|
|||
|
temp2 |=mov_d_addr=(u8)Data1;
|
|||
|
|
|||
|
if(Type_F == 0x8680) temp=RAM_D8000_ADDR+temp2, PLC_Addr++;//<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ D8000
|
|||
|
else if(Type_F == 0x8682) temp=RAM_T_ADDR+temp2, PLC_Addr++;//<2F><><EFBFBD><EFBFBD>T<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
else if(Type_F == 0x8684) temp=RAM_C_ADDR+temp2, PLC_Addr++;//<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
else if(Type_F == 0x8686) temp=RAM_D_ADDR+temp2, PLC_Addr++;//<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
else if(Type_F == 0x8688) temp=RAM_D1000_ADDR+temp2, PLC_Addr++;//<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000
|
|||
|
else if(Type_F == 0x8482) temp=MOV_K(*PLC_Addr)&0X0000000F,Flag_bit=0,PLC_Addr++;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
else if(Type_F == 0x8484) temp=MOV_K(*PLC_Addr)&0X000000FF,Flag_bit=0,PLC_Addr++;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
else if(Type_F == 0x8486) temp=MOV_K(*PLC_Addr)&0X00000FFF,Flag_bit=0,PLC_Addr++;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
else if(Type_F == 0x8488) temp=MOV_K(*PLC_Addr)&0X0000FFFF,Flag_bit=0,PLC_Addr++;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
else if(Type_F == 0x848A) temp=MOV_K(*PLC_Addr)&0X000FFFFF,Flag_bit=0,PLC_Addr++;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
else if(Type_F == 0x848C) temp=MOV_K(*PLC_Addr)&0X00FFFFFF,Flag_bit=0,PLC_Addr++;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
else if(Type_F == 0x848E) temp=MOV_K(*PLC_Addr)&0X0FFFFFFF,Flag_bit=0,PLC_Addr++;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
else if(Type_F == 0x8490) temp=MOV_K(*PLC_Addr), Flag_bit=0,PLC_Addr++;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
return temp;
|
|||
|
}
|
|||
|
|
|||
|
unsigned short V0_V3(u16 temp1)
|
|||
|
{
|
|||
|
u8 temp=PLC_v_z_addr(temp1);
|
|||
|
if(temp==0) return D8029;
|
|||
|
else if(temp==1) return D8183;
|
|||
|
else if(temp==2) return D8185;
|
|||
|
else if(temp==3) return D8187;
|
|||
|
else return 0;
|
|||
|
}
|
|||
|
|
|||
|
unsigned short V4_V7(u16 temp1)
|
|||
|
{
|
|||
|
u8 temp=PLC_v_z_addr(temp1);
|
|||
|
if(temp==0) return D8189;
|
|||
|
else if(temp==1) return D8191;
|
|||
|
else if(temp==2) return D8193;
|
|||
|
else if(temp==3) return D8195;
|
|||
|
else return 0;
|
|||
|
}
|
|||
|
|
|||
|
unsigned short Z0_Z3(u16 temp1)
|
|||
|
{
|
|||
|
u8 temp=PLC_v_z_addr(temp1);
|
|||
|
if(temp==0) return D8028;
|
|||
|
else if(temp==1) return D8182;
|
|||
|
else if(temp==2) return D8184;
|
|||
|
else if(temp==3) return D8186;
|
|||
|
else return 0;
|
|||
|
}
|
|||
|
|
|||
|
unsigned short Z4_Z7(u16 temp1)
|
|||
|
{
|
|||
|
u8 temp=PLC_v_z_addr(temp1);
|
|||
|
if(temp==0) return D8188;
|
|||
|
else if(temp==1) return D8190;
|
|||
|
else if(temp==2) return D8192;
|
|||
|
else if(temp==3) return D8194;
|
|||
|
else return 0;
|
|||
|
}
|
|||
|
|
|||
|
unsigned int DZ0_Z3(u16 temp1)
|
|||
|
{
|
|||
|
u8 temp=PLC_v_z_addr(temp1);
|
|||
|
if(temp==0) return D8028+D8029*0X10000;
|
|||
|
else if(temp==1) return D8182+D8183*0X10000;
|
|||
|
else if(temp==2) return D8184+D8184*0X10000;
|
|||
|
else if(temp==3) return D8186+D8185*0X10000;
|
|||
|
else return 0;
|
|||
|
}
|
|||
|
|
|||
|
unsigned short DZ4_Z7(u16 temp1)
|
|||
|
{
|
|||
|
u8 temp=PLC_v_z_addr(temp1);
|
|||
|
if(temp==0) return D8188+D8189*0X10000;
|
|||
|
else if(temp==1) return D8190+D8191*0X10000;
|
|||
|
else if(temp==2) return D8192+D8193*0X10000;
|
|||
|
else if(temp==3) return D8194+D8193*0X10000;
|
|||
|
else return 0;
|
|||
|
}
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void target(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>롱<EFBFBD><EBA1B1><EFBFBD><EFBFBD><F2A1B1A1><EFBFBD><EFBFBD><EFBFBD><F2A1B1B9>ø<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> <09><>DMOV<4F><56>DADD<44><44>DSUB<55><42>ָ<EFBFBD><D6B8><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD>ȥ
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>23<32><33>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void D_target(void)
|
|||
|
{
|
|||
|
u16 Type_F,temp2,Data1,Data2;
|
|||
|
Data1=*PLC_Addr;PLC_Addr++;Data2=*PLC_Addr;
|
|||
|
temp2=Type_F=0;
|
|||
|
Type_F = (Data1 & 0xff00);
|
|||
|
Type_F |= (Data2 >> 8);
|
|||
|
/************************************/
|
|||
|
temp2 = (Data2 << 8);
|
|||
|
temp2 |=mov_d_addr=(u8)Data1;
|
|||
|
/************************************/
|
|||
|
switch(Type_F)
|
|||
|
{
|
|||
|
case 0x8482: MOV_TO_K_H(Type_F,trade,*PLC_Addr),PLC_Addr++,Transfer_bit=1;break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x8484: MOV_TO_K_H(Type_F,trade,*PLC_Addr),PLC_Addr++,Transfer_bit=1;break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x8486: MOV_TO_K_H(Type_F,trade,*PLC_Addr),PLC_Addr++,Transfer_bit=1;break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x8488: MOV_TO_K_H(Type_F,trade,*PLC_Addr),PLC_Addr++,Transfer_bit=1;break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x848A: MOV_TO_K_H(Type_F,trade,*PLC_Addr),PLC_Addr++,Transfer_bit=1;break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x848C: MOV_TO_K_H(Type_F,trade,*PLC_Addr),PLC_Addr++,Transfer_bit=1;break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x848E: MOV_TO_K_H(Type_F,trade,*PLC_Addr),PLC_Addr++,Transfer_bit=1;break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x8490: MOV_TO_K_H(Type_F,trade,*PLC_Addr),PLC_Addr++,Transfer_bit=1;break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
|
|||
|
case 0x8680: PLC_RAM32(RAM_D8000_ADDR+temp2+Transfer)=trade,PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ D8000
|
|||
|
case 0x8682: PLC_RAM32(RAM_T_ADDR+temp2+Transfer)=trade,PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>T<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
case 0x8684: PLC_RAM32(RAM_C_ADDR+temp2+Transfer)=trade,PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
case 0x8686: PLC_RAM32(RAM_D_ADDR+temp2+Transfer)=trade,PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
case 0x8688: PLC_RAM32(RAM_D1000_ADDR+temp2+Transfer)=trade,PLC_Addr++;break; //<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000
|
|||
|
/************************************************K1M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA482: mov_d_addr=+DZ0_Z3(temp2),MOV_TO_K_H(Type_F,trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K1M0<4D><30>V0-V3
|
|||
|
case 0xA483: mov_d_addr=+DZ4_Z7(temp2),MOV_TO_K_H(Type_F,trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K1M0<4D><30>V4-V7
|
|||
|
/************************************************K2M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA484: mov_d_addr=+DZ0_Z3(temp2),MOV_TO_K_H(Type_F,trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K2M0<4D><30>V0-V3
|
|||
|
case 0xA485: mov_d_addr=+DZ4_Z7(temp2),MOV_TO_K_H(Type_F,trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K2M0<4D><30>V4-V7
|
|||
|
/************************************************K3M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA486: mov_d_addr=+DZ0_Z3(temp2),MOV_TO_K_H(Type_F,trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K3M0<4D><30>V0-V3
|
|||
|
case 0xA487: mov_d_addr=+DZ4_Z7(temp2),MOV_TO_K_H(Type_F,trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K3M0<4D><30>V4-V7
|
|||
|
/************************************************K4M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA488: mov_d_addr=+DZ0_Z3(temp2),MOV_TO_K_H(Type_F,trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K4M0<4D><30>V0-V3
|
|||
|
case 0xA489: mov_d_addr=+DZ4_Z7(temp2),MOV_TO_K_H(Type_F,trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K4M0<4D><30>V4-V7
|
|||
|
/************************************************K5M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA48A: mov_d_addr=+DZ0_Z3(temp2),MOV_TO_K_H(Type_F,trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K5M0<4D><30>V0-V3
|
|||
|
case 0xA48B: mov_d_addr=+DZ4_Z7(temp2),MOV_TO_K_H(Type_F,trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K5M0<4D><30>V4-V7
|
|||
|
/************************************************K6M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA48C: mov_d_addr=+DZ0_Z3(temp2),MOV_TO_K_H(Type_F,trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K6M0<4D><30>V0-V3
|
|||
|
case 0xA48D: mov_d_addr=+DZ4_Z7(temp2),MOV_TO_K_H(Type_F,trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K6M0<4D><30>V4-V7
|
|||
|
/************************************************K7M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA48E: mov_d_addr=+DZ0_Z3(temp2),MOV_TO_K_H(Type_F,trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K7M0<4D><30>V0-V3
|
|||
|
case 0xA48F: mov_d_addr=+DZ4_Z7(temp2),MOV_TO_K_H(Type_F,trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K7M0<4D><30>V4-V7
|
|||
|
/************************************************K8M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA490: mov_d_addr=+DZ0_Z3(temp2),MOV_TO_K_H(Type_F,trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//k8M0<4D><30>V0-V4
|
|||
|
case 0xA491: mov_d_addr=+DZ4_Z7(temp2),MOV_TO_K_H(Type_F,trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K8M0<4D><30>V4-V7
|
|||
|
/************************************************T<>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA682: PLC_RAM32(RAM_T_ADDR+PLC_D_C_T_addr(temp2)+DZ0_Z3(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>T<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z0-Z3
|
|||
|
case 0xA683: PLC_RAM32(RAM_T_ADDR+PLC_D_C_T_addr(temp2)+DZ4_Z7(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>T<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z4-Z7
|
|||
|
/************************************************C<>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA684: PLC_RAM32(RAM_C_ADDR+PLC_D_C_T_addr(temp2)+DZ0_Z3(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z0-Z3
|
|||
|
case 0xA685: PLC_RAM32(RAM_C_ADDR+PLC_D_C_T_addr(temp2)+DZ4_Z7(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z4-Z7
|
|||
|
/************************************************D<>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA686: PLC_RAM32(RAM_D_ADDR+PLC_D_C_T_addr(temp2)+DZ0_Z3(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z0-Z3
|
|||
|
case 0xA687: PLC_RAM32(RAM_D_ADDR+PLC_D_C_T_addr(temp2)+DZ4_Z7(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z4-Z7
|
|||
|
case 0xA688: PLC_RAM32(RAM_D1000_ADDR+PLC_D_C_T_addr(temp2)+DZ0_Z3(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000<30><30>Z0-Z3
|
|||
|
case 0xA689: PLC_RAM32(RAM_D1000_ADDR+PLC_D_C_T_addr(temp2)+DZ4_Z7(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000<30><30>Z4-Z7
|
|||
|
}
|
|||
|
PLC_Addr+=2;
|
|||
|
}
|
|||
|
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void target(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>롱<EFBFBD><EBA1B1><EFBFBD><EFBFBD><F2A1B1A1><EFBFBD><EFBFBD><EFBFBD><F2A1B1B9>ø<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> <09><>MOV<4F><56>ADD<44><44>SUB<55><42>ָ<EFBFBD><D6B8><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD>ȥ
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>23<32><33>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void target(void)
|
|||
|
{
|
|||
|
u16 Type_F,temp2,Data1,Data2;
|
|||
|
Data1=*PLC_Addr;PLC_Addr++;Data2=*PLC_Addr;
|
|||
|
temp2=Type_F=0;
|
|||
|
Type_F = (Data1 & 0xff00);
|
|||
|
Type_F |= (Data2 >> 8);
|
|||
|
/************************************/
|
|||
|
temp2 = (Data2 << 8);
|
|||
|
temp2 |=mov_d_addr=(u8)Data1;
|
|||
|
/************************************/
|
|||
|
switch(Type_F)
|
|||
|
{
|
|||
|
case 0x8482: MOV_TO_K_H(Type_F,(u16)trade,*PLC_Addr),PLC_Addr++,Transfer_bit=1;break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x8484: MOV_TO_K_H(Type_F,(u16)trade,*PLC_Addr),PLC_Addr++,Transfer_bit=1;break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x8486: MOV_TO_K_H(Type_F,(u16)trade,*PLC_Addr),PLC_Addr++,Transfer_bit=1;break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x8488: MOV_TO_K_H(Type_F,(u16)trade,*PLC_Addr),PLC_Addr++,Transfer_bit=1;break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
|
|||
|
case 0x8680: PLC_RAM16(RAM_D8000_ADDR+temp2+Transfer)=(u16)trade,PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ D8000
|
|||
|
case 0x8682: PLC_RAM16(RAM_T_ADDR+temp2+Transfer)=(u16)trade,PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>T<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
case 0x8684: PLC_RAM16(RAM_C_ADDR+temp2+Transfer)=(u16)trade,PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
case 0x8686: PLC_RAM16(RAM_D_ADDR+temp2+Transfer)=(u16)trade,PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
case 0x8688: PLC_RAM16(RAM_D1000_ADDR+temp2+Transfer)=(u16)trade,PLC_Addr++;break; //<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000
|
|||
|
/************************************************K1M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"V"*******************************************************************/
|
|||
|
case 0x9482: mov_d_addr=+V0_V3(temp2),MOV_TO_K_H(Type_F,(u16)trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K1M0<4D><30>V0-V3
|
|||
|
case 0x9483: mov_d_addr=+V4_V7(temp2),MOV_TO_K_H(Type_F,(u16)trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K1M0<4D><30>V4-V7
|
|||
|
/************************************************K2M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"V"*******************************************************************/
|
|||
|
case 0x9484: mov_d_addr=+V0_V3(temp2),MOV_TO_K_H(Type_F,(u16)trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K2M0<4D><30>V0-V3
|
|||
|
case 0x9485: mov_d_addr=+V4_V7(temp2),MOV_TO_K_H(Type_F,(u16)trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K2M0<4D><30>V4-V7
|
|||
|
/************************************************K3M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"V"*******************************************************************/
|
|||
|
case 0x9486: mov_d_addr=+V0_V3(temp2),MOV_TO_K_H(Type_F,(u16)trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K3M0<4D><30>V0-V3
|
|||
|
case 0x9487: mov_d_addr=+V4_V7(temp2),MOV_TO_K_H(Type_F,(u16)trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K3M0<4D><30>V4-V7
|
|||
|
/************************************************K4M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"V"*******************************************************************/
|
|||
|
case 0x9488: mov_d_addr=+V0_V3(temp2),MOV_TO_K_H(Type_F,(u16)trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K4M0<4D><30>V0-V3
|
|||
|
case 0x9489: mov_d_addr=+V4_V7(temp2),MOV_TO_K_H(Type_F,(u16)trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K4M0<4D><30>V4-V7
|
|||
|
/************************************************T<>Ĵ<EFBFBD><C4B4><EFBFBD>"V"*******************************************************************/
|
|||
|
case 0x9682: PLC_RAM16(RAM_T_ADDR+PLC_D_C_T_addr(temp2)+V0_V3(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>T<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V0-V3
|
|||
|
case 0x9683: PLC_RAM16(RAM_T_ADDR+PLC_D_C_T_addr(temp2)+V4_V7(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>T<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V4-V7
|
|||
|
/************************************************C<>Ĵ<EFBFBD><C4B4><EFBFBD>"V"*******************************************************************/
|
|||
|
case 0x9684: PLC_RAM16(RAM_C_ADDR+PLC_D_C_T_addr(temp2)+V0_V3(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V0-V3
|
|||
|
case 0x9685: PLC_RAM16(RAM_C_ADDR+PLC_D_C_T_addr(temp2)+V4_V7(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V4-V7
|
|||
|
/************************************************D<>Ĵ<EFBFBD><C4B4><EFBFBD>"V"*******************************************************************/
|
|||
|
case 0x9686: PLC_RAM16(RAM_D_ADDR+PLC_D_C_T_addr(temp2)+V0_V3(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V0-V3
|
|||
|
case 0x9687: PLC_RAM16(RAM_D_ADDR+PLC_D_C_T_addr(temp2)+V4_V7(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V4-V7
|
|||
|
case 0x9688: PLC_RAM16(RAM_D1000_ADDR+PLC_D_C_T_addr(temp2)+V0_V3(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000<30><30>V0-V3
|
|||
|
case 0x9689: PLC_RAM16(RAM_D1000_ADDR+PLC_D_C_T_addr(temp2)+V4_V7(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000<30><30>V4-V7
|
|||
|
|
|||
|
/************************************************K1M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA482: mov_d_addr=+Z0_Z3(temp2),MOV_TO_K_H(Type_F,(u16)trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K1M0<4D><30>V0-V3
|
|||
|
case 0xA483: mov_d_addr=+Z4_Z7(temp2),MOV_TO_K_H(Type_F,(u16)trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K1M0<4D><30>V4-V7
|
|||
|
/************************************************K2M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA484: mov_d_addr=+Z0_Z3(temp2),MOV_TO_K_H(Type_F,(u16)trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K2M0<4D><30>V0-V3
|
|||
|
case 0xA485: mov_d_addr=+Z4_Z7(temp2),MOV_TO_K_H(Type_F,(u16)trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K2M0<4D><30>V4-V7
|
|||
|
/************************************************K3M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA486: mov_d_addr=+Z0_Z3(temp2),MOV_TO_K_H(Type_F,(u16)trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K3M0<4D><30>V0-V3
|
|||
|
case 0xA487: mov_d_addr=+Z4_Z7(temp2),MOV_TO_K_H(Type_F,(u16)trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K3M0<4D><30>V4-V7
|
|||
|
/************************************************K4M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA488: mov_d_addr=+Z0_Z3(temp2),MOV_TO_K_H(Type_F,(u16)trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K4M0<4D><30>V0-V3
|
|||
|
case 0xA489: mov_d_addr=+Z4_Z7(temp2),MOV_TO_K_H(Type_F,(u16)trade,PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K4M0<4D><30>V4-V7
|
|||
|
/************************************************T<>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA682: PLC_RAM16(RAM_T_ADDR+PLC_D_C_T_addr(temp2)+Z0_Z3(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z0-Z3
|
|||
|
case 0xA683: PLC_RAM16(RAM_T_ADDR+PLC_D_C_T_addr(temp2)+Z4_Z7(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z4-Z7
|
|||
|
/************************************************C<>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA684: PLC_RAM16(RAM_C_ADDR+PLC_D_C_T_addr(temp2)+Z0_Z3(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z0-Z3
|
|||
|
case 0xA685: PLC_RAM16(RAM_C_ADDR+PLC_D_C_T_addr(temp2)+Z4_Z7(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z4-Z7
|
|||
|
/************************************************D<>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA686: PLC_RAM16(RAM_D_ADDR+PLC_D_C_T_addr(temp2)+Z0_Z3(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z0-Z3
|
|||
|
case 0xA687: PLC_RAM16(RAM_D_ADDR+PLC_D_C_T_addr(temp2)+Z4_Z7(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z4-Z7
|
|||
|
case 0xA688: PLC_RAM16(RAM_D1000_ADDR+PLC_D_C_T_addr(temp2)+Z0_Z3(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000<30><30>Z0-Z3
|
|||
|
case 0xA689: PLC_RAM16(RAM_D1000_ADDR+PLC_D_C_T_addr(temp2)+Z4_Z7(temp2)*2)=(u16)trade,PLC_Addr++;break;//<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000<30><30>Z4-Z7
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static u16 cos_value(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: <20><><EFBFBD><EFBFBD>16λ<36><CEBB><EFBFBD><EFBFBD>
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>19<31><39>
|
|||
|
// <20><> ע:
|
|||
|
//-------------------------------------------------------------------------------------------------------
|
|||
|
// <20><EFBFBD><DEB8><EFBFBD>:
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>:
|
|||
|
// <20><> ע:
|
|||
|
//-------------------------------------------------------------------------------------------------------
|
|||
|
//=======================================================================================================
|
|||
|
static s16 cos_value()
|
|||
|
{
|
|||
|
static s16 temp;
|
|||
|
u16 Type_F,temp2,Data1,Data2;
|
|||
|
Data1=*PLC_Addr;PLC_Addr++;Data2=*PLC_Addr;
|
|||
|
temp2=Type_F=0;
|
|||
|
Type_F = (Data1 & 0xff00);
|
|||
|
Type_F |= (Data2 >> 8);
|
|||
|
/************************************/
|
|||
|
temp2 = (Data2 << 8);
|
|||
|
temp2 |=mov_d_addr=(u8)Data1;
|
|||
|
/************************************/
|
|||
|
switch(Type_F)
|
|||
|
{
|
|||
|
case 0x8080: temp=temp2, PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>Kֵ
|
|||
|
case 0x8280: temp=temp2, PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>Hֵ
|
|||
|
case 0x8482: temp=MOV_K(*PLC_Addr)&0X0000000F,Transfer_bit1=1,PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x8484: temp=MOV_K(*PLC_Addr)&0X000000FF,Transfer_bit1=1,PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x8486: temp=MOV_K(*PLC_Addr)&0X00000FFF,Transfer_bit1=1,PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x8488: temp=MOV_K(*PLC_Addr)&0X0000FFFF,Transfer_bit1=1,PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x8680: temp=PLC_RAM16(RAM_D8000_ADDR+temp2+Transfer),PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ D8000
|
|||
|
case 0x8682: temp=PLC_RAM16(RAM_D_ADDR+temp2+Transfer),PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>T<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
case 0x8684: temp=PLC_RAM16(RAM_C_ADDR+temp2+Transfer),PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
case 0x8686: temp=PLC_RAM16(RAM_D_ADDR+temp2+Transfer),PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
case 0x8688: temp=PLC_RAM16(RAM_D1000_ADDR+temp2+Transfer),PLC_Addr++;break; //<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000
|
|||
|
/************************************************K<>Ĵ<EFBFBD><C4B4><EFBFBD>"V"*******************************************************************/
|
|||
|
case 0x9080: temp=temp2+D8029,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V0
|
|||
|
case 0x9081: temp=temp2+D8183,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V1
|
|||
|
case 0x9082: temp=temp2+D8185,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V2
|
|||
|
case 0x9083: temp=temp2+D8187,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V3
|
|||
|
case 0x9084: temp=temp2+D8189,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V4
|
|||
|
case 0x9085: temp=temp2+D8191,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V5
|
|||
|
case 0x9086: temp=temp2+D8193,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V6
|
|||
|
case 0x9087: temp=temp2+D8195,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V7
|
|||
|
case 0x9280: temp=temp2+D8029,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V0
|
|||
|
case 0x9281: temp=temp2+D8183,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V1
|
|||
|
case 0x9282: temp=temp2+D8185,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V2
|
|||
|
case 0x9283: temp=temp2+D8187,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V3
|
|||
|
case 0x9284: temp=temp2+D8189,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V4
|
|||
|
case 0x9285: temp=temp2+D8191,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V5
|
|||
|
case 0x9286: temp=temp2+D8193,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V6
|
|||
|
case 0x9287: temp=temp2+D8195,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V7
|
|||
|
/************************************************K1M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"V"*******************************************************************/
|
|||
|
case 0x9482: mov_d_addr=+V0_V3(temp2),temp=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X0000000F,PLC_Addr++;break;//K1M0<4D><30>V0-V3
|
|||
|
case 0x9483: mov_d_addr=+V4_V7(temp2),temp=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X0000000F,PLC_Addr++;break;//K1M0<4D><30>V4-V7
|
|||
|
/************************************************K2M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"V"*******************************************************************/
|
|||
|
case 0x9484: mov_d_addr=+V0_V3(temp2),temp=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X000000FF,PLC_Addr++;break;//K2M0<4D><30>V0-V3
|
|||
|
case 0x9485: mov_d_addr=+V4_V7(temp2),temp=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X000000FF,PLC_Addr++;break;//K2M0<4D><30>V4-V7
|
|||
|
/************************************************K3M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"V"*******************************************************************/
|
|||
|
case 0x9486: mov_d_addr=+V0_V3(temp2),temp=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X00000FFF,PLC_Addr++;break;//K3M0<4D><30>V0-V3
|
|||
|
case 0x9487: mov_d_addr=+V4_V7(temp2),temp=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X00000FFF,PLC_Addr++;break;//K3M0<4D><30>V4-V7
|
|||
|
/************************************************K4M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"V"*******************************************************************/
|
|||
|
case 0x9488: mov_d_addr=+V0_V3(temp2),temp=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X0000FFFF,PLC_Addr++;break;//K4M0<4D><30>V0-V3
|
|||
|
case 0x9489: mov_d_addr=+V4_V7(temp2),temp=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X0000FFFF,PLC_Addr++;break;//K4M0<4D><30>V4-V7
|
|||
|
/************************************************T<>Ĵ<EFBFBD><C4B4><EFBFBD>"V"*******************************************************************/
|
|||
|
case 0x9682: temp=PLC_RAM16(RAM_T_ADDR+PLC_D_C_T_addr(temp2)+V0_V3(temp2)*2),PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>T<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V0-V3
|
|||
|
case 0x9683: temp=PLC_RAM16(RAM_T_ADDR+PLC_D_C_T_addr(temp2)+V4_V7(temp2)*2),PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>T<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V4-V7
|
|||
|
/************************************************C<>Ĵ<EFBFBD><C4B4><EFBFBD>"V"*******************************************************************/
|
|||
|
case 0x9684: temp=PLC_RAM16(RAM_C_ADDR+PLC_D_C_T_addr(temp2)+V0_V3(temp2)*2),PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V0-V3
|
|||
|
case 0x9685: temp=PLC_RAM16(RAM_C_ADDR+PLC_D_C_T_addr(temp2)+V4_V7(temp2)*2),PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V4-V7
|
|||
|
/************************************************D<>Ĵ<EFBFBD><C4B4><EFBFBD>"V"*******************************************************************/
|
|||
|
case 0x9686: temp=PLC_RAM16(RAM_D_ADDR+PLC_D_C_T_addr(temp2)+V0_V3(temp2)*2),PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V0-V3
|
|||
|
case 0x9687: temp=PLC_RAM16(RAM_D_ADDR+PLC_D_C_T_addr(temp2)+V4_V7(temp2)*2),PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>V4-V7
|
|||
|
case 0x9688: temp=PLC_RAM16(RAM_D1000_ADDR+PLC_D_C_T_addr(temp2)+V0_V3(temp2)*2),PLC_Addr++;break;//<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000<30><30>V0-V3
|
|||
|
case 0x9689: temp=PLC_RAM16(RAM_D1000_ADDR+PLC_D_C_T_addr(temp2)+V4_V7(temp2)*2),PLC_Addr++;break;//<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000<30><30>V4-V7
|
|||
|
|
|||
|
case 0xA080: temp=temp2+D8028,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z0
|
|||
|
case 0xA081: temp=temp2+D8182,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z1
|
|||
|
case 0xA082: temp=temp2+D8184,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z2
|
|||
|
case 0xA083: temp=temp2+D8186,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z3
|
|||
|
case 0xA084: temp=temp2+D8188,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z4
|
|||
|
case 0xA085: temp=temp2+D8190,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z5
|
|||
|
case 0xA086: temp=temp2+D8192,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z6
|
|||
|
case 0xA087: temp=temp2+D8194,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z7
|
|||
|
case 0xA280: temp=temp2+D8028,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z0
|
|||
|
case 0xA281: temp=temp2+D8182,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z1
|
|||
|
case 0xA282: temp=temp2+D8184,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z2
|
|||
|
case 0xA283: temp=temp2+D8186,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z3
|
|||
|
case 0xA284: temp=temp2+D8188,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z4
|
|||
|
case 0xA285: temp=temp2+D8190,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z5
|
|||
|
case 0xA286: temp=temp2+D8192,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z6
|
|||
|
case 0xA287: temp=temp2+D8194,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z7
|
|||
|
/************************************************K1M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA482: mov_d_addr=+Z0_Z3(temp2),temp=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X0000000F,PLC_Addr++;break;//K1M0<4D><30>V0-V3
|
|||
|
case 0xA483: mov_d_addr=+Z4_Z7(temp2),temp=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X0000000F,PLC_Addr++;break;//K1M0<4D><30>V4-V7
|
|||
|
/************************************************K2M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA484: mov_d_addr=+Z0_Z3(temp2),temp=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X000000FF,PLC_Addr++;break;//K2M0<4D><30>V0-V3
|
|||
|
case 0xA485: mov_d_addr=+Z4_Z7(temp2),temp=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X000000FF,PLC_Addr++;break;//K2M0<4D><30>V4-V7
|
|||
|
/************************************************K3M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA486: mov_d_addr=+Z0_Z3(temp2),temp=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X00000FFF,PLC_Addr++;break;//K3M0<4D><30>V0-V3
|
|||
|
case 0xA487: mov_d_addr=+Z4_Z7(temp2),temp=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X00000FFF,PLC_Addr++;break;//K3M0<4D><30>V4-V7
|
|||
|
/************************************************K4M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA488: mov_d_addr=+Z0_Z3(temp2),temp=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X0000FFFF,PLC_Addr++;break;//K4M0<4D><30>V0-V3
|
|||
|
case 0xA489: mov_d_addr=+Z4_Z7(temp2),temp=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X0000FFFF,PLC_Addr++;break;//K4M0<4D><30>V4-V7
|
|||
|
case 0xA682: temp=PLC_RAM16(RAM_T_ADDR+PLC_D_C_T_addr(temp2)+Z0_Z3(temp2)*2),PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>T<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z0-Z3
|
|||
|
case 0xA683: temp=PLC_RAM16(RAM_T_ADDR+PLC_D_C_T_addr(temp2)+Z4_Z7(temp2)*2),PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>T<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z4-Z7
|
|||
|
/************************************************C<>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA684: temp=PLC_RAM16(RAM_C_ADDR+PLC_D_C_T_addr(temp2)+Z0_Z3(temp2)*2),PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z0-Z3
|
|||
|
case 0xA685: temp=PLC_RAM16(RAM_C_ADDR+PLC_D_C_T_addr(temp2)+Z4_Z7(temp2)*2),PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z4-Z7
|
|||
|
/************************************************D<>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA686: temp=PLC_RAM16(RAM_D_ADDR+PLC_D_C_T_addr(temp2)+Z0_Z3(temp2)*2),PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z0-Z3
|
|||
|
case 0xA687: temp=PLC_RAM16(RAM_D_ADDR+PLC_D_C_T_addr(temp2)+Z4_Z7(temp2)*2),PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z4-Z7
|
|||
|
case 0xA688: temp=PLC_RAM16(RAM_D1000_ADDR+PLC_D_C_T_addr(temp2)+Z0_Z3(temp2)*2),PLC_Addr++;break;//<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000<30><30>Z0-Z3
|
|||
|
case 0xA689: temp=PLC_RAM16(RAM_D1000_ADDR+PLC_D_C_T_addr(temp2)+Z4_Z7(temp2)*2),PLC_Addr++;break;//<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000<30><30>Z4-Z7
|
|||
|
}
|
|||
|
return temp;
|
|||
|
}
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static u32 cos_u32_value(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: <20><><EFBFBD><EFBFBD>32λ<32><CEBB><EFBFBD><EFBFBD>
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>19<31><39>
|
|||
|
// <20><> ע:
|
|||
|
//-------------------------------------------------------------------------------------------------------
|
|||
|
// <20><EFBFBD><DEB8><EFBFBD>:
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>:
|
|||
|
// <20><> ע:
|
|||
|
//-------------------------------------------------------------------------------------------------------
|
|||
|
//=======================================================================================================
|
|||
|
#define D_data u32data.data
|
|||
|
static s32 cos_u32_value(void)
|
|||
|
{
|
|||
|
u16 Type_F,temp2,Data1,Data2;
|
|||
|
unsigned short temp;
|
|||
|
Data1=*PLC_Addr;
|
|||
|
PLC_Addr++;
|
|||
|
Data2=*PLC_Addr;
|
|||
|
temp2=Type_F=0;
|
|||
|
Type_F = (Data1 & 0xff00);
|
|||
|
Type_F |= (Data2 >> 8);
|
|||
|
/************************************/
|
|||
|
temp2 = (Data2 << 8);
|
|||
|
temp2 |=mov_d_addr=(u8)Data1;
|
|||
|
/************************************/
|
|||
|
switch(Type_F)
|
|||
|
{
|
|||
|
case 0x8080: u32data.data1[0]=temp2,PLC_Addr++,u32data.data1[1]=cos_value(),PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>Kֵ
|
|||
|
case 0x8280: u32data.data1[0]=temp2,PLC_Addr++,u32data.data1[1]=cos_value(),PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>Hֵ
|
|||
|
case 0x8482: D_data=MOV_K(*PLC_Addr)&0X0000000F,Transfer_bit1=1,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x8484: D_data=MOV_K(*PLC_Addr)&0X000000FF,Transfer_bit1=1,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x8486: D_data=MOV_K(*PLC_Addr)&0X00000FFF,Transfer_bit1=1,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x8488: D_data=MOV_K(*PLC_Addr)&0X0000FFFF,Transfer_bit1=1,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x848A: D_data=MOV_K(*PLC_Addr)&0X000FFFFF,Transfer_bit1=1,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x848C: D_data=MOV_K(*PLC_Addr)&0X00FFFFFF,Transfer_bit1=1,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x848E: D_data=MOV_K(*PLC_Addr)&0X0FFFFFFF,Transfer_bit1=1,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
case 0x8490: D_data=MOV_K(*PLC_Addr), Transfer_bit1=1,PLC_Addr++;break;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> K4M0 ֮<><D6AE><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
|
|||
|
case 0x8680: D_data=PLC_RAM32(RAM_D8000_ADDR+temp2),PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ D8000
|
|||
|
case 0x8682: D_data=PLC_RAM32(RAM_T_ADDR+temp2),PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>T<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
case 0x8684: D_data=PLC_RAM32(RAM_C_ADDR+temp2),PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
case 0x8686: D_data=PLC_RAM32(RAM_D_ADDR+temp2),PLC_Addr++;break; //<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
case 0x8688: D_data=PLC_RAM32(RAM_D1000_ADDR+temp2),PLC_Addr++;break; //<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000
|
|||
|
case 0xA080: u32data.data1[0]=temp2+D8028,PLC_Addr++,u32data.data1[1]=cos_value()+D8029,PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z0
|
|||
|
case 0xA081: u32data.data1[0]=temp2+D8182,PLC_Addr++,u32data.data1[1]=cos_value()+D8183,PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z1
|
|||
|
case 0xA082: u32data.data1[0]=temp2+D8184,PLC_Addr++,u32data.data1[1]=cos_value()+D8185,PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z2
|
|||
|
case 0xA083: u32data.data1[0]=temp2+D8186,PLC_Addr++,u32data.data1[1]=cos_value()+D8187,PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z3
|
|||
|
case 0xA084: u32data.data1[0]=temp2+D8188,PLC_Addr++,u32data.data1[1]=cos_value()+D8189,PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z4
|
|||
|
case 0xA085: u32data.data1[0]=temp2+D8190,PLC_Addr++,u32data.data1[1]=cos_value()+D8191,PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z5
|
|||
|
case 0xA086: u32data.data1[0]=temp2+D8192,PLC_Addr++,u32data.data1[1]=cos_value()+D8193,PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z6
|
|||
|
case 0xA087: u32data.data1[0]=temp2+D8194,PLC_Addr++,u32data.data1[1]=cos_value()+D8195,PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>K<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z7
|
|||
|
case 0xA280: u32data.data1[0]=temp2+D8028,PLC_Addr++,u32data.data1[1]=cos_value()+D8029,PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z0
|
|||
|
case 0xA281: u32data.data1[0]=temp2+D8182,PLC_Addr++,u32data.data1[1]=cos_value()+D8183,PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z1
|
|||
|
case 0xA282: u32data.data1[0]=temp2+D8184,PLC_Addr++,u32data.data1[1]=cos_value()+D8185,PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z2
|
|||
|
case 0xA283: u32data.data1[0]=temp2+D8186,PLC_Addr++,u32data.data1[1]=cos_value()+D8187,PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z3
|
|||
|
case 0xA284: u32data.data1[0]=temp2+D8188,PLC_Addr++,u32data.data1[1]=cos_value()+D8189,PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z4
|
|||
|
case 0xA285: u32data.data1[0]=temp2+D8190,PLC_Addr++,u32data.data1[1]=cos_value()+D8191,PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z5
|
|||
|
case 0xA286: u32data.data1[0]=temp2+D8192,PLC_Addr++,u32data.data1[1]=cos_value()+D8193,PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z6
|
|||
|
case 0xA287: u32data.data1[0]=temp2+D8194,PLC_Addr++,u32data.data1[1]=cos_value()+D8195,PLC_Addr-=2;break;//<2F><><EFBFBD><EFBFBD>H<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z7
|
|||
|
/************************************************K1M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA482: mov_d_addr=+DZ0_Z3(temp2),D_data=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X0000000F,PLC_Addr++;break;//K1M0<4D><30>V0-V3
|
|||
|
case 0xA483: mov_d_addr=+DZ4_Z7(temp2),D_data=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X0000000F,PLC_Addr++;break;//K1M0<4D><30>V4-V7
|
|||
|
/************************************************K2M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA484: mov_d_addr=+DZ0_Z3(temp2),D_data=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X000000FF,PLC_Addr++;break;//K2M0<4D><30>V0-V3
|
|||
|
case 0xA485: mov_d_addr=+DZ4_Z7(temp2),D_data=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X000000FF,PLC_Addr++;break;//K2M0<4D><30>V4-V7
|
|||
|
/************************************************K3M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA486: mov_d_addr=+DZ0_Z3(temp2),D_data=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X00000FFF,PLC_Addr++;break;//K3M0<4D><30>V0-V3
|
|||
|
case 0xA487: mov_d_addr=+DZ4_Z7(temp2),D_data=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X00000FFF,PLC_Addr++;break;//K3M0<4D><30>V4-V7
|
|||
|
/************************************************K4M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA488: mov_d_addr=+DZ0_Z3(temp2),D_data=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X0000FFFF,PLC_Addr++;break;//K4M0<4D><30>V0-V3
|
|||
|
case 0xA489: mov_d_addr=+DZ4_Z7(temp2),D_data=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X0000FFFF,PLC_Addr++;break;//K4M0<4D><30>V4-V7
|
|||
|
/************************************************K5M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA48A: mov_d_addr=+DZ0_Z3(temp2),D_data=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X000FFFFF,PLC_Addr++;break;//K1M0<4D><30>V0-V3
|
|||
|
case 0xA48B: mov_d_addr=+DZ4_Z7(temp2),D_data=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X000FFFFF,PLC_Addr++;break;//K1M0<4D><30>V4-V7
|
|||
|
/************************************************K6M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA48C: mov_d_addr=+DZ0_Z3(temp2),D_data=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X00FFFFFF,PLC_Addr++;break;//K2M0<4D><30>V0-V3
|
|||
|
case 0xA48D: mov_d_addr=+DZ4_Z7(temp2),D_data=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X00FFFFFF,PLC_Addr++;break;//K2M0<4D><30>V4-V7
|
|||
|
/************************************************K7M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA48E: mov_d_addr=+DZ0_Z3(temp2),D_data=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X0FFFFFFF,PLC_Addr++;break;//K3M0<4D><30>V0-V3
|
|||
|
case 0xA48F: mov_d_addr=+DZ4_Z7(temp2),D_data=MOV_K(PLC_D_C_T_addr(temp2)/0x100)&0X0FFFFFFF,PLC_Addr++;break;//K3M0<4D><30>V4-V7
|
|||
|
/************************************************K8M0<4D>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA490: mov_d_addr=+DZ0_Z3(temp2),D_data=MOV_K(PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K4M0<4D><30>V0-V3
|
|||
|
case 0xA491: mov_d_addr=+DZ4_Z7(temp2),D_data=MOV_K(PLC_D_C_T_addr(temp2)/0x100),PLC_Addr++;break;//K4M0<4D><30>V4-V7
|
|||
|
/************************************************T<>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA682: {temp=(PLC_D_C_T_addr(temp2)+DZ0_Z3(temp2)*2);if(temp>=510) PLC_PROG_ERROR(M8067,6706),D_data=0; else D_data=PLC_RAM32(RAM_T_ADDR+temp),PLC_Addr++;}break;//<2F><><EFBFBD><EFBFBD>T<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z0-Z3
|
|||
|
case 0xA683: {temp=(PLC_D_C_T_addr(temp2)+DZ4_Z7(temp2)*2);if(temp>=510) PLC_PROG_ERROR(M8067,6706),D_data=0; else D_data=PLC_RAM32(RAM_T_ADDR+temp),PLC_Addr++;}break;//<2F><><EFBFBD><EFBFBD>T<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z4-Z7
|
|||
|
/************************************************C<>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA684: {temp=(PLC_D_C_T_addr(temp2)+DZ0_Z3(temp2)*2);if(temp>=510) PLC_PROG_ERROR(M8067,6706),D_data=0; else D_data=PLC_RAM32(RAM_C_ADDR+temp),PLC_Addr++;}break;//<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z0-Z3
|
|||
|
case 0xA685: {temp=(PLC_D_C_T_addr(temp2)+DZ4_Z7(temp2)*2);if(temp>=510) PLC_PROG_ERROR(M8067,6706),D_data=0; else D_data=PLC_RAM32(RAM_C_ADDR+temp),PLC_Addr++;}break;//<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z4-Z7
|
|||
|
/************************************************D<>Ĵ<EFBFBD><C4B4><EFBFBD>"Z"*******************************************************************/
|
|||
|
case 0xA686: {temp=(PLC_D_C_T_addr(temp2)+DZ0_Z3(temp2)*2);if(temp>=15998) PLC_PROG_ERROR(M8067,6706),D_data=0; else D_data=PLC_RAM32(RAM_D_ADDR+temp);PLC_Addr++;}break;//<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z0-Z3
|
|||
|
case 0xA687: {temp=(PLC_D_C_T_addr(temp2)+DZ4_Z7(temp2)*2);if(temp>=15998) PLC_PROG_ERROR(M8067,6706),D_data=0; else D_data=PLC_RAM32(RAM_D_ADDR+temp);PLC_Addr++;}break;//<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Z4-Z7
|
|||
|
case 0xA688: {temp=(PLC_D_C_T_addr(temp2)+DZ0_Z3(temp2)*2);if(temp>=13998) PLC_PROG_ERROR(M8067,6706),D_data=0; else D_data=PLC_RAM32(RAM_D1000_ADDR+temp),PLC_Addr++;}break;//<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000<30><30>Z0-Z3
|
|||
|
case 0xA689: {temp=(PLC_D_C_T_addr(temp2)+DZ4_Z7(temp2)*2);if(temp>=13998) PLC_PROG_ERROR(M8067,6706),D_data=0; else D_data=PLC_RAM32(RAM_D1000_ADDR+temp),PLC_Addr++;}break;//<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000<30><30>Z4-Z7
|
|||
|
}
|
|||
|
PLC_Addr+=2;
|
|||
|
return D_data;
|
|||
|
}
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static float float_value(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: <20><><EFBFBD><EFBFBD>float<61><74><EFBFBD><EFBFBD>
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>19<31><39>
|
|||
|
// <20><> ע:
|
|||
|
//-------------------------------------------------------------------------------------------------------
|
|||
|
// <20><EFBFBD><DEB8><EFBFBD>:
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>:
|
|||
|
// <20><> ע:
|
|||
|
//-------------------------------------------------------------------------------------------------------
|
|||
|
//=======================================================================================================
|
|||
|
static float float_value(void)
|
|||
|
{
|
|||
|
u16 Type_F,temp1,temp2,Data1,Data2,Data3,Data4;
|
|||
|
Data1=*PLC_Addr;
|
|||
|
PLC_Addr++;
|
|||
|
Data2=*PLC_Addr;
|
|||
|
PLC_Addr++;
|
|||
|
Data3=*PLC_Addr;
|
|||
|
PLC_Addr++;
|
|||
|
Data4=*PLC_Addr;
|
|||
|
|
|||
|
Type_F = (Data1 & 0xff00);
|
|||
|
Type_F |= (Data2 >> 8);
|
|||
|
/************************************/
|
|||
|
temp1 = (Data2 << 8);
|
|||
|
temp1 |=(u8)Data1;
|
|||
|
/************************************/
|
|||
|
temp2 = (Data4 << 8);
|
|||
|
temp2 |=(u8)Data3;
|
|||
|
/************************************/
|
|||
|
if(Type_F == 0x8080) u32data.data1[0]=temp1,u32data.data1[1]=temp2, FLOAT.DATA=(float)u32data.data, PLC_Addr++;//<2F><><EFBFBD><EFBFBD>Kֵ
|
|||
|
else if(Type_F == 0x8280) u32data.data1[0]=temp1,u32data.data1[1]=temp2, FLOAT.DATA=(float)u32data.data, PLC_Addr++;//<2F><><EFBFBD><EFBFBD>Hֵ
|
|||
|
else if(Type_F == 0x8680) FLOAT.DATA=PLC_RAMfolta(RAM_D8000_ADDR+temp1),PLC_Addr++; //<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ D8000
|
|||
|
else if(Type_F == 0x8682) FLOAT.DATA=PLC_RAMfolta(RAM_T_ADDR+temp1),PLC_Addr++; //<2F><><EFBFBD><EFBFBD>T<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
else if(Type_F == 0x8684) FLOAT.DATA=PLC_RAMfolta(RAM_C_ADDR+temp1),PLC_Addr++; //<2F><><EFBFBD><EFBFBD>C<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
else if(Type_F == 0x8686) FLOAT.DATA=PLC_RAMfolta(RAM_D_ADDR+temp1),PLC_Addr++; //<2F><><EFBFBD><EFBFBD>D<EFBFBD>ĵ<EFBFBD>ַ
|
|||
|
else if(Type_F == 0x8688) FLOAT.DATA=PLC_RAMfolta(RAM_D1000_ADDR+temp1),PLC_Addr++; //<2F><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>D1000
|
|||
|
return FLOAT.DATA;
|
|||
|
}
|
|||
|
|
|||
|
static void RST_D(void)
|
|||
|
{
|
|||
|
u8 temp,addr,l_value;
|
|||
|
if(PLC_ACC_BIT&0x01)
|
|||
|
{
|
|||
|
l_value=*PLC_Addr;PLC_Addr++;addr=*PLC_Addr/0x100;
|
|||
|
if(addr==0x86)
|
|||
|
temp=l_value+((*PLC_Addr%0x100)*0x100),temp=0x0700+temp/2,PLC_16BIT[temp]=0;
|
|||
|
else if(addr==0x88)
|
|||
|
temp=l_value+((*PLC_Addr%0x100)*0x100),temp=0x1000+temp/2,PLC_16BIT[temp]=0;
|
|||
|
else if(addr==0x80)
|
|||
|
temp=l_value+((*PLC_Addr%0x100)*0x100),temp=0x1000+temp/2+1000,PLC_16BIT[temp]=0;
|
|||
|
else {PLC_PROG_ERROR(M8065,6501);}
|
|||
|
}
|
|||
|
else PLC_Addr+=2;
|
|||
|
}
|
|||
|
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void target(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>롱<EFBFBD><EBA1B1><EFBFBD><EFBFBD><F2A1B1A1><EFBFBD><EFBFBD><EFBFBD><F2A1B1B9>ø<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> <09><>DEMOV<4F><56>DEADD<44><44>DESUB<55><42>ָ<EFBFBD><D6B8><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD>ȥ
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>23<32><33>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void float_target(void)
|
|||
|
{
|
|||
|
u16 temp;
|
|||
|
temp=addr_value() ;
|
|||
|
PLC_16BIT[temp]=FLOAT.DATA1[0];
|
|||
|
PLC_16BIT[temp+1]=FLOAT.DATA1[1];
|
|||
|
PLC_Addr+=2;
|
|||
|
}
|
|||
|
|
|||
|
static void PID(void)
|
|||
|
{
|
|||
|
s16 PVn; // <20><><EFBFBD><EFBFBD>ֵ
|
|||
|
s16 SV; // <20>趨Ŀ<E8B6A8><C4BF>Desired value
|
|||
|
s16 Ts; // ȡ<><C8A1>ʱ<EFBFBD><CAB1>
|
|||
|
s32 Su;
|
|||
|
s16 KP; // P
|
|||
|
s16 Ti; // I
|
|||
|
s16 KD; // D
|
|||
|
s16 TD; // <><CEA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
u32 Addr,Addr1; // <20><>ַ<EFBFBD><D6B7>¼
|
|||
|
u32 csp; // PID<49>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01) //ĸ<>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
SV=PLC_RAM16(addr_value_prog()); // <20>趨ֵ
|
|||
|
PVn=PLC_RAM16(addr_value_prog()); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
Addr=addr_value_prog(); // <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>ַ
|
|||
|
Addr1= addr_value_prog();
|
|||
|
Ts=PLC_RAM16(Addr); // ȡ<><C8A1>ʱ<EFBFBD><CAB1>
|
|||
|
KP=PLC_RAM16(Addr+6); // P
|
|||
|
Ti=PLC_RAM16(Addr+8); // I
|
|||
|
KD=PLC_RAM16(Addr+10); // D
|
|||
|
TD=PLC_RAM16(Addr+12); // <><CEA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
csp=Addr+14; // <20>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>ַ
|
|||
|
|
|||
|
PLC_RAM16(csp+14)=KP*((PLC_RAM16(csp)-PLC_RAM16(csp+2))+((Ts/Ti)*PLC_RAM16(csp))+PLC_RAM16(csp+10));
|
|||
|
|
|||
|
PLC_RAM16(csp) = PLC_RAM16(csp+4) - SV; // <20><><EFBFBD>㱾<EFBFBD><E3B1BE>ƫ<EFBFBD><C6AB>ֵ
|
|||
|
|
|||
|
PLC_RAM16(csp+4)= PLC_RAM16(Addr+4)*PLC_RAM16(csp+6)+(1-PLC_RAM16(Addr+4))*PVn;
|
|||
|
|
|||
|
PLC_RAM16(csp+10)=(TD/(Ts+KD*TD))*(-2*PLC_RAM16(csp+6)+PLC_RAM16(csp+4)+PLC_RAM16(csp+8))+((KD*TD)/(Ts+KD*TD))*PLC_RAM16(csp+12);
|
|||
|
|
|||
|
|
|||
|
Su=PLC_RAM16(Addr1)+PLC_RAM16(csp+14);
|
|||
|
if(Su>32766) PLC_RAM16(Addr1)=32767;
|
|||
|
else if(Su<-32767) PLC_RAM16(Addr1)=-32768;
|
|||
|
else PLC_RAM16(Addr1)= Su;
|
|||
|
PLC_RAM16(csp+12)=PLC_RAM16(csp+10);
|
|||
|
PLC_RAM16(csp+8)=PLC_RAM16(csp+6);
|
|||
|
PLC_RAM16(csp+6)=PLC_RAM16(csp+4);
|
|||
|
PLC_RAM16(csp+2)=PLC_RAM16(csp);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void MOV(void) //MOV
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01) //<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
trade=cos_value(),target();
|
|||
|
else
|
|||
|
PLC_Addr+=4; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>СCPU<50><55><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DMOV(void) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD>
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
trade=cos_u32_value(),D_target();
|
|||
|
else
|
|||
|
PLC_Addr+=8; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>СCPU<50><55><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DEMOV(void) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD>
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
trade=float_value(),float_target();
|
|||
|
else
|
|||
|
PLC_Addr+=8; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>СCPU<50><55><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void ZRST(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ZRSTָ<54><EFBFBD><EEBAAF>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void ZRST(void)
|
|||
|
{
|
|||
|
u16 temp,temp1;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp=addr_value();
|
|||
|
temp1=addr_value();
|
|||
|
if(Flag_bit==0x00)
|
|||
|
{
|
|||
|
for(;temp<=temp1;temp++)
|
|||
|
PLC_BIT_OFF(temp);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
for(;temp<=temp1;temp++)
|
|||
|
PLC_16BIT[temp]=0;
|
|||
|
}
|
|||
|
}
|
|||
|
else PLC_Addr+=4;
|
|||
|
}
|
|||
|
|
|||
|
static void MTR(void)
|
|||
|
{
|
|||
|
u16 X,Y,M_Y,K_H,temp=0;
|
|||
|
u8 i,t;
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
X=addr_value();
|
|||
|
Y=addr_value();
|
|||
|
M_Y=addr_value();
|
|||
|
K_H=cos_value();
|
|||
|
for(i=0;i<K_H;i++)
|
|||
|
{
|
|||
|
temp=i*7;
|
|||
|
PLC_BIT_ON(Y+i);
|
|||
|
for(t=0;t<=7;t++)
|
|||
|
(PLC_BIT_TEST(X+t)) ? PLC_BIT_ON(M_Y+temp+t) : PLC_BIT_OFF(M_Y+temp+t);
|
|||
|
}
|
|||
|
}
|
|||
|
else PLC_Addr+=8;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
static void REFF(void)
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
X_DIY=cos_value();
|
|||
|
else X_DIY=10,PLC_Addr+=2;
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void DSQR(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 32λ<32><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DSQR
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void DSQR(void)
|
|||
|
{
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
trade=(u32)sqrt((double)cos_u32_value());
|
|||
|
target();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void HSCS(void) //<2F><><EFBFBD>ټ<EFBFBD><D9BC><EFBFBD><EFBFBD><EFBFBD>λ
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if((temp2==temp1)&&((PLC_ACC_BIT&0X01)==0X01))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=~1;
|
|||
|
}
|
|||
|
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void SQR(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16λ<36><CEBB><EFBFBD><EFBFBD>λ RCRָ<52><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void SQR(void)
|
|||
|
{
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
trade=(u16)sqrt((double)cos_value());
|
|||
|
target();
|
|||
|
}
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void DRCR(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 32λ<32><CEBB><EFBFBD><EFBFBD>λ RCRָ<52><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void DRCR(void)
|
|||
|
{
|
|||
|
u32 temp1,temp2;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
trade=temp1>>temp2;
|
|||
|
PLC_Addr-=8;
|
|||
|
D_target();
|
|||
|
PLC_Addr+=4;
|
|||
|
}
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void RCR(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16λ<36><CEBB><EFBFBD><EFBFBD>λ RCRָ<52><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void RCR(void)
|
|||
|
{
|
|||
|
u16 temp1,temp2;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
trade=temp1>>temp2;
|
|||
|
PLC_Addr-=4;
|
|||
|
target();
|
|||
|
PLC_Addr+=2;
|
|||
|
}
|
|||
|
else PLC_Addr+=4; //û<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void DROL(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 32λ<32><CEBB><EFBFBD><EFBFBD>λ RCLָ<4C><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void DRCL(void)
|
|||
|
{
|
|||
|
u32 temp1,temp2;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
trade=temp1<<temp2;
|
|||
|
PLC_Addr-=8;
|
|||
|
D_target();
|
|||
|
PLC_Addr+=4;
|
|||
|
}
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void ROL(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16λ<36><CEBB><EFBFBD><EFBFBD>λ RCLָ<4C><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void RCL(void)
|
|||
|
{
|
|||
|
u16 temp1,temp2;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
trade=temp1<<temp2;
|
|||
|
PLC_Addr-=4;
|
|||
|
target();
|
|||
|
PLC_Addr+=2;
|
|||
|
}
|
|||
|
else PLC_Addr+=4; //û<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void DROR(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 32λѭ<CEBB><D1AD><EFBFBD><EFBFBD>λ RORָ<52><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void DROR(void)
|
|||
|
{
|
|||
|
u32 temp1,temp2;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
trade=ROTATE_RIGHT(temp1,32,temp2);
|
|||
|
PLC_Addr-=8;
|
|||
|
D_target();
|
|||
|
PLC_Addr+=4;
|
|||
|
}
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void ROR(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16λѭ<CEBB><D1AD><EFBFBD><EFBFBD>λ RORָ<52><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void ROR(void)
|
|||
|
{
|
|||
|
u16 temp1,temp2;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
trade=ROTATE_RIGHT(temp1,16,temp2);
|
|||
|
PLC_Addr-=4;
|
|||
|
target();
|
|||
|
PLC_Addr+=2;
|
|||
|
}
|
|||
|
else PLC_Addr+=4; //û<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void DROL(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 32λѭ<CEBB><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ ROLָ<4C><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void DROL(void)
|
|||
|
{
|
|||
|
u32 temp1,temp2;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
trade=ROTATE_LEFT(temp1,32,temp2);
|
|||
|
PLC_Addr-=8;
|
|||
|
D_target();
|
|||
|
PLC_Addr+=4;
|
|||
|
}
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void ROL(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16λѭ<CEBB><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ ROLָ<4C><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void ROL(void)
|
|||
|
{
|
|||
|
u16 temp1,temp2;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
trade=ROTATE_LEFT(temp1,16,temp2);
|
|||
|
PLC_Addr-=4;
|
|||
|
target();
|
|||
|
PLC_Addr+=2;
|
|||
|
}
|
|||
|
else PLC_Addr+=4; //û<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void DSWAP(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 32λ<32><CEBB><EFBFBD>½<EFBFBD><C2BD><EFBFBD> DSWAPָ<50><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void DSWAP(void)
|
|||
|
{
|
|||
|
u32 temp;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp=cos_u32_value();
|
|||
|
trade=swap_u32(temp);
|
|||
|
PLC_Addr-=4;
|
|||
|
D_target();
|
|||
|
}
|
|||
|
}
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void DGBIN(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16λ<36><CEBB><EFBFBD>½<EFBFBD><C2BD><EFBFBD> DGBINָ<4E><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>8<EFBFBD><38>4<EFBFBD><34>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void DGBIN(void)
|
|||
|
{
|
|||
|
signed int temp;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp=cos_value();
|
|||
|
trade=GtoB(temp);
|
|||
|
D_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=8; //û<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8<EFBFBD><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void GBIN(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16λ<36><CEBB><EFBFBD>½<EFBFBD><C2BD><EFBFBD> GBINָ<4E><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void GBIN(void)
|
|||
|
{
|
|||
|
signed short int temp;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp=cos_value();
|
|||
|
trade=(u16)GtoB((unsigned int)temp);
|
|||
|
target();
|
|||
|
}
|
|||
|
else PLC_Addr+=4; //û<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void DGRY(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16λ<36><CEBB><EFBFBD>½<EFBFBD><C2BD><EFBFBD> DGRYָ<59><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>8<EFBFBD><38>4<EFBFBD><34>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void DGRY(void)
|
|||
|
{
|
|||
|
signed int temp;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp=cos_value();
|
|||
|
trade=BtoG(temp);
|
|||
|
D_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=8; //û<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8<EFBFBD><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void GRY(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16λ<36><CEBB><EFBFBD>½<EFBFBD><C2BD><EFBFBD> GRYָ<59><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void GRY(void)
|
|||
|
{
|
|||
|
signed short int temp;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp=cos_value();
|
|||
|
trade=(u16)BtoG((unsigned int)temp);
|
|||
|
target();
|
|||
|
}
|
|||
|
else PLC_Addr+=4; //û<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void SWAP(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16λ<36><CEBB><EFBFBD>½<EFBFBD><C2BD><EFBFBD> SWAPָ<50><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void SWAP(void)
|
|||
|
{
|
|||
|
signed short int temp;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp=cos_value();
|
|||
|
trade=swap_u16(temp);
|
|||
|
PLC_Addr-=2;
|
|||
|
target();
|
|||
|
}
|
|||
|
else PLC_Addr+=4; //û<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void SFTR(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SFTRָ<52><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>8<EFBFBD><38>9<EFBFBD><39>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
//static void SFTR(void)
|
|||
|
//{
|
|||
|
//signed short int addr1,addr2,temp1,temp2,temp5,temp6,i;
|
|||
|
// u8 temp3,temp4;
|
|||
|
// if(PLC_ACC_BIT&0X01)
|
|||
|
// {
|
|||
|
// addr1=addr_value();
|
|||
|
// Flag_bit=0xff;
|
|||
|
//
|
|||
|
// addr2=addr_value();
|
|||
|
// Flag_bit=0xff;
|
|||
|
//
|
|||
|
// temp1=cos_value();
|
|||
|
// temp5=cos_value();
|
|||
|
// temp2=temp5+temp4;
|
|||
|
// temp6=temp1-temp5;
|
|||
|
// for(i=0;i<temp6;i++)
|
|||
|
// {
|
|||
|
// (PLC_BIT_TEST(addr2+i)) ? PLC_BIT_ON(addr2+i) : PLC_BIT_OFF(addr2+i);
|
|||
|
// }
|
|||
|
// for(;i<temp1;i++)
|
|||
|
// {
|
|||
|
// (PLC_BIT_TEST(addr1+i)) ? PLC_BIT_ON(addr2+i) : PLC_BIT_OFF(addr2+i);
|
|||
|
// }
|
|||
|
// }
|
|||
|
// else PLC_Addr+=8; //û<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void XCH(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16λ<36><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> XCHָ<48><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void XCH(void)
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
PLC_Addr-=4;
|
|||
|
trade=temp2;
|
|||
|
D_target();
|
|||
|
trade=temp1;
|
|||
|
D_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=4; //û<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void DFMOV(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 32λ<32><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DXCHָ<48><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void DXCH(void)
|
|||
|
{
|
|||
|
signed int temp1,temp2;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
PLC_Addr-=8;
|
|||
|
trade=temp2;
|
|||
|
D_target();
|
|||
|
trade=temp1;
|
|||
|
D_target();
|
|||
|
}
|
|||
|
}
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void DFMOV(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 32λ<32><CEBB><EFBFBD>㴫<EFBFBD><E3B4AB> DFMOVָ<56><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void DFMOV(void)
|
|||
|
{
|
|||
|
signed short int temp,i;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
trade=cos_u32_value(); //Ҫ<><D2AA><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
D_target(); //<2F>ѵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD>ȥ
|
|||
|
temp=cos_u32_value(); // <<<-------------|
|
|||
|
PLC_Addr-=4; //PLC_Addr-=4<><34>Ϊ<EFBFBD>˵<EFBFBD><CBB5>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD> |<<-----|
|
|||
|
for(i=1;i<temp;i++) // |
|
|||
|
{ // |
|
|||
|
if(Transfer_bit==1)Transfer=i*32;// |
|
|||
|
else Transfer=i*4; // |
|
|||
|
PLC_Addr-=4;D_target(); //PLC_Addr-=4<><34>Ϊ<EFBFBD>˴<EFBFBD><CBB4>ݳ<EFBFBD>ȥҪ<C8A5><D2AA>λ<EFBFBD><CEBB> |
|
|||
|
} // |
|
|||
|
PLC_Addr+=2;Transfer=0; //PLC_Addr+=2<><32>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5>---|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void FMOV(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16λ<36><CEBB><EFBFBD>㴫<EFBFBD><E3B4AB> FMOVָ<56><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void FMOV(void)
|
|||
|
{
|
|||
|
signed short int temp,i;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
trade=cos_value(); //Ҫ<><D2AA><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
target(); //<2F>ѵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD>ȥ
|
|||
|
temp=cos_value(); // <<<-------------|
|
|||
|
PLC_Addr-=2; //PLC_Addr-=2<><32>Ϊ<EFBFBD>˵<EFBFBD><CBB5>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD> |<<-----|
|
|||
|
for(i=1;i<temp;i++) // |
|
|||
|
{ // |
|
|||
|
if(Transfer_bit==1)Transfer=i*16;// |
|
|||
|
else Transfer=i*2; // |
|
|||
|
PLC_Addr-=2;target(); //PLC_Addr-=2<><32>Ϊ<EFBFBD>˴<EFBFBD><CBB4>ݳ<EFBFBD>ȥҪ<C8A5><D2AA>λ<EFBFBD><CEBB> |
|
|||
|
} // |
|
|||
|
PLC_Addr+=2;Transfer=0; //PLC_Addr+=2<><32>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5>---|
|
|||
|
}
|
|||
|
else PLC_Addr+=6; //û<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6<EFBFBD><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void FMOV(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16λ<36><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BMOVָ<56><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void BMOV(void)
|
|||
|
{
|
|||
|
signed short int temp,i;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
trade=cos_value(); //Ҫ<><D2AA><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
target(); //<2F>ѵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD>ȥ
|
|||
|
temp=cos_value();
|
|||
|
PLC_Addr-=2; //<<<---------------------------------|
|
|||
|
for(i=1;i<temp;i++) // |
|
|||
|
{ // |
|
|||
|
if(Transfer_bit1==1)Transfer=i*16;// |
|
|||
|
else Transfer=i*2; // |
|
|||
|
PLC_Addr-=4; //
|
|||
|
trade=cos_value(); //Ҫ<><D2AA><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if(Transfer_bit==1)Transfer=i*16;
|
|||
|
else Transfer=i*2;
|
|||
|
target(); //<2F>ѵڴ<D1B5><DAB4>ݳ<EFBFBD>ȥ
|
|||
|
} // |
|
|||
|
PLC_Addr+=2;Transfer=0; //PLC_Addr+=2<><32>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5>-----|
|
|||
|
}
|
|||
|
else PLC_Addr+=6; //<2F><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>¾<EFBFBD><C2BE><EFBFBD><EFBFBD><EFBFBD>6<EFBFBD><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DCML(void) //32λ<32><CEBB><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>
|
|||
|
{
|
|||
|
s32 temp1;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_u32_value();
|
|||
|
trade=~temp1;
|
|||
|
D_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=8; //<2F><><EFBFBD><EFBFBD>8<EFBFBD><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void CML(void) //<2F><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>
|
|||
|
{
|
|||
|
signed short int temp1;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_value();
|
|||
|
trade=~temp1;
|
|||
|
target();
|
|||
|
}
|
|||
|
else PLC_Addr+=4; //<2F><><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
u16 bcd[4]={0x1,0x10,0x100,0x1000};
|
|||
|
static void SMOV(void) //16λ<36>Ƚϴ<C8BD><CFB4><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
u16 temp1,temp2,temp3,temp4,temp5,temp6;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
temp3=cos_value();
|
|||
|
temp4=addr_value();
|
|||
|
temp5=cos_value();
|
|||
|
temp1%=bcd[temp2];
|
|||
|
for(temp6=0;temp6<temp3;temp6++)
|
|||
|
{
|
|||
|
temp2--;temp5--;
|
|||
|
PLC_16BIT[temp4]|=(temp1/bcd[temp2])*bcd[temp5];
|
|||
|
if((temp2==1)&&(temp5==1))PLC_16BIT[temp4]|=temp1%0x10*bcd[temp5], temp6=temp3+1;
|
|||
|
else temp1%=bcd[temp2];
|
|||
|
}
|
|||
|
}
|
|||
|
else PLC_Addr+=10; //<2F><><EFBFBD><EFBFBD>10<31><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void TZCP(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TZCPָ<50><EFBFBD><EEBAAF>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>7<EFBFBD><37>26<32><36>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void TZCP(void)
|
|||
|
{
|
|||
|
u16 h,min,s,temp,temp1,temp3,temp4,h1,min1,s1;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp3=addr_value(); //S1 <20><><EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
h=PLC_16BIT[temp3];
|
|||
|
min=PLC_16BIT[temp3+1];
|
|||
|
s=PLC_16BIT[temp3+2];
|
|||
|
|
|||
|
temp4=addr_value(); //S2 <20><><EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
h1=PLC_16BIT[temp4];
|
|||
|
min1=PLC_16BIT[temp4+1];
|
|||
|
s1=PLC_16BIT[temp4+2];
|
|||
|
|
|||
|
temp=addr_value(); //S3 ʱ<><CAB1><EFBFBD>Ƚ<EFBFBD>ֵ
|
|||
|
|
|||
|
temp1=addr_value();Flag_bit=0XFF;
|
|||
|
PLC_BIT_OFF(temp1);PLC_BIT_OFF(temp1+1);PLC_BIT_OFF(temp1+2);
|
|||
|
if((h>=PLC_16BIT[temp])&&(min>=PLC_16BIT[temp+1])&&(s>PLC_16BIT[temp+2]))
|
|||
|
{PLC_BIT_ON(temp1);}
|
|||
|
else if(((h<=PLC_16BIT[temp])&&(min<=PLC_16BIT[temp+1])&&(s<=PLC_16BIT[temp+1]))&&((h1>=PLC_16BIT[temp])&&(min1>=PLC_16BIT[temp+1])&&(s1>=PLC_16BIT[temp+2])))
|
|||
|
{PLC_BIT_ON(temp1+1);}
|
|||
|
else if((h1<=PLC_16BIT[temp])&&(min1<=PLC_16BIT[temp+1])&&(s1<PLC_16BIT[temp+2]))
|
|||
|
{PLC_BIT_ON(temp1+2);}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void EZCP(void) //16λ<36>Ƚϴ<C8BD><CFB4><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
float temp1,temp2,temp3;u32 temp4;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=float_value();
|
|||
|
temp2=float_value();
|
|||
|
temp3=float_value();
|
|||
|
temp4=addr_value();Flag_bit=0XFF;
|
|||
|
PLC_BIT_OFF(temp4);PLC_BIT_OFF(temp4+1);PLC_BIT_OFF(temp4+2);
|
|||
|
if(temp1>temp3) PLC_BIT_ON(temp4+0);
|
|||
|
else if((temp1<=temp3)&&(temp3<=temp2)) PLC_BIT_ON(temp4+1);
|
|||
|
else if(temp2<temp3) PLC_BIT_ON(temp4+2);
|
|||
|
}
|
|||
|
else PLC_Addr+=16; //<2F><><EFBFBD><EFBFBD>16<31><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DZCP(void) //16λ<36>Ƚϴ<C8BD><CFB4><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
s32 temp1,temp2,temp3,temp4;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
temp3=cos_u32_value();
|
|||
|
temp4=addr_value();Flag_bit=0XFF;
|
|||
|
PLC_BIT_OFF(temp4);PLC_BIT_OFF(temp4+1);PLC_BIT_OFF(temp4+2);
|
|||
|
if(temp1>temp3) PLC_BIT_ON(temp4);
|
|||
|
else if((temp1<=temp3)&&(temp3<=temp2)) PLC_BIT_ON(temp4+1);
|
|||
|
else if(temp2<temp3) PLC_BIT_ON(temp4+2);
|
|||
|
}
|
|||
|
else PLC_Addr+=16; //<2F><><EFBFBD><EFBFBD>16<31><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void ZCP(void) //16λ<36>Ƚϴ<C8BD><CFB4><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
signed short int temp1,temp2,temp3,temp4;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
temp3=cos_value();
|
|||
|
temp4=addr_value();Flag_bit=0XFF;
|
|||
|
PLC_BIT_OFF(temp4);PLC_BIT_OFF(temp4+1);PLC_BIT_OFF(temp4+2);
|
|||
|
if(temp1>temp3) PLC_BIT_ON(temp4);
|
|||
|
else if((temp1<=temp3)&&(temp3<=temp2)) PLC_BIT_ON(temp4+1);
|
|||
|
else if(temp2<temp3) PLC_BIT_ON(temp4+2);
|
|||
|
}
|
|||
|
else PLC_Addr+=8; //<2F><><EFBFBD><EFBFBD>8<EFBFBD><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void TCMP(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TCMPָ<50><EFBFBD><EEBAAF>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>7<EFBFBD><37>26<32><36>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void TCMP(void)
|
|||
|
{
|
|||
|
u16 h,min,s,temp,temp1;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
h=cos_value();min=cos_value();s=cos_value();
|
|||
|
temp=addr_value();
|
|||
|
temp1=addr_value();Flag_bit=0XFF;
|
|||
|
PLC_BIT_OFF(temp1);PLC_BIT_OFF(temp1+1);PLC_BIT_OFF(temp1+2);
|
|||
|
if((h>=PLC_16BIT[temp])&&(min>=PLC_16BIT[temp+1])&&(s>PLC_16BIT[temp+2]))
|
|||
|
{PLC_BIT_ON(temp1);}
|
|||
|
else if((h==PLC_16BIT[temp])&&(min==PLC_16BIT[temp+1])&&(s==PLC_16BIT[temp+2]))
|
|||
|
{PLC_BIT_ON(temp1+1);}
|
|||
|
else if((h<=PLC_16BIT[temp])&&(min<=PLC_16BIT[temp+1])&&(s<PLC_16BIT[temp+2]))
|
|||
|
{PLC_BIT_ON(temp1+2);}
|
|||
|
}
|
|||
|
else PLC_Addr+=10;
|
|||
|
}
|
|||
|
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void ECMP(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ECMPָ<50><EFBFBD><EEBAAF>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>7<EFBFBD><37>26<32><36>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void ECMP(void) //<2F><><EFBFBD><EFBFBD><EFBFBD>Ƚϴ<C8BD><CFB4><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
signed short int temp3;
|
|||
|
static float temp1,temp2;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=float_value();
|
|||
|
temp2=float_value();
|
|||
|
temp3=addr_value();Flag_bit=0XFF;
|
|||
|
PLC_BIT_OFF(temp3);PLC_BIT_OFF(temp3+1);PLC_BIT_OFF(temp3+2);
|
|||
|
if(temp1>temp2) PLC_BIT_ON(temp3);
|
|||
|
else if(temp1==temp2) PLC_BIT_ON(temp3+1);
|
|||
|
else if(temp1<temp2) PLC_BIT_ON(temp3+2);
|
|||
|
}
|
|||
|
else PLC_Addr+=12; //<2F><><EFBFBD><EFBFBD>12<31><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void DCMP(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DCMPָ<50><EFBFBD><EEBAAF>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>7<EFBFBD><37>26<32><36>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void DCMP(void) //32λ<32>Ƚϴ<C8BD><CFB4><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
signed short int temp3;
|
|||
|
static int temp1,temp2;
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
temp3=addr_value();Flag_bit=0XFF;
|
|||
|
PLC_BIT_OFF(temp3);PLC_BIT_OFF(temp3+1);PLC_BIT_OFF(temp3+2);
|
|||
|
if(temp1>temp2) PLC_BIT_ON(temp3+0);
|
|||
|
else if(temp1==temp2) PLC_BIT_ON(temp3+1);
|
|||
|
else if(temp1<temp2) PLC_BIT_ON(temp3+2);
|
|||
|
}
|
|||
|
else PLC_Addr+=12; //<2F><><EFBFBD><EFBFBD>12<31><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DCMPP(void)
|
|||
|
{
|
|||
|
signed short int temp3;
|
|||
|
static int temp1,temp2;
|
|||
|
if(PLC_LDP_TEST()) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
{
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
temp3=addr_value();Flag_bit=0XFF;
|
|||
|
PLC_BIT_OFF(temp3);PLC_BIT_OFF(temp3+1);PLC_BIT_OFF(temp3+2);
|
|||
|
if(temp1>temp2) PLC_BIT_ON(temp3+0);
|
|||
|
else if(temp1==temp2) PLC_BIT_ON(temp3+1);
|
|||
|
else if(temp1<temp2) PLC_BIT_ON(temp3+2);
|
|||
|
}
|
|||
|
else
|
|||
|
PLC_Addr+=12; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>СCPU<50><55><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void CMP(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CMPָ<50><EFBFBD><EEBAAF>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>7<EFBFBD><37>26<32><36>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void CMP(void) //16λ<36>Ƚϴ<C8BD><CFB4><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
signed short int temp1,temp2,temp3;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
temp3=addr_value();Flag_bit=0XFF;
|
|||
|
PLC_BIT_OFF(temp3);PLC_BIT_OFF(temp3+1);PLC_BIT_OFF(temp3+2);
|
|||
|
if(temp1>temp2) PLC_BIT_ON(temp3);
|
|||
|
else if(temp1==temp2) PLC_BIT_ON(temp3+1);
|
|||
|
else if(temp1<temp2) PLC_BIT_ON(temp3+2);
|
|||
|
}
|
|||
|
else PLC_Addr+=6; //<2F><><EFBFBD><EFBFBD>6<EFBFBD><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void CMP_P(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CMPPָ<50><EFBFBD><EEBAAF>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>8<EFBFBD><38>26<32><36>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void CMPP(void)
|
|||
|
{
|
|||
|
signed short int temp1,temp2,temp3;
|
|||
|
if(PLC_LDP_TEST()) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
{
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
temp3=addr_value();Flag_bit=0XFF;
|
|||
|
PLC_BIT_OFF(temp3);PLC_BIT_OFF(temp3+1);PLC_BIT_OFF(temp3+2);
|
|||
|
if(temp1>temp2) PLC_BIT_ON(temp3);
|
|||
|
else if(temp1==temp2) PLC_BIT_ON(temp3+1);
|
|||
|
else if(temp1<temp2) PLC_BIT_ON(temp3+2);
|
|||
|
}
|
|||
|
else
|
|||
|
PLC_Addr+=6; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>СCPU<50><55><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
static void DINC(void) //32λ<32><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD> <20><>1ָ<31><D6B8>
|
|||
|
{
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
trade=(u32)cos_u32_value()+1;
|
|||
|
PLC_Addr-=4;
|
|||
|
D_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=4; //<2F><><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DINC_P(void) //CALLP
|
|||
|
{
|
|||
|
if(PLC_PL_BIT_TEST(PLC_Addr-PLC_START_Address)==off)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
{
|
|||
|
PLC_PL_BIT_ON(PLC_Addr-PLC_START_Address);
|
|||
|
trade=(u32)cos_u32_value()+1;
|
|||
|
PLC_Addr-=4;
|
|||
|
trade++;
|
|||
|
D_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=4;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if(!((PLC_ACC_BIT&0x01)==0x01)) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_PL_BIT_OFF(PLC_Addr-PLC_START_Address);//
|
|||
|
PLC_Addr+=4; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>СCPU<50><55><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void INC(void) //<2F><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD> <20><>1ָ<31><D6B8>
|
|||
|
{
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
trade=cos_value();
|
|||
|
PLC_Addr-=2;
|
|||
|
trade++;
|
|||
|
target();
|
|||
|
}
|
|||
|
else PLC_Addr+=2; //<2F><><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void INCP(void) //INCP
|
|||
|
{
|
|||
|
if(PLC_LDP_TEST())//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
{
|
|||
|
trade=cos_value();
|
|||
|
PLC_Addr-=2;
|
|||
|
trade++;
|
|||
|
target();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_Addr+=2; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>СCPU<50><55><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void DDEC(void) //32λ<32><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD> <20><>1ָ<31><D6B8>
|
|||
|
{
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
trade=cos_u32_value()-1;
|
|||
|
PLC_Addr-=4;
|
|||
|
D_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=4; //<2F><><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DEC(void) //<2F><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD> <20><>1ָ<31><D6B8>
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
trade=cos_value()-1;
|
|||
|
PLC_Addr-=2;
|
|||
|
target();
|
|||
|
}
|
|||
|
else PLC_Addr+=2; //<2F><><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DECP(void) //INCP
|
|||
|
{
|
|||
|
if(PLC_LDP_TEST()) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
{
|
|||
|
trade=cos_value()-1;
|
|||
|
PLC_Addr-=2;
|
|||
|
target();
|
|||
|
}
|
|||
|
else
|
|||
|
PLC_Addr+=2; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>СCPU<50><55><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DNEG(void) //32λ<32><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
trade=0-cos_u32_value();
|
|||
|
PLC_Addr-=4;
|
|||
|
D_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=4; //<2F><><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void NEG(void) //<2F><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
trade=0-cos_value();
|
|||
|
PLC_Addr-=2;
|
|||
|
target();
|
|||
|
}
|
|||
|
else PLC_Addr+=2; //<2F><><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DWAND(void) //<2F><EFBFBD><DFBC><EFBFBD><EFBFBD>㡰<EFBFBD>롱
|
|||
|
{
|
|||
|
u32 temp1,temp2;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();;
|
|||
|
trade=temp1&temp2;
|
|||
|
D_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=12; //<2F><><EFBFBD><EFBFBD>12<31><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void WAND(void) //<2F><EFBFBD><DFBC><EFBFBD><EFBFBD>㡰<EFBFBD>롱
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
trade=temp1&temp2;
|
|||
|
target();
|
|||
|
}
|
|||
|
else PLC_Addr+=6; //<2F><><EFBFBD><EFBFBD>6<EFBFBD><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DWOR(void) //<2F><EFBFBD><DFBC><EFBFBD><EFBFBD>㡰<EFBFBD><E3A1B0><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
u32 temp1,temp2;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();;
|
|||
|
trade=temp1|temp2;
|
|||
|
D_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=12; //<2F><><EFBFBD><EFBFBD>12<31><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void WOR(void) //<2F><EFBFBD><DFBC><EFBFBD><EFBFBD>㡰<EFBFBD><E3A1B0><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
trade=temp1|temp2;
|
|||
|
target();
|
|||
|
}
|
|||
|
else PLC_Addr+=6; //<2F><><EFBFBD><EFBFBD>6<EFBFBD><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DWXOR(void) //<2F><EFBFBD><DFBC><EFBFBD><EFBFBD>㡰<EFBFBD><E3A1B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
u32 temp1,temp2;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
trade=temp1^temp2;
|
|||
|
D_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=12; //<2F><><EFBFBD><EFBFBD>12<31><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void WXOR(void) //<2F><EFBFBD><DFBC><EFBFBD><EFBFBD>㡰<EFBFBD><E3A1B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
trade=cos_value()^cos_value();
|
|||
|
target();
|
|||
|
}
|
|||
|
else PLC_Addr+=6; //<2F><><EFBFBD><EFBFBD>6<EFBFBD><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void TADD(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TADDָ<44><EFBFBD><EEBAAF>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>7<EFBFBD><37>26<32><36>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void TADD(void)
|
|||
|
{
|
|||
|
u16 temp,temp1,temp2;
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
temp1=addr_value();
|
|||
|
temp2=addr_value();
|
|||
|
temp=addr_value();
|
|||
|
PLC_16BIT[temp]=PLC_16BIT[temp1]+PLC_16BIT[temp2];
|
|||
|
PLC_16BIT[temp+1]=PLC_16BIT[temp1+1]+PLC_16BIT[temp2+1];
|
|||
|
PLC_16BIT[temp+2]=PLC_16BIT[temp1+2]+PLC_16BIT[temp2+2];
|
|||
|
}
|
|||
|
}
|
|||
|
void MEAN(void)
|
|||
|
{
|
|||
|
u16 temp,temp2;uint64_t data;u32 temp1;
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
temp1=addr_value_prog();
|
|||
|
PLC_Addr+=2; //Щ<><D0A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
temp2=cos_value();
|
|||
|
if(Flag_bit==0xff) //<2F>Dz<EFBFBD><C7B2><EFBFBD>K4M0֮<30><D6AE><EFBFBD>ļĴ<C4BC><C4B4><EFBFBD>
|
|||
|
{
|
|||
|
for(temp=0;temp<temp2;temp++)
|
|||
|
{data+=PLC_RAM16(temp1+temp*2);}
|
|||
|
PLC_Addr-=4; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
data=(u16)temp1;
|
|||
|
PLC_Addr-=4; //<2F><><EFBFBD><EFBFBD>
|
|||
|
for(temp=1;temp<temp2;temp++)
|
|||
|
{
|
|||
|
PLC_Addr-=2;
|
|||
|
Transfer=temp*16;
|
|||
|
data+=addr_value_prog();
|
|||
|
}
|
|||
|
Flag_bit=0xff;
|
|||
|
}
|
|||
|
trade=data/temp2;
|
|||
|
target();
|
|||
|
PLC_Addr+=2;
|
|||
|
}
|
|||
|
else PLC_Addr+=6;
|
|||
|
}
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void ADD(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16λ<36><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ADDָ<44><D6B8> <20>ӷ<EFBFBD>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>8<EFBFBD><38>4<EFBFBD><34>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void ADD(void)
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
trade=cos_value()+cos_value();
|
|||
|
target();
|
|||
|
}
|
|||
|
else PLC_Addr+=6; //<2F><><EFBFBD><EFBFBD>6<EFBFBD><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
//=======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void ALT(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16λ<36><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ALTָ<54><D6B8>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>8<EFBFBD><38>4<EFBFBD><34>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void ALT(void)
|
|||
|
{
|
|||
|
signed int temp;
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
temp=addr_value();
|
|||
|
if(PLC_BIT_TEST(temp))
|
|||
|
PLC_BIT_OFF(temp);
|
|||
|
else
|
|||
|
PLC_BIT_ON(temp);
|
|||
|
}
|
|||
|
else PLC_Addr+=2; //û<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void TRD(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TRDָ<44><EFBFBD><EEBAAF>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>7<EFBFBD><37>26<32><36>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void TRD(void)
|
|||
|
{
|
|||
|
u16 temp;
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
temp=addr_value();
|
|||
|
PLC_16BIT[temp]=PLC_16BIT[0x712];
|
|||
|
PLC_16BIT[temp+1]=PLC_16BIT[0x711];
|
|||
|
PLC_16BIT[temp+2]=PLC_16BIT[0x710];
|
|||
|
PLC_16BIT[temp+3]=PLC_16BIT[0x70F];
|
|||
|
PLC_16BIT[temp+4]=PLC_16BIT[0x70E];
|
|||
|
PLC_16BIT[temp+5]=PLC_16BIT[0X70D];
|
|||
|
PLC_16BIT[temp+6]=PLC_16BIT[0X713];
|
|||
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
else PLC_Addr+=2; //<2F><><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void TWR(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TWRָ<52><EFBFBD><EEBAAF>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>7<EFBFBD><37>26<32><36>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void TWR(void)
|
|||
|
{
|
|||
|
u16 temp;
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
temp=addr_value();
|
|||
|
RTC_Set(PLC_16BIT[temp],PLC_16BIT[temp+1],PLC_16BIT[temp+2],PLC_16BIT[temp+3],PLC_16BIT[temp+4],PLC_16BIT[temp+5]);
|
|||
|
//д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
else PLC_Addr+=2; //<2F><><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void TSUB(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TSUBָ<42><EFBFBD><EEBAAF>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2015<31><35>7<EFBFBD><37>26<32><36>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void TSUB(void)
|
|||
|
{
|
|||
|
u16 temp,temp1,temp2;
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
temp1=addr_value();
|
|||
|
temp2=addr_value();
|
|||
|
temp=addr_value();
|
|||
|
PLC_16BIT[temp]=PLC_16BIT[temp1]-PLC_16BIT[temp2];
|
|||
|
PLC_16BIT[temp+1]=PLC_16BIT[temp1+1]-PLC_16BIT[temp2+1];
|
|||
|
PLC_16BIT[temp+2]=PLC_16BIT[temp1+2]-PLC_16BIT[temp2+2];
|
|||
|
//ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void SUB(void) //<2F><><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
PLC_Err=PLC_Addr;
|
|||
|
trade=cos_value()-cos_value();
|
|||
|
target();
|
|||
|
}
|
|||
|
else PLC_Addr+=6; //<2F><><EFBFBD><EFBFBD>6<EFBFBD><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DBCD(void) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>DBCD
|
|||
|
{
|
|||
|
signed int can1,add1,add2,add3,add4,buffer1,buffer2,buffer3,buffer4;
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
PLC_Err=PLC_Addr;
|
|||
|
can1=cos_u32_value();
|
|||
|
add1=can1%10;
|
|||
|
add2=can1/10;
|
|||
|
add2=add2%10;
|
|||
|
add3=can1/100;
|
|||
|
add3=add3%10;
|
|||
|
add4=can1/1000;
|
|||
|
add4=add4%10;
|
|||
|
|
|||
|
buffer1=can1/10000;
|
|||
|
buffer1=buffer1%10;
|
|||
|
|
|||
|
buffer2=can1/100000;
|
|||
|
buffer2=buffer2%10;
|
|||
|
|
|||
|
buffer3=can1/1000000;
|
|||
|
buffer3=buffer3%10;
|
|||
|
|
|||
|
buffer4=can1/10000000;
|
|||
|
buffer4=buffer4%10;
|
|||
|
|
|||
|
trade=buffer4*16*256*65536+buffer3*256*65536+buffer2*16*65536+buffer1*65536+add4*16*256+add3*256+add2*16+add1;
|
|||
|
D_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=8; //<2F><><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void BCD(void) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>BCD
|
|||
|
{
|
|||
|
signed short Ia, Ic;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
PLC_Err=PLC_Addr;
|
|||
|
Ic = cos_value();
|
|||
|
Ia = (Ic / 1000) << 12;
|
|||
|
Ic %= 1000;
|
|||
|
Ia |= (Ic / 100 ) << 8;
|
|||
|
Ic %= 100;
|
|||
|
Ia |= (Ic / 10 ) << 4;
|
|||
|
Ic %= 10;
|
|||
|
Ia |= Ic;
|
|||
|
trade=Ia;
|
|||
|
target();
|
|||
|
}
|
|||
|
else PLC_Addr+=4; //<2F><><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DBIN(void) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>DBIN
|
|||
|
{
|
|||
|
signed int can1,add1,add2,add3,add4,buffer1,buffer2,buffer3,buffer4;
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
PLC_Err=PLC_Addr;
|
|||
|
can1=cos_u32_value();
|
|||
|
add1=can1%16;
|
|||
|
add2=can1/16;
|
|||
|
add2=add2%16;
|
|||
|
add3=can1/256;
|
|||
|
add3=add3%16;
|
|||
|
add4=can1/(16*256);
|
|||
|
add4=add4%16;
|
|||
|
|
|||
|
can1=can1/65536;
|
|||
|
buffer1=can1%16;
|
|||
|
buffer2=can1/16;
|
|||
|
buffer2=buffer2%16;
|
|||
|
buffer3=can1/256;
|
|||
|
buffer3=buffer3%16;
|
|||
|
buffer4=can1/(16*256);
|
|||
|
buffer4=buffer4%16;
|
|||
|
|
|||
|
trade=buffer4*10000000+buffer3*1000000+buffer2*100000+buffer1*10000+add4*1000+add3*100+add2*10+add1;
|
|||
|
|
|||
|
D_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=8; //<2F><><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void BIN(void) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>BIN
|
|||
|
{
|
|||
|
signed short Ia, Ic;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
PLC_Err=PLC_Addr;
|
|||
|
Ic = cos_value();
|
|||
|
Ia = ((Ic >> 12) & 0x0f) * 1000;
|
|||
|
Ia += ((Ic >> 8 ) & 0x0f) * 100;
|
|||
|
Ia += ((Ic >> 4 ) & 0x0f) * 10;
|
|||
|
Ia += Ic & 0x0f;
|
|||
|
trade=Ia;
|
|||
|
target();
|
|||
|
}
|
|||
|
else PLC_Addr+=4; //<2F><><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void MUL(void) //<2F>˷<EFBFBD>
|
|||
|
{
|
|||
|
signed int temp1,temp2;u32 temp3;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
PLC_Err=PLC_Addr;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
temp3=addr_value_prog();
|
|||
|
PLC_RAM32(temp3)=temp1*temp2;
|
|||
|
}
|
|||
|
else PLC_Addr+=6; //<2F><><EFBFBD><EFBFBD>6<EFBFBD><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
static void DIV(void) //<2F><><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
signed short int temp1,temp2,temp3;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
PLC_Err=PLC_Addr;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
temp3=addr_value();
|
|||
|
PLC_16BIT[temp3]=temp1/temp2;
|
|||
|
PLC_16BIT[temp3+1]=temp1%temp2;
|
|||
|
}
|
|||
|
else PLC_Addr+=6; //<2F><><EFBFBD><EFBFBD>6<EFBFBD><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DADD(void)
|
|||
|
{
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
PLC_Err=PLC_Addr;
|
|||
|
trade=cos_u32_value()+cos_u32_value();
|
|||
|
D_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=12; //<2F><><EFBFBD><EFBFBD>12<31><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DSUB(void)
|
|||
|
{
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
PLC_Err=PLC_Addr;
|
|||
|
trade=cos_u32_value()-cos_u32_value();
|
|||
|
D_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=12; //<2F><><EFBFBD><EFBFBD>12<31><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DMUL(void)
|
|||
|
{
|
|||
|
signed short int temp;
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
u64data.data=(int64_t)(cos_u32_value()*cos_u32_value()); //Щ<><D0A9><EFBFBD><EFBFBD>64λ<34><CEBB>ͬ<EFBFBD><CDAC>
|
|||
|
temp=addr_value(); PLC_Addr+=2;
|
|||
|
PLC_16BIT[temp] = u64data.data1[0]; //<2F><><EFBFBD><EFBFBD>
|
|||
|
PLC_16BIT[temp+1] = u64data.data1[1];
|
|||
|
PLC_16BIT[temp+2] = u64data.data1[2];
|
|||
|
PLC_16BIT[temp+3] = u64data.data1[3];
|
|||
|
}
|
|||
|
else PLC_Addr+=12; //<2F><><EFBFBD><EFBFBD>12<31><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DDIV(void)
|
|||
|
{
|
|||
|
signed short int temp1,temp2,temp3;
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
temp1 = cos_u32_value();
|
|||
|
temp2 = cos_u32_value();
|
|||
|
|
|||
|
u32data.data=temp1/temp2; //<2F><>
|
|||
|
u32data1.data=temp1%temp2; //<2F><><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
temp3=addr_value() ;PLC_Addr+=2;
|
|||
|
PLC_16BIT[temp3] = u32data.data1[0]; //<2F><><EFBFBD><EFBFBD>
|
|||
|
PLC_16BIT[temp3+1]=u32data.data1[1];
|
|||
|
PLC_16BIT[temp3+2]=u32data1.data1[0];
|
|||
|
PLC_16BIT[temp3+3]=u32data1.data1[1];
|
|||
|
}
|
|||
|
else PLC_Addr+=12; //<2F><><EFBFBD><EFBFBD>12<31><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DFLT(void) //<2F><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
signed int temp1;
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
temp1=cos_u32_value();
|
|||
|
trade1=(float)temp1;
|
|||
|
float_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=8; //<2F><><EFBFBD><EFBFBD>8<EFBFBD><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void DESQR(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2014<31><34>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void DINT(void)
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
trade=(u32)float_value();
|
|||
|
D_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=8; //<2F><><EFBFBD><EFBFBD>8<EFBFBD><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void INT(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2014<31><34>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void INT(void)
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
trade=(u16)float_value();
|
|||
|
PLC_Addr-=2;
|
|||
|
target();
|
|||
|
}
|
|||
|
else PLC_Addr+=4; //<2F><><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void FLT(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD> FLT
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2014<31><34>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void FLT(void)
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
trade1=(float)cos_value();
|
|||
|
float_target();PLC_Addr-=2;
|
|||
|
}
|
|||
|
else PLC_Addr+=4; //<2F><><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void DTAN(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DTAN
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2014<31><34>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void DTAN(void)
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
trade1=(float)tan((double)float_value());
|
|||
|
float_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=8; //<2F><><EFBFBD><EFBFBD>8<EFBFBD><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void DCOS(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DCOS
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2014<31><34>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void DCOS(void)
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
trade1=(float)cos((double)float_value());
|
|||
|
float_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=8; //<2F><><EFBFBD><EFBFBD>8<EFBFBD><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void DSIN(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DSIN
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2014<31><34>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void DSIN(void)
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
trade1=(float)sin((double)float_value());
|
|||
|
float_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=8; //<2F><><EFBFBD><EFBFBD>8<EFBFBD><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void DESQR(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>㿪<EFBFBD><E3BFAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DESQR
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2014<31><34>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void DESQR(void)
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
trade1=(float)sqrt((double)float_value());
|
|||
|
float_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=8; //<2F><><EFBFBD><EFBFBD>8<EFBFBD><38><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
//======================================================================================================
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: static void DEADD(void)
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD> ָ<><D6B8>DEADD
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// <20>䡡<EFBFBD><E4A1A1>: void
|
|||
|
// ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>:
|
|||
|
// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>:
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: СС<D0A1><D0A1>
|
|||
|
// <20>ա<EFBFBD><D5A1><EFBFBD>: 2014<31><34>6<EFBFBD><36>27<32><37>
|
|||
|
// <20><> ע:
|
|||
|
//=======================================================================================================
|
|||
|
static void DEADD(void)
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
trade1=float_value()+ float_value();
|
|||
|
float_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=12; //<2F><><EFBFBD><EFBFBD>12<31><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
static void DESUB(void) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
float temp1,temp2;
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
temp1 = float_value();
|
|||
|
temp2 = float_value();
|
|||
|
|
|||
|
trade1=temp1-temp2;
|
|||
|
float_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=12; //<2F><><EFBFBD><EFBFBD>12<31><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
static void DEDIV(void) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
float temp1,temp2;
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
temp1 = float_value();
|
|||
|
temp2 = float_value();
|
|||
|
|
|||
|
trade1=temp1/temp2;
|
|||
|
float_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=12; //<2F><><EFBFBD><EFBFBD>12<31><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void DEMUL(void) //<2F><><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
{
|
|||
|
trade1=float_value()*float_value();
|
|||
|
float_target();
|
|||
|
}
|
|||
|
else PLC_Addr+=12; //<2F><><EFBFBD><EFBFBD>12<31><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
u16 DE[16]={0x0001,0x0003,0x0007,0x000F,0X001F,0X003F,0X007F,0X00FF,0X01FF,0X03FF,0X07FF,0X0FFF,0X1FFF,0X3FFF,0X7FFF,0XFFFF};
|
|||
|
void DECO()
|
|||
|
{
|
|||
|
u8 i,t=1;
|
|||
|
int temp1=cos_value(); //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
int temp2=addr_value();
|
|||
|
int n=cos_value(); //<2F><><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
temp1&=DE[n-1]; //<2F><><EFBFBD><EFBFBD>
|
|||
|
for(i=0;i<n;i++) //<2F><><EFBFBD><EFBFBD>2<EFBFBD><32>n<EFBFBD>η<EFBFBD>
|
|||
|
{t*=2;}
|
|||
|
// if()
|
|||
|
PLC_16BIT[temp2]=1<<(temp1-1);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void PLSY(void)
|
|||
|
{
|
|||
|
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
|
|||
|
GPIO_InitTypeDef GPIO_InitStructure;
|
|||
|
static u8 addr;
|
|||
|
long sys;
|
|||
|
signed short temp,PUS_TOTAL=0;
|
|||
|
if(PLC_ACC_BIT&0X01) //<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
temp=cos_value(); //<2F><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>
|
|||
|
PUS_TOTAL=cos_value(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
addr=*PLC_Addr; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|||
|
PLC_Addr+=2;
|
|||
|
if(PLC_16BIT[0x078C] >= PUS_TOTAL)PLC_BIT_ON(M8029);
|
|||
|
|
|||
|
if((addr==0x00)&&(!(PLC_BIT_TEST(M8145)))&&(Y0P==0)) //Y0
|
|||
|
{
|
|||
|
PLC_BIT_ON(0x500); //Y00 ON
|
|||
|
PLC_BIT_OFF(M8029); //M8029
|
|||
|
// PLC_RAM32(0X20005F1C)=0; //D8140
|
|||
|
Y0P=1;
|
|||
|
Plus_CMP0=PUS_TOTAL;
|
|||
|
sys=72000000/((71+1)*(temp*2))-1;
|
|||
|
//IO<49>ڳ<EFBFBD>ʼ<EFBFBD><CABC>
|
|||
|
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; //A7
|
|||
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
|||
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
|
|||
|
GPIO_Init(GPIOC, &GPIO_InitStructure);
|
|||
|
|
|||
|
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3 , ENABLE);
|
|||
|
TIM_DeInit(TIM3);
|
|||
|
TIM_TimeBaseStructure.TIM_Period=sys; // <20>Զ<EFBFBD><D4B6><EFBFBD>װ<EFBFBD>ؼĴ<D8BC><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>ֵ(<28><><EFBFBD><EFBFBD>ֵ)
|
|||
|
// <20>ۼ<EFBFBD> TIM_Period<6F><64>Ƶ<EFBFBD>ʺ<EFBFBD><CABA><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>»<EFBFBD><C2BB><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
TIM_TimeBaseStructure.TIM_Prescaler= (72 - 1); // ʱ<><CAB1>Ԥ<EFBFBD><D4A4>Ƶ<EFBFBD><C6B5> 72M/72
|
|||
|
TIM_TimeBaseStructure.TIM_ClockDivision=TIM_CKD_DIV1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ
|
|||
|
TIM_TimeBaseStructure.TIM_CounterMode=TIM_CounterMode_Up; // <20><><EFBFBD>ϼ<EFBFBD><CFBC><EFBFBD>ģʽ
|
|||
|
TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure);
|
|||
|
TIM_ClearFlag(TIM3, TIM_FLAG_Update); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϱ<D0B6>־
|
|||
|
TIM_ITConfig(TIM3,TIM_IT_Update,ENABLE);
|
|||
|
TIM_Cmd(TIM3, ENABLE); // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3 , ENABLE); // <20>ȹرյȴ<D5B5>ʹ<EFBFBD><CAB9>
|
|||
|
PLC_BIT_ON(M8147); // M8147
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_Addr+=4;
|
|||
|
addr=*PLC_Addr; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|||
|
PLC_Addr+=2;
|
|||
|
if(addr==0x00) //Y0
|
|||
|
{
|
|||
|
if(Y0P==1)
|
|||
|
{
|
|||
|
TIM_Cmd(TIM5, DISABLE);
|
|||
|
TIM_Cmd(TIM3, DISABLE);
|
|||
|
TIM_ClearFlag(TIM3, TIM_FLAG_Update);
|
|||
|
TIM_ITConfig(TIM3, TIM_IT_Update, DISABLE);
|
|||
|
|
|||
|
// GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; //A2
|
|||
|
// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
|
|||
|
// GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
|||
|
// GPIO_Init(GPIOC, &GPIO_InitStructure);
|
|||
|
Y0P=0;
|
|||
|
PLC_BIT_OFF(0x500); //Y00 OFF
|
|||
|
PLC_BIT_OFF(M8147); //M8147
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// static void PWM(void) //ADD 20160619
|
|||
|
// {
|
|||
|
// u16 temp1,temp2;
|
|||
|
// if((PLC_ACC_BIT&0X01)==0X01)
|
|||
|
// {
|
|||
|
// temp1=2000000/cos_value();
|
|||
|
// temp2=2000000/cos_value();
|
|||
|
// TIM3->ARR = temp2-1;
|
|||
|
// switch(Y_addr())
|
|||
|
// {
|
|||
|
// case 0x051c: TIM3->CCR1 = temp1-1;PLC_BIT_ON(0X00c0,28);TIM3->CCER=TIM_OutputState_Enable; break; //PWM Y34
|
|||
|
// case 0x051d: TIM3->CCR2 = temp1-1;PLC_BIT_ON(0X00c0,29);TIM_OC2PreloadConfig(TIM3,TIM_OCPreload_Enable); break; //PWM Y35
|
|||
|
// case 0x051e: TIM3->CCR3 = temp1-1;PLC_BIT_ON(0X00c0,30);TIM_OC3PreloadConfig(TIM3,TIM_OCPreload_Enable); break; //PWM Y36
|
|||
|
// case 0x051f: TIM3->CCR4 = temp1-1;PLC_BIT_ON(0X00c0,31);TIM_OC4PreloadConfig(TIM3,TIM_OCPreload_Enable); break; //PWM Y37
|
|||
|
// }
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// PLC_Addr+=4; //<2F><><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>СCPU<50><55><EFBFBD><EFBFBD>
|
|||
|
// switch(Y_addr())
|
|||
|
// {
|
|||
|
// case 0x051c: PLC_BIT_OFF(0X00c0,28); break; //PWM Y34
|
|||
|
// case 0x051d: PLC_BIT_OFF(0X00c0,29); break; //PWM Y35
|
|||
|
// case 0x051e: PLC_BIT_OFF(0X00c0,30); break; //PWM Y36
|
|||
|
// case 0x051f: PLC_BIT_OFF(0X00c0,31); break; //PWM Y37
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
|
|||
|
// void PLSY(void)
|
|||
|
// {
|
|||
|
// TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
|
|||
|
// TIM_OCInitTypeDef TIM_OCInitStructure;
|
|||
|
// GPIO_InitTypeDef GPIO_InitStructure;
|
|||
|
// long div_c;
|
|||
|
// signed short temp,PUS_TOTAL=0;
|
|||
|
// static u8 Y0P,Y1P,addr;;
|
|||
|
// if(PLC_ACC_BIT&0X01) //<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// {
|
|||
|
// temp=cos_value(); //<2F><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>
|
|||
|
// PUS_TOTAL=cos_value(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// addr=*PLC_Addr; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|||
|
// PLC_Addr+=2;
|
|||
|
// if((addr==0x00)&&(PLC_BIT_TEST(0x00E0,145))&&(Y0P==0)) //Y0
|
|||
|
// {
|
|||
|
// PLC_BIT_ON(0XC0,0); //Y00 ON
|
|||
|
// PLC_BIT_OFF(0X00E0,29); //M8029
|
|||
|
// PLC_RAM32(0X20005E90)=0; //D8140
|
|||
|
// Y0P=1;
|
|||
|
//
|
|||
|
// div_c=75497472/temp;
|
|||
|
// div_c=div_c/65536;
|
|||
|
// temp=75497472/(temp*(div_c+1));
|
|||
|
// temp--;
|
|||
|
|
|||
|
// //ֻ<><D6BB>ʼ<EFBFBD><CABC>һ<EFBFBD><D2BB> Y0
|
|||
|
// TIM_DeInit(TIM5);
|
|||
|
// //TIM5 clock enable PWM MODE
|
|||
|
// RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM5, ENABLE);
|
|||
|
// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
|
|||
|
// GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
|||
|
// GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
|
|||
|
// GPIO_Init(GPIOA, &GPIO_InitStructure);
|
|||
|
|
|||
|
// TIM_TimeBaseStructure.TIM_Period = div_c;
|
|||
|
// TIM_TimeBaseStructure.TIM_Prescaler = temp;
|
|||
|
// TIM_TimeBaseStructure.TIM_ClockDivision = 0;
|
|||
|
// TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Down;
|
|||
|
|
|||
|
// TIM_TimeBaseInit(TIM5, &TIM_TimeBaseStructure);
|
|||
|
|
|||
|
// // PWM1 Mode configuration: Channel3
|
|||
|
// TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
|
|||
|
// TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
|
|||
|
// TIM_OCInitStructure.TIM_Pulse = temp/2;
|
|||
|
// TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
|
|||
|
|
|||
|
// TIM_OC3Init(TIM5, &TIM_OCInitStructure);
|
|||
|
|
|||
|
// TIM_OC3PreloadConfig(TIM5, TIM_OCPreload_Enable);
|
|||
|
// PLC_16BIT[0x732]=PUS_TOTAL; pus_cnt0=0; pus0=PUS_TOTAL;
|
|||
|
// // TIM3 clock source enable ETR MODE
|
|||
|
// if(PUS_TOTAL>0)
|
|||
|
// {
|
|||
|
// if(PUS_TOTAL>1)
|
|||
|
// {
|
|||
|
// RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);
|
|||
|
// TIM_TimeBaseStructure.TIM_Period = PUS_TOTAL-1;
|
|||
|
// TIM_TimeBaseStructure.TIM_Prescaler = 0x00;
|
|||
|
// TIM_TimeBaseStructure.TIM_ClockDivision = 0x0;
|
|||
|
// TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
|
|||
|
// TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); // Time base configuration
|
|||
|
|
|||
|
// TIM_ETRClockMode2Config(TIM3, TIM_ExtTRGPSC_OFF, TIM_ExtTRGPolarity_NonInverted, 0);
|
|||
|
|
|||
|
// TIM_SetCounter(TIM3, 0);
|
|||
|
// TIM_ClearFlag(TIM3, TIM_FLAG_Update);
|
|||
|
// TIM_ITConfig(TIM3, TIM_IT_Update, ENABLE);
|
|||
|
// TIM_Cmd(TIM3, ENABLE);
|
|||
|
// }
|
|||
|
// else
|
|||
|
// TIM_ITConfig(TIM5, TIM_IT_CC2, ENABLE);//<2F><><EFBFBD><EFBFBD><EFBFBD>жϣ<D0B6><CFA3>ж<EFBFBD><D0B6><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>д<EFBFBD><D0B4><EFBFBD>
|
|||
|
// }
|
|||
|
// // TIM5 enable counter
|
|||
|
// TIM_Cmd(TIM5, ENABLE);
|
|||
|
// PLC_BIT_ON(0X00E0,147); //M8147
|
|||
|
// }
|
|||
|
// if((addr==0x01)&&(PLC_BIT_TEST(0x00E0,146))) //Y1
|
|||
|
// {
|
|||
|
// PLC_BIT_ON(0XC0,1); //Y01 ON
|
|||
|
// PLC_BIT_OFF(0X00E0,29); //M8029
|
|||
|
// PLC_RAM32(0X20005E92)=0; //D8140
|
|||
|
// Y1P=1;
|
|||
|
// div_c=75497472/temp;
|
|||
|
// div_c=div_c/65536;
|
|||
|
// temp=75497472/(temp*(div_c+1));
|
|||
|
// temp--;
|
|||
|
// TIM_DeInit(TIM8);
|
|||
|
// //PWM MODE
|
|||
|
// RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM8, ENABLE);
|
|||
|
// GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
|
|||
|
// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
|
|||
|
// GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
|||
|
// GPIO_Init(GPIOC, &GPIO_InitStructure);
|
|||
|
//
|
|||
|
// TIM_TimeBaseStructure.TIM_Prescaler = div_c;
|
|||
|
// TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Down;
|
|||
|
// TIM_TimeBaseStructure.TIM_Period = temp;
|
|||
|
// PLC_16BIT[0x734]=PUS_TOTAL;
|
|||
|
// TIM_TimeBaseStructure.TIM_ClockDivision = 0;
|
|||
|
// TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;
|
|||
|
|
|||
|
// TIM_TimeBaseInit(TIM8, &TIM_TimeBaseStructure);
|
|||
|
// temp=(temp+1)/2;
|
|||
|
// // Channel 1, 2,3 and 4 Configuration in PWM mode
|
|||
|
// TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM2;
|
|||
|
// TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
|
|||
|
// TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable;
|
|||
|
// TIM_OCInitStructure.TIM_Pulse =temp;
|
|||
|
// TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low;
|
|||
|
// TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_Low;
|
|||
|
// TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Set;
|
|||
|
// TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCIdleState_Reset;
|
|||
|
|
|||
|
// TIM_OC3Init(TIM8, &TIM_OCInitStructure);
|
|||
|
// //TIM1 Main Output Enable
|
|||
|
// TIM_CtrlPWMOutputs(TIM8, ENABLE);
|
|||
|
// PLC_16BIT[0x734]=PUS_TOTAL; pus_cnt1=0;pus1=PUS_TOTAL;
|
|||
|
|
|||
|
// if(PUS_TOTAL>0)
|
|||
|
// {
|
|||
|
// // TIM4 clock source enable ETR MODE
|
|||
|
// if(PUS_TOTAL>1)
|
|||
|
// {
|
|||
|
// RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE);
|
|||
|
// TIM_TimeBaseStructure.TIM_Period = PUS_TOTAL-1;
|
|||
|
// TIM_TimeBaseStructure.TIM_Prescaler = 0x00;
|
|||
|
// TIM_TimeBaseStructure.TIM_ClockDivision = 0x0;
|
|||
|
// TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
|
|||
|
// TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStructure); // Time base configuration
|
|||
|
|
|||
|
// TIM_ETRClockMode2Config(TIM4, TIM_ExtTRGPSC_OFF, TIM_ExtTRGPolarity_NonInverted, 0);
|
|||
|
|
|||
|
// TIM_SetCounter(TIM4, 0);
|
|||
|
// TIM_ClearFlag(TIM4, TIM_FLAG_Update);
|
|||
|
// TIM_ITConfig(TIM4, TIM_IT_Update, ENABLE);
|
|||
|
|
|||
|
// TIM_Cmd(TIM4, ENABLE);
|
|||
|
// }
|
|||
|
// else
|
|||
|
// TIM8->DIER = 0x02; // ʹ<><CAB9> CC1 <20>ж<EFBFBD>
|
|||
|
// }
|
|||
|
// // TIM1 counter enable
|
|||
|
// TIM_Cmd(TIM8, ENABLE);
|
|||
|
// PLC_BIT_ON(0X00E0,148); //M8148
|
|||
|
// }
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// PLC_Addr+=4;
|
|||
|
// addr=*PLC_Addr; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|||
|
// PLC_Addr+=2;
|
|||
|
// if(addr==0x00) //Y0
|
|||
|
// {
|
|||
|
// if(Y0P==1)
|
|||
|
// {
|
|||
|
// TIM_Cmd(TIM5, DISABLE);
|
|||
|
// TIM_Cmd(TIM3, DISABLE);
|
|||
|
// TIM_ClearFlag(TIM3, TIM_FLAG_Update);
|
|||
|
// TIM_ITConfig(TIM3, TIM_IT_Update, DISABLE);
|
|||
|
//
|
|||
|
// GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
|
|||
|
// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
|
|||
|
// GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
|||
|
// GPIO_Init(GPIOA, &GPIO_InitStructure);
|
|||
|
// // rsty(0);
|
|||
|
// Y0P=0;
|
|||
|
// PLC_BIT_OFF(0x00C0,0); //Y00 OFF
|
|||
|
// PLC_BIT_OFF(0X00E0,147); //M8147
|
|||
|
// }
|
|||
|
// }
|
|||
|
// if(addr==0x01) //Y0
|
|||
|
// {
|
|||
|
// if(Y1P==1)
|
|||
|
// {
|
|||
|
// TIM_Cmd(TIM8, DISABLE);
|
|||
|
// TIM_Cmd(TIM4, DISABLE);
|
|||
|
// TIM_ClearFlag(TIM4, TIM_FLAG_Update);
|
|||
|
// TIM_ITConfig(TIM4, TIM_IT_Update, DISABLE);
|
|||
|
//
|
|||
|
// GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
|
|||
|
// GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
|
|||
|
// GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
|||
|
// GPIO_Init(GPIOC, &GPIO_InitStructure);
|
|||
|
//
|
|||
|
// // rsty(1);
|
|||
|
// Y1P=0;
|
|||
|
// PLC_BIT_OFF(0x00C0,1); //Y01 OFF
|
|||
|
// PLC_BIT_OFF(0X00E0,148); //M8148
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
static void Damount(void) //32λ<32><CEBB><EFBFBD>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if(PLC_STL_Status == 1) //ΪSTL״̬<D7B4><CCAC>
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if((temp1==temp2)&&(PLC_BIT_TEST(PLC_STL_Addr)))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(temp1==temp2) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
static void amount(void) //16λ<36><CEBB><EFBFBD>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if(PLC_STL_Status == 1) //ΪSTL״̬<D7B4><CCAC>
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if((temp1==temp2)&&(PLC_BIT_TEST(PLC_STL_Addr)))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(temp1==temp2) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void amount_OR()
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if((temp1==temp2)||(PLC_ACC_BIT&0X01)) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0xFE;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
static void Damount_OR()
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if((temp1==temp2)||(PLC_ACC_BIT&0X01)) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0xFE;
|
|||
|
}
|
|||
|
|
|||
|
static void Damount_and(void) //32λAND<4E><44><EFBFBD>ڱȽ<DAB1>
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if((temp1==temp2)&&((PLC_ACC_BIT&0X01)==0X01))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=~1;
|
|||
|
}
|
|||
|
|
|||
|
static void amount_and(void) //16λAND<4E><44><EFBFBD>ڱȽ<DAB1>
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if((temp1==temp2)&&((PLC_ACC_BIT&0X01)==0X01))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=~1;
|
|||
|
}
|
|||
|
|
|||
|
static void Dbig(void) //32λ<32><CEBB><EFBFBD>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if(PLC_STL_Status == 1) //ΪSTL״̬<D7B4><CCAC>
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if((temp1>temp2)&&(PLC_BIT_TEST(PLC_STL_Addr)))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(temp1>temp2) //<2F><>ǰֵ<C7B0>ж<EFBFBD> <20>·<EFBFBD><C2B7><EFBFBD>"<"<22>ij<EFBFBD><C4B3><EFBFBD>">"
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void big(void) //16λ<36><CEBB><EFBFBD>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if(PLC_STL_Status == 1) //ΪSTL״̬<D7B4><CCAC>
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if((temp1>temp2)&&(PLC_BIT_TEST(PLC_STL_Addr)))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(temp1>temp2) //<2F><>ǰֵ<C7B0>ж<EFBFBD> <20>·<EFBFBD><C2B7><EFBFBD>"<"<22>ij<EFBFBD><C4B3><EFBFBD>">"
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void big_OR()
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if((temp1>temp2)||(PLC_ACC_BIT&0X01))
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0xFE;
|
|||
|
}
|
|||
|
|
|||
|
static void Dbig_OR()
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if((temp1>=temp2)||(PLC_ACC_BIT&0X01))
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0xFE;
|
|||
|
}
|
|||
|
|
|||
|
static void Dbig_and(void) //32λAND<4E><44><EFBFBD>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if((temp1>temp2)&&((PLC_ACC_BIT&0X01)==0X01))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=~1;
|
|||
|
}
|
|||
|
|
|||
|
static void big_and(void) //16λAND<4E><44><EFBFBD>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if((temp1>temp2)&&((PLC_ACC_BIT&0X01)==0X01))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=~1;
|
|||
|
}
|
|||
|
|
|||
|
static void Dless(void) //32λС<CEBB>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if(PLC_STL_Status == 1) //ΪSTL״̬<D7B4><CCAC>
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if((temp1<temp2)&&(PLC_BIT_TEST(PLC_STL_Addr)))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(temp1<temp2) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void less(void) //С<>ڱȽ<DAB1>
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if(PLC_STL_Status == 1) //ΪSTL״̬<D7B4><CCAC>
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if((temp1<temp2)&&(PLC_BIT_TEST(PLC_STL_Addr)))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(temp1<temp2) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void less_OR()
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if((temp1<temp2)||(PLC_ACC_BIT&0X01))
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0xFE;
|
|||
|
}
|
|||
|
|
|||
|
static void Dless_OR()
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if((temp1<temp2)||(PLC_ACC_BIT&0X01))
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0xFE;
|
|||
|
}
|
|||
|
|
|||
|
static void Dless_and(void) //32λANDС<44>ڱȽ<DAB1>
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if((temp1<temp2)&&((PLC_ACC_BIT&0X01)==0X01))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=~1;
|
|||
|
}
|
|||
|
|
|||
|
static void less_and(void) //16λANDС<44>ڱȽ<DAB1>
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if((temp1<temp2)&&((PLC_ACC_BIT&0X01)==0X01))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=~1;
|
|||
|
}
|
|||
|
|
|||
|
static void Dless_amount(void) //32λС<CEBB>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if(PLC_STL_Status == 1) //ΪSTL״̬<D7B4><CCAC>
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if((temp1<=temp2)&&(PLC_BIT_TEST(PLC_STL_Addr)))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(temp1<=temp2) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void less_amount(void) //16λС<CEBB>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if(PLC_STL_Status == 1) //ΪSTL״̬<D7B4><CCAC>
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if((temp1<=temp2)&&(PLC_BIT_TEST(PLC_STL_Addr)))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(temp1<=temp2) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void less_amount_OR()
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if((temp1<=temp2)||(PLC_ACC_BIT&0X01))
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0xFE;
|
|||
|
}
|
|||
|
|
|||
|
static void Dless_amount_OR()
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if((temp1<=temp2)||(PLC_ACC_BIT&0X01))
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0xFE;
|
|||
|
}
|
|||
|
|
|||
|
static void Dless_amount_and(void) //32λANDС<44>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if((temp1<=temp2)&&((PLC_ACC_BIT&0X01)==0X01))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=~1;
|
|||
|
}
|
|||
|
|
|||
|
static void less_amount_and(void) //16λANDС<44>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if((temp1<=temp2)&&(PLC_ACC_BIT&0X01))
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0XFE;
|
|||
|
}
|
|||
|
|
|||
|
static void Dbig_amount(void) //32λ<32><CEBB><EFBFBD>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if(PLC_STL_Status == 1) //ΪSTL״̬<D7B4><CCAC>
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if((temp1>=temp2)&&(PLC_BIT_TEST(PLC_STL_Addr)))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(temp1>=temp2) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void big_amount(void) //16λ<36><CEBB><EFBFBD>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if(PLC_STL_Status == 1) //ΪSTL״̬<D7B4><CCAC>
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if((temp1>=temp2)&&(PLC_BIT_TEST(PLC_STL_Addr)))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(temp1>=temp2) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void big_amount_OR()
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if((temp1>=temp2)||(PLC_ACC_BIT&0X01))
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0xFE;
|
|||
|
}
|
|||
|
|
|||
|
static void Dbig_amount_OR()
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if((temp1>=temp2)||(PLC_ACC_BIT&0X01))
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0xFE;
|
|||
|
}
|
|||
|
|
|||
|
static void Dbig_amount_and(void) //32λAND<4E><44><EFBFBD>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if((temp1>=temp2)&&((PLC_ACC_BIT&0X01)==0X01))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=~1;
|
|||
|
}
|
|||
|
|
|||
|
static void big_amount_and(void) //16λAND<4E><44><EFBFBD>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if((temp1>=temp2)&&(PLC_ACC_BIT&0X01))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=~1;
|
|||
|
}
|
|||
|
|
|||
|
static void Dno_amount(void) //32λ<32><CEBB><EFBFBD><EFBFBD><EFBFBD>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if(PLC_STL_Status == 1) //ΪSTL״̬<D7B4><CCAC>
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if((temp1!=temp2)&&(PLC_BIT_TEST(PLC_STL_Addr)))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(temp1!=temp2) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void no_amount(void) //16λ<36><CEBB><EFBFBD><EFBFBD><EFBFBD>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if(PLC_STL_Status == 1) //ΪSTL״̬<D7B4><CCAC>
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if((temp1!=temp2)&&(PLC_BIT_TEST(PLC_STL_Addr)))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(temp1!=temp2) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void no_amount_OR()
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if((temp1!=temp2)||(PLC_ACC_BIT&0X01))
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0xFE;
|
|||
|
}
|
|||
|
|
|||
|
static void Dno_amount_OR()
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if((temp1!=temp2)||(PLC_ACC_BIT&0X01))
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0xFE;
|
|||
|
}
|
|||
|
|
|||
|
static void Dno_amount_and(void) //32λAND<4E><44><EFBFBD><EFBFBD><EFBFBD>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
s32 temp1,temp2;
|
|||
|
temp1=cos_u32_value();
|
|||
|
temp2=cos_u32_value();
|
|||
|
if((temp1!=temp2)&&((PLC_ACC_BIT&0X01)==0X01))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=~1;
|
|||
|
}
|
|||
|
|
|||
|
static void no_amount_and(void) //16λAND<4E><44><EFBFBD><EFBFBD><EFBFBD>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
signed short int temp1,temp2;
|
|||
|
temp1=cos_value();
|
|||
|
temp2=cos_value();
|
|||
|
if((temp1!=temp2)&&((PLC_ACC_BIT&0X01)==0X01))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=~1;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
static void LDP(void) //LDP
|
|||
|
{
|
|||
|
if(PLC_PL_BIT_TEST(PLC_Addr-PLC_START_Address))
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(!(PLC_LD_BIT(0X2fff&*PLC_Addr))) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_PL_BIT_OFF(PLC_Addr-PLC_START_Address);
|
|||
|
}
|
|||
|
else //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
{
|
|||
|
if(PLC_STL_Status == 1) //ΪSTL״̬<D7B4><CCAC>
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if((PLC_LD_BIT(0X2fff&*PLC_Addr))&&(PLC_BIT_TEST(PLC_STL_Addr))) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_ACC_BIT|=0x01,PLC_PL_BIT_ON(PLC_Addr-PLC_START_Address); //
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(PLC_LD_BIT(0X2fff&*PLC_Addr)) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_ACC_BIT|=0x01,PLC_PL_BIT_ON(PLC_Addr-PLC_START_Address); //
|
|||
|
}
|
|||
|
}
|
|||
|
PLC_Addr++;
|
|||
|
}
|
|||
|
|
|||
|
static void LDF(void) //LDF
|
|||
|
{
|
|||
|
if(PLC_PL_BIT_TEST(PLC_Addr-PLC_START_Address)) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
{
|
|||
|
if(PLC_STL_Status == 1) //ΪSTL״̬<D7B4><CCAC>
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if((!(PLC_LD_BIT(0X2fff&*PLC_Addr)))&&(PLC_BIT_TEST(PLC_STL_Addr)))//<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_ACC_BIT|=0x01,PLC_PL_BIT_ON(PLC_Addr-PLC_START_Address);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1;
|
|||
|
if(!(PLC_LD_BIT(0X2fff&*PLC_Addr))) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_ACC_BIT|=1,PLC_PL_BIT_OFF(PLC_Addr-PLC_START_Address);//
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_ACC_BIT<<=1,PLC_ACC_BIT&=0XFE; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD>
|
|||
|
if(PLC_LD_BIT(0X2fff&*PLC_Addr)) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_PL_BIT_ON(PLC_Addr-PLC_START_Address);//
|
|||
|
}
|
|||
|
PLC_Addr++;
|
|||
|
}
|
|||
|
|
|||
|
static void ANDP(void) //ANDP
|
|||
|
{
|
|||
|
u8 logic;
|
|||
|
if(PLC_PL_BIT_TEST(PLC_Addr-PLC_START_Address)) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>Ŷ<EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>ֵ
|
|||
|
{
|
|||
|
logic=0;
|
|||
|
if(!(PLC_LD_BIT(0X2fff&*PLC_Addr))) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_PL_BIT_OFF(PLC_Addr-PLC_START_Address); //
|
|||
|
}
|
|||
|
else //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
{
|
|||
|
if(PLC_LD_BIT(0X2fff&*PLC_Addr)) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
logic=1,PLC_PL_BIT_ON(PLC_Addr-PLC_START_Address); //<2F><><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><D8B3><EFBFBD>
|
|||
|
else
|
|||
|
logic=0; //<2F><><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><D8B2><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
if((PLC_ACC_BIT&0x01)&&(logic==1))
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0XFE;
|
|||
|
PLC_Addr++;
|
|||
|
}
|
|||
|
|
|||
|
static void ANDF(void) //ANDF
|
|||
|
{
|
|||
|
u8 logic;
|
|||
|
if(PLC_PL_BIT_TEST(PLC_Addr-PLC_START_Address)) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
{
|
|||
|
if(!(PLC_LD_BIT(0X2fff&*PLC_Addr))) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
logic=1,PLC_PL_BIT_OFF(PLC_Addr-PLC_START_Address); //
|
|||
|
else
|
|||
|
logic=0; //
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
logic=0;
|
|||
|
if(PLC_LD_BIT(0X2fff&*PLC_Addr)) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_PL_BIT_ON(PLC_Addr-PLC_START_Address); //
|
|||
|
}
|
|||
|
if((PLC_ACC_BIT&0x01)&&(logic==1))
|
|||
|
PLC_ACC_BIT|=0X01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0XFE;
|
|||
|
PLC_Addr++;
|
|||
|
}
|
|||
|
|
|||
|
static void ORP(void) //ORP
|
|||
|
{
|
|||
|
u8 logic;
|
|||
|
if(PLC_PL_BIT_TEST(PLC_Addr-PLC_START_Address))
|
|||
|
{
|
|||
|
logic=0; //
|
|||
|
if(!(PLC_LD_BIT(0X2fff&*PLC_Addr))) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_PL_BIT_OFF(PLC_Addr-PLC_START_Address); //
|
|||
|
}
|
|||
|
else //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
{
|
|||
|
if(PLC_LD_BIT(0X2fff&*PLC_Addr)) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
logic=1,PLC_PL_BIT_ON(PLC_Addr-PLC_START_Address); //
|
|||
|
else
|
|||
|
logic=0; //
|
|||
|
}
|
|||
|
|
|||
|
if(((PLC_ACC_BIT&0x01)==0x01)||(logic==1))
|
|||
|
PLC_ACC_BIT|=0x01;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=0XFE;
|
|||
|
PLC_Addr++;
|
|||
|
}
|
|||
|
|
|||
|
static void ORF(void) //ORF
|
|||
|
{
|
|||
|
u8 logic;
|
|||
|
if(PLC_PL_BIT_TEST(PLC_Addr-PLC_START_Address)) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
{
|
|||
|
if(!(PLC_LD_BIT(0X2fff&*PLC_Addr))) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
logic=1,PLC_PL_BIT_OFF(PLC_Addr-PLC_START_Address);//
|
|||
|
else
|
|||
|
logic=0; //
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
logic=0;
|
|||
|
if(PLC_LD_BIT(0X2fff&*PLC_Addr)) //<2F><>ǰֵ<C7B0>ж<EFBFBD>
|
|||
|
PLC_PL_BIT_ON(PLC_Addr-PLC_START_Address); //
|
|||
|
}
|
|||
|
if(((PLC_ACC_BIT&0x01)==0x01)||(logic==1))
|
|||
|
PLC_ACC_BIT|=1;
|
|||
|
else
|
|||
|
PLC_ACC_BIT&=~1;
|
|||
|
PLC_Addr++;
|
|||
|
}
|
|||
|
|
|||
|
static void CJ_EX(u8 value) //ִ<><D6B4><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
PLC_Addr++;
|
|||
|
if((*PLC_Addr&0xff00)==0x8000)
|
|||
|
{PLC_Addr=PLC_P_Addr[value/2],PLC_Addr++;}//ȡ<><C8A1>λ
|
|||
|
}
|
|||
|
|
|||
|
static void CJ(void)
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
if((*PLC_Addr&0xff00)==0x8800) CJ_EX(*PLC_Addr);
|
|||
|
}
|
|||
|
else PLC_Addr+=2;
|
|||
|
}
|
|||
|
|
|||
|
static void CJP(void) //CJP
|
|||
|
{
|
|||
|
if(PLC_LDP_TEST()) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
{if((*PLC_Addr&0xff00)==0x8800) CJ_EX(*PLC_Addr);}
|
|||
|
else
|
|||
|
PLC_Addr+=2; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>СCPU<50><55><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
static void SRET(void)
|
|||
|
{
|
|||
|
u8 temp;
|
|||
|
PLC_ACC_BIT=process[0]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>״ֵ̬
|
|||
|
PLC_Addr=p_save[0]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD>ǰ<EFBFBD><C7B0>ִ<EFBFBD>е<EFBFBD>ַ
|
|||
|
for(temp=62;temp>0;temp--)
|
|||
|
{
|
|||
|
process[temp]=process[temp+1]; //data mov down
|
|||
|
p_save[temp]=p_save[temp+1];
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
static void P_MOV(void)
|
|||
|
{
|
|||
|
u8 temp;
|
|||
|
for(temp=62;temp>0;temp--)
|
|||
|
{
|
|||
|
process[temp+1]=process[temp]; //<2F><><EFBFBD><EFBFBD> MOV up
|
|||
|
p_save[temp+1]=p_save[temp];
|
|||
|
}
|
|||
|
process[0]=PLC_ACC_BIT; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>״ֵ̬
|
|||
|
p_save[0]=PLC_Addr; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD>ǰ<EFBFBD><C7B0>ִ<EFBFBD>е<EFBFBD>ַ
|
|||
|
}
|
|||
|
|
|||
|
static void CALL_EX(u8 value)
|
|||
|
{
|
|||
|
PLC_Addr++;
|
|||
|
if((*PLC_Addr&0xff00)==0x8000)
|
|||
|
{P_MOV(),PLC_Addr=PLC_P_Addr[value/2];}// <09><>ѹ<EFBFBD><D1B9>״̬<D7B4>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD>ǰһ<C7B0><D2BB>Pָ<50><D6B8><EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><D6B7>
|
|||
|
}
|
|||
|
|
|||
|
static void CALL(void)
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01)
|
|||
|
{
|
|||
|
if((*PLC_Addr&0xff00)==0x8800)
|
|||
|
{CALL_EX(*PLC_Addr);}
|
|||
|
}
|
|||
|
else PLC_Addr+=2;
|
|||
|
}
|
|||
|
|
|||
|
static void CALLP(void) //CALLP
|
|||
|
{
|
|||
|
if(PLC_LDP_TEST()) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
{if((*PLC_Addr&0xff00)==0x8800)CALL_EX(*PLC_Addr);}
|
|||
|
else
|
|||
|
PLC_Addr+=2; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>СCPU<50><55><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void expand_SET(void)
|
|||
|
{
|
|||
|
BIT_SET(0X2FFF&*PLC_Addr);PLC_Addr++;
|
|||
|
}
|
|||
|
|
|||
|
void expand_RST(void)
|
|||
|
{
|
|||
|
RST(0X2FFF&*PLC_Addr);PLC_Addr++;
|
|||
|
}
|
|||
|
|
|||
|
void expand_OUT(void)
|
|||
|
{
|
|||
|
OUT(0X2FFF&*PLC_Addr);PLC_Addr++;
|
|||
|
}
|
|||
|
|
|||
|
void expand_LD(void)
|
|||
|
{
|
|||
|
LD(0X2FFF&*PLC_Addr);PLC_Addr++;
|
|||
|
}
|
|||
|
|
|||
|
void expand_LDI(void)
|
|||
|
{
|
|||
|
LDI(0x2FFF&*PLC_Addr);PLC_Addr++;
|
|||
|
}
|
|||
|
|
|||
|
void expand_AND(void)
|
|||
|
{
|
|||
|
AND(0x2FFF&*PLC_Addr);PLC_Addr++;
|
|||
|
}
|
|||
|
|
|||
|
void expand_ANI(void)
|
|||
|
{
|
|||
|
ANI(0x2FFF&*PLC_Addr);PLC_Addr++;
|
|||
|
}
|
|||
|
|
|||
|
void expand_OR(void)
|
|||
|
{
|
|||
|
OR(0x2FFF&*PLC_Addr);PLC_Addr++;
|
|||
|
}
|
|||
|
|
|||
|
void expand_ORI(void)
|
|||
|
{
|
|||
|
ORI(0x2FFF&*PLC_Addr);PLC_Addr++;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
static void enable_T_K(void)
|
|||
|
{
|
|||
|
static u16 *p_data;
|
|||
|
T_value=*PLC_Addr%0x100; //<2F><><EFBFBD><EFBFBD>8λֵ
|
|||
|
PLC_Addr++;
|
|||
|
T_value+=(*PLC_Addr%0x100)*0x100; //<2F><><EFBFBD><EFBFBD>8λֵ
|
|||
|
p_data=PLC_16BIT+0x0900+T_number; //ָ<><D6B8>ָ<EFBFBD><D6B8>T<EFBFBD>Ƚϵ<C8BD>ֵ<EFBFBD><D6B5>ַ
|
|||
|
*p_data=T_value; //<2F><>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>ַ
|
|||
|
timer_enable(T_number);
|
|||
|
OUT(0X1600+(u8)T_number);
|
|||
|
}
|
|||
|
|
|||
|
static void enable_T_D(void)
|
|||
|
{
|
|||
|
PLC_16BIT[0x0900+T_number]=PLC_16BIT[0x1000+T_value];
|
|||
|
timer_enable(T_number);
|
|||
|
OUT(0X1600+(u8)T_number);
|
|||
|
}
|
|||
|
|
|||
|
static void disable_T(void)
|
|||
|
{
|
|||
|
timer_disble(T_number);
|
|||
|
OUT(0X1600+(u8)T_number); //disable T coil
|
|||
|
OUT(0x0600+(u8)T_number); //reset T over coil
|
|||
|
}
|
|||
|
|
|||
|
static void T_given_value_K(void) //
|
|||
|
{
|
|||
|
if(PLC_ACC_BIT&0X01) //
|
|||
|
enable_T_K();
|
|||
|
else
|
|||
|
PLC_Addr++,disable_T();
|
|||
|
}
|
|||
|
static void T_given_value_D(void) //
|
|||
|
{
|
|||
|
T_value=(*PLC_Addr%0x100)/2;
|
|||
|
PLC_Addr++;
|
|||
|
switch(*PLC_Addr/0x100)
|
|||
|
{
|
|||
|
case 0x86: T_value+=(*PLC_Addr%0x100)*0x80; break;
|
|||
|
case 0x88: T_value+=(*PLC_Addr%0x100)*0x80+1000; break;
|
|||
|
}
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01) //<2F>Ƿ<EFBFBD><C7B7><EFBFBD>Ч
|
|||
|
enable_T_D();
|
|||
|
else
|
|||
|
disable_T();
|
|||
|
}
|
|||
|
|
|||
|
static void operation_T(void)
|
|||
|
{
|
|||
|
T_number=*PLC_Addr; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
PLC_Addr++; //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>K<EFBFBD><4B>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>D<EFBFBD><44>ֵ
|
|||
|
switch(*PLC_Addr/0x100)
|
|||
|
{
|
|||
|
case 0x80: T_given_value_K(); break; //<2F><><EFBFBD><EFBFBD>K<EFBFBD><4B>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|||
|
case 0x86: T_given_value_D(); break; //<2F><><EFBFBD><EFBFBD>D<EFBFBD><44>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void enable_C_K(void) //<2F>ó<EFBFBD><C3B3><EFBFBD>K<EFBFBD><4B><EFBFBD>и<EFBFBD>ֵ
|
|||
|
{
|
|||
|
u16 temp_bit,*p_C_enable_coil;u32 C;
|
|||
|
C_value=*PLC_Addr%0x100; //<2F><><EFBFBD><EFBFBD>8λֵ
|
|||
|
PLC_Addr++;
|
|||
|
C_value+=(*PLC_Addr%0x100)*0x100; //<2F><><EFBFBD><EFBFBD>8λֵ
|
|||
|
if(C_number>=0xC8) //<2F>ж<EFBFBD><D0B6>Dz<EFBFBD><C7B2><EFBFBD>C200<30><30><EFBFBD>ϵ<EFBFBD> <20>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
{
|
|||
|
PLC_Addr++;
|
|||
|
C_value+=(*PLC_Addr%0x100)*0x10000; //<2F><><EFBFBD><EFBFBD>8λֵ
|
|||
|
PLC_Addr++;
|
|||
|
C_value+=(*PLC_Addr%0x100)*0x1000000;//<2F><><EFBFBD><EFBFBD>8λֵ
|
|||
|
C=0x20001C00+(C_number-0xC8)*4;
|
|||
|
temp_bit=1<<(C_number%0x10);
|
|||
|
if(PLC_RAM32(C)<C_value) //<2F><>C<EFBFBD><43>ǰֵ<C7B0><D6B5>Ŀ<EFBFBD><C4BF>ֵ<EFBFBD><D6B5><EFBFBD>бȽ<D0B1>
|
|||
|
{
|
|||
|
p_C_enable_coil=PLC_16BIT+0x0270+(C_number/0X10);//<2F>Ƚ<EFBFBD>enable coil
|
|||
|
if(!((*p_C_enable_coil&temp_bit)==temp_bit))
|
|||
|
PLC_RAM32(C)+=1;
|
|||
|
}
|
|||
|
if(PLC_RAM32(C)<C_value) //<2F>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
PLC_BIT_OFF(0x0E00+C_number);
|
|||
|
else
|
|||
|
PLC_BIT_ON(0x0E00+C_number);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
static u16 *p_data;
|
|||
|
p_data=PLC_16BIT+0x0500+C_number; //
|
|||
|
temp_bit=1<<(C_number%0x10);
|
|||
|
if(*p_data<C_value)
|
|||
|
{
|
|||
|
p_C_enable_coil=PLC_16BIT+0x0270+(C_number/0X10); //<2F>Ƚ<EFBFBD>enable coil
|
|||
|
if(!((*p_C_enable_coil&temp_bit)==temp_bit))
|
|||
|
*p_data+=1;
|
|||
|
}
|
|||
|
if(*p_data<C_value) //<2F>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
PLC_BIT_OFF(0x0E00+C_number);
|
|||
|
else
|
|||
|
PLC_BIT_ON(0x0E00+C_number);
|
|||
|
}
|
|||
|
OUT(0X2700+(u8)C_number);
|
|||
|
}
|
|||
|
|
|||
|
static void enable_C_D(void) //<2F>üĴ<C3BC><C4B4><EFBFBD>D<EFBFBD><44><EFBFBD>и<EFBFBD>ֵ
|
|||
|
{
|
|||
|
static u16 *p_data;
|
|||
|
u16 temp_bit,*p_C_enable_coil;u32 C;
|
|||
|
C_value=PLC_16BIT[0x1000+C_value];
|
|||
|
if(C_number>=0xC8) //<2F>ж<EFBFBD><D0B6>Dz<EFBFBD><C7B2><EFBFBD>C200<30><30><EFBFBD>ϵ<EFBFBD> <20>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
{
|
|||
|
C_value+=PLC_16BIT[0x1000+C_value+1]*0x10000;
|
|||
|
C=0x20001C00+(C_number-0xC8)*4;
|
|||
|
temp_bit=1<<(C_number%0x10);
|
|||
|
if(PLC_RAM32(C)<C_value) //<2F><>C<EFBFBD><43>ǰֵ<C7B0><D6B5>Ŀ<EFBFBD><C4BF>ֵ<EFBFBD><D6B5><EFBFBD>бȽ<D0B1>
|
|||
|
{
|
|||
|
p_C_enable_coil=PLC_16BIT+0x0270+(C_number/0X10); //<2F>Ƚ<EFBFBD>enable coil
|
|||
|
if(!((*p_C_enable_coil&temp_bit)==temp_bit))
|
|||
|
PLC_RAM32(C)+=1;
|
|||
|
}
|
|||
|
if(*p_data<C_value) //<2F>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
PLC_BIT_OFF(0x0E00+C_number);
|
|||
|
else
|
|||
|
PLC_BIT_ON(0x0E00+C_number);
|
|||
|
PLC_Addr+=2;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
p_data=PLC_16BIT+0x0500+C_number;
|
|||
|
temp_bit=1<<(C_number%0x10);
|
|||
|
if(*p_data<C_value) //<2F><>C<EFBFBD><43>ǰֵ<C7B0><D6B5>Ŀ<EFBFBD><C4BF>ֵ<EFBFBD><D6B5><EFBFBD>бȽ<D0B1>
|
|||
|
{
|
|||
|
p_C_enable_coil=PLC_16BIT+0x0270+(C_number/0X10); //<2F>Ƚ<EFBFBD>enable coil
|
|||
|
if(!((*p_C_enable_coil&temp_bit)==temp_bit))
|
|||
|
*p_data+=1;
|
|||
|
}
|
|||
|
if(*p_data<=C_value) //<2F>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
PLC_BIT_OFF(0x0E00+C_number);
|
|||
|
else
|
|||
|
PLC_BIT_ON(0x0E00+C_number);
|
|||
|
}
|
|||
|
OUT(0X2700+(u8)C_number);
|
|||
|
}
|
|||
|
|
|||
|
static void disable_C_K(void)
|
|||
|
{
|
|||
|
u32 C;static u16 *p_data;
|
|||
|
C_value=*PLC_Addr%0x100; //<2F><><EFBFBD><EFBFBD>8λֵ
|
|||
|
PLC_Addr++;
|
|||
|
C_value+=(*PLC_Addr%0x100)*0x100; //<2F><><EFBFBD><EFBFBD>8λֵ
|
|||
|
if(C_number>=0xC8) //<2F>ж<EFBFBD><D0B6>Dz<EFBFBD><C7B2><EFBFBD>C200<30><30><EFBFBD>ϵ<EFBFBD> <20>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
{
|
|||
|
PLC_Addr++;
|
|||
|
C_value=(*PLC_Addr%0x100)*0x10000; //<2F><><EFBFBD><EFBFBD>8λֵ
|
|||
|
PLC_Addr++;
|
|||
|
C_value+=(*PLC_Addr%0x100)*0x1000000;//<2F><><EFBFBD><EFBFBD>8λֵ
|
|||
|
C=0x20001C00+(C_number-0xC8)*4;
|
|||
|
if(PLC_RAM32(C)<C_value) //<2F><>C<EFBFBD><43>ǰֵ<C7B0><D6B5>Ŀ<EFBFBD><C4BF>ֵ<EFBFBD><D6B5><EFBFBD>бȽ<D0B1>
|
|||
|
PLC_BIT_OFF(0x0E00+C_number);
|
|||
|
else
|
|||
|
PLC_BIT_ON(0x0E00+C_number);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
p_data=PLC_16BIT+0x0500+C_number;
|
|||
|
if(*p_data<C_value) //<2F>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
PLC_BIT_OFF(0x0E00+C_number);
|
|||
|
else
|
|||
|
PLC_BIT_ON(0x0E00+C_number);
|
|||
|
}
|
|||
|
OUT(0X2700+(u8)C_number);
|
|||
|
}
|
|||
|
|
|||
|
static void disable_C_D(void) //<2F>رռ<D8B1><D5BC><EFBFBD><EFBFBD><EFBFBD>C
|
|||
|
{
|
|||
|
u32 C;static u16 *p_data;
|
|||
|
if(C_number>=0xC8) //<2F>ж<EFBFBD><D0B6>Dz<EFBFBD><C7B2><EFBFBD>C200<30><30><EFBFBD>ϵ<EFBFBD> <20>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
{
|
|||
|
C_value=PLC_16BIT[0x1000+C_value];
|
|||
|
C_value+=PLC_16BIT[0x1000+C_value+1]*0x10000;
|
|||
|
C=0x20001C00+(C_number-0xC8)*4;
|
|||
|
if(PLC_RAM32(C)<C_value) //<2F>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
PLC_BIT_OFF(0x0E00+C_number);
|
|||
|
else
|
|||
|
PLC_BIT_ON(0x0E00+C_number);
|
|||
|
PLC_Addr+=2;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
C_value=PLC_16BIT[0x1000+C_value];
|
|||
|
p_data=PLC_16BIT+0x0500+C_number;
|
|||
|
if(*p_data<C_value) //<2F>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|||
|
PLC_BIT_OFF(0x0E00+C_number);
|
|||
|
else
|
|||
|
PLC_BIT_ON(0x0E00+C_number);
|
|||
|
}
|
|||
|
OUT(0X2700+(u8)C_number);
|
|||
|
}
|
|||
|
|
|||
|
static void C_given_value_K(void) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>K<EFBFBD><4B><EFBFBD>趨ֵ
|
|||
|
{
|
|||
|
if((PLC_ACC_BIT&0X01)==0X01) //
|
|||
|
enable_C_K(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
else
|
|||
|
disable_C_K();
|
|||
|
}
|
|||
|
|
|||
|
static void C_given_value_D(void) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>D<EFBFBD><44><EFBFBD>趨ֵ
|
|||
|
{
|
|||
|
C_value=(*PLC_Addr%0x100)/2;
|
|||
|
PLC_Addr++;
|
|||
|
switch(*PLC_Addr/0x100)
|
|||
|
{
|
|||
|
case 0x86: C_value+=(*PLC_Addr%0x100)*0x80; break;
|
|||
|
case 0x88: C_value+=(*PLC_Addr%0x100)*0x80+1000; break;
|
|||
|
}
|
|||
|
if(PLC_ACC_BIT&0X01) //
|
|||
|
enable_C_D();
|
|||
|
else
|
|||
|
disable_C_D();
|
|||
|
}
|
|||
|
|
|||
|
static void operation_C()
|
|||
|
{
|
|||
|
C_number=*PLC_Addr; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
PLC_Addr++; //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>K<EFBFBD><4B>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>D<EFBFBD><44>ֵ
|
|||
|
switch(*PLC_Addr/0x100)
|
|||
|
{
|
|||
|
case 0x80: C_given_value_K();break; //<2F><><EFBFBD><EFBFBD>K<EFBFBD><4B>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|||
|
case 0x86: C_given_value_D();break; //<2F><><EFBFBD><EFBFBD>D<EFBFBD><44>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
static void FNC_AppInstruct(void)
|
|||
|
{
|
|||
|
switch(*PLC_Addr)
|
|||
|
{
|
|||
|
case 0x0002: PLC_Addr++,expand_OUT(); break; //M1535<33><35><EFBFBD>ϵ<EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
case 0x0003: PLC_Addr++,expand_SET(); break; //M1535<33><35><EFBFBD>ϵ<EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
case 0x0004: PLC_Addr++,expand_RST(); break; //M1535<33><35><EFBFBD>ϵ<EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
|
|||
|
case 0x0005: PLC_Addr++,expand_OUT(); break; //
|
|||
|
case 0x0006: PLC_Addr++,expand_SET(); break; //
|
|||
|
case 0x0007: PLC_Addr++,expand_RST(); break; //
|
|||
|
case 0x0008: PLC_Addr++,LPS(); break; //
|
|||
|
case 0x0009: PLC_Addr++,LPF(); break; //
|
|||
|
case 0x000C: PLC_Addr++,RST_T_C(); break; //ִ<><D6B4>RST C&T
|
|||
|
case 0x000D: PLC_Addr++,RST_D(); break; //ִ<><D6B4>D<EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>λ
|
|||
|
|
|||
|
case 0x0010: PLC_Addr++,CJ(); break; //CJ
|
|||
|
case 0x1010: PLC_Addr++,CJP(); break; //CJP
|
|||
|
case 0x0012: PLC_Addr++,CALL(); break; //CALL
|
|||
|
case 0x1012: PLC_Addr++,CALLP(); break; //CALLP
|
|||
|
case 0x0014: PLC_Addr++,SRET(); break; //SRET
|
|||
|
case 0x001C: PLC_Addr=PLC_Addr; break; //FEND
|
|||
|
|
|||
|
|
|||
|
// case 0X0020: PLC_Addr++,FOR(); break; //СС<D0A1><D0A1> 20160929<32><39><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FORѭ<52><D1AD>
|
|||
|
// case 0X0022: PLC_Addr++,FOR_NEXT(); break; //СС<D0A1><D0A1> 20160929<32><39><EFBFBD><EFBFBD><EFBFBD><EFBFBD>FOR_NEST ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0X0024: PLC_Addr++,CMP(); break; //16λ<36>Ƚϴ<C8BD><CFB4><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
case 0X1024: PLC_Addr++,CMPP(); break; //16λ<36><CEBB><EFBFBD><EFBFBD><EFBFBD>رȽϴ<C8BD><CFB4><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
case 0X0025: PLC_Addr++,DCMP(); break; //32λ<32>Ƚϴ<C8BD><CFB4><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
case 0X1025: PLC_Addr++,DCMPP(); break; //32λ<32><CEBB><EFBFBD><EFBFBD><EFBFBD>رȽϴ<C8BD><CFB4><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
case 0X0026: PLC_Addr++,ZCP(); break; //16λ<36><CEBB><EFBFBD><EFBFBD>ֵ<EFBFBD>Ƚϴ<C8BD><CFB4><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
case 0X0027: PLC_Addr++,DZCP(); break; //32λ<32><CEBB><EFBFBD><EFBFBD>ֵ<EFBFBD>Ƚϴ<C8BD><CFB4><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
case 0x0028: PLC_Addr++,MOV(); break; //ִ<><D6B4>16bit<69><74><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
case 0X0029: PLC_Addr++,DMOV(); break; //DMOV
|
|||
|
case 0X002A: PLC_Addr++,SMOV(); break; //SMOV
|
|||
|
case 0X002C: PLC_Addr++,CML(); break; //CMLȡ<4C><C8A1>ָ<EFBFBD><D6B8>
|
|||
|
case 0X002D: PLC_Addr++,DCML(); break; //DCMLȡ<4C><C8A1>ָ<EFBFBD><D6B8>
|
|||
|
case 0X002E: PLC_Addr++,BMOV(); break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0X0030: PLC_Addr++,FMOV(); break; //<2F><><EFBFBD>㴫<EFBFBD><E3B4AB>
|
|||
|
case 0X0031: PLC_Addr++,DFMOV(); break; //32λ<32><CEBB><EFBFBD>㴫<EFBFBD><E3B4AB>
|
|||
|
case 0X0032: PLC_Addr++,XCH(); break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0X0033: PLC_Addr++,DXCH(); break; //32λ<32><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0X0034: PLC_Addr++,BCD(); break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>BCD
|
|||
|
case 0X0035: PLC_Addr++,DBCD(); break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>DBCD
|
|||
|
case 0X0036: PLC_Addr++,BIN(); break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>BIN
|
|||
|
case 0X0037: PLC_Addr++,DBIN(); break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>DBIN
|
|||
|
|
|||
|
case 0X0038: PLC_Addr++,ADD(); break; //<2F>ӷ<EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
case 0x0039: PLC_Addr++,DADD(); break; //DADD<44>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0X003A: PLC_Addr++,SUB(); break; //<2F><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
case 0x003B: PLC_Addr++,DSUB(); break; //DSUB<55><42><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x003C: PLC_Addr++,MUL(); break; //MUL <20>˷<EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
case 0x003D: PLC_Addr++,DMUL(); break; //DMUL<55>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x003E: PLC_Addr++,DIV(); break; //DIV <20>˷<EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
case 0x003F: PLC_Addr++,DDIV(); break; //DDIV<49><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x0040: PLC_Addr++,INC(); break; //16λ<36><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1ָ<31><D6B8>
|
|||
|
case 0x1040: PLC_Addr++,INCP(); break; //16λ<36><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1ָ<31><D6B8>
|
|||
|
case 0x0041: PLC_Addr++,DINC(); break; //32λ<32><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1ָ<31><D6B8>
|
|||
|
case 0x1041: PLC_Addr++,DINC_P(); break; //32λ<32><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1ָ<31><D6B8>
|
|||
|
case 0x0042: PLC_Addr++,DEC(); break; //16λ<36><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1ָ<31><D6B8>
|
|||
|
case 0x1042: PLC_Addr++,DECP(); break; //16λ<36><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1ָ<31><D6B8>
|
|||
|
case 0x0043: PLC_Addr++,DDEC(); break; //32λ<32><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1ָ<31><D6B8>
|
|||
|
case 0x0044: PLC_Addr++,WAND(); break; //<2F><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x0045: PLC_Addr++,DWAND(); break; //32λ<32><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x0046: PLC_Addr++,WOR(); break; //<2F><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x0047: PLC_Addr++,DWOR(); break; //32λ<32><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x0048: PLC_Addr++,WXOR(); break; //<2F><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x0049: PLC_Addr++,DWXOR(); break; //32λ<32><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x004A: PLC_Addr++,NEG(); break; //<2F><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
case 0x004B: PLC_Addr++,DNEG(); break; //32λ<32><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
case 0x004C: PLC_Addr++,ROR(); break; //ROR
|
|||
|
case 0x004D: PLC_Addr++,DROR(); break; //DROR
|
|||
|
case 0x004E: PLC_Addr++,ROL(); break; //ROL
|
|||
|
case 0x004F: PLC_Addr++,DROL(); break; //DROL
|
|||
|
case 0x0050: PLC_Addr++,RCR(); break; //RCR
|
|||
|
case 0x0051: PLC_Addr++,DRCR(); break; //DRCR
|
|||
|
case 0x0052: PLC_Addr++,RCL(); break; //RCL
|
|||
|
case 0x0053: PLC_Addr++,DRCL(); break; //DRCL
|
|||
|
|
|||
|
|
|||
|
// case 0x0054: PLC_Addr++,SFTR(); break; //SFTR
|
|||
|
|
|||
|
case 0x0060: PLC_Addr++,ZRST(); break;
|
|||
|
case 0x0062: PLC_Addr++,DECO(); break; //<2F><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
|||
|
case 0x006A: PLC_Addr++,MEAN(); break; //MEAN<41><4E><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>ֵָ<D6B5><D6B8>
|
|||
|
case 0x0070: PLC_Addr++,SQR(); break; //SQR16λ<36><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x0071: PLC_Addr++,DSQR(); break; //SQR32λ<32><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x0072: PLC_Addr++,FLT(); break; //16λ<36><CEBB><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
|||
|
case 0x0073: PLC_Addr++,DFLT(); break; //32λ<32><CEBB><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
|
|||
|
case 0x0076: PLC_Addr++,REFF(); break; //REFF
|
|||
|
case 0x0078: PLC_Addr++,MTR(); break; //MTR
|
|||
|
case 0x007A: PLC_Addr++,HSCS(); break; //<2F><><EFBFBD>ټ<EFBFBD><D9BC><EFBFBD><EFBFBD><EFBFBD>λ 20160709
|
|||
|
|
|||
|
// case 0x0084: PLC_Addr++,PWM(); break; //PWM<57><4D><EFBFBD><EFBFBD>
|
|||
|
case 0x0082: PLC_Addr++,PLSY(); break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x0094: PLC_Addr++,ALT(); break; //ALT
|
|||
|
// case 0x00B4: PLC_Addr++,ASCI(); break; //ASCI
|
|||
|
case 0x00C0: PLC_Addr++,PID(); break; //PID
|
|||
|
case 0x00ED: PLC_Addr++,ECMP(); break; //ECMP
|
|||
|
case 0x00EE: PLC_Addr++,EZCP(); break; //EZCP
|
|||
|
|
|||
|
case 0x00F1: PLC_Addr++,DEMOV(); break; //
|
|||
|
// case 0x00FD: PLC_Addr++,DEBCD(); break; //DEBCD
|
|||
|
|
|||
|
|
|||
|
case 0x0101: PLC_Addr++,DEADD(); break; //<2F><><EFBFBD><EFBFBD><EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x0103: PLC_Addr++,DESUB(); break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x0107: PLC_Addr++,DEDIV(); break; //<2F><><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x0105: PLC_Addr++,DEMUL(); break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x010F: PLC_Addr++,DESQR(); break; //DESQR<51><52><EFBFBD>㿪<EFBFBD><E3BFAA>
|
|||
|
case 0x0112: PLC_Addr++,INT(); break; //INT
|
|||
|
case 0x0113: PLC_Addr++,DINT(); break; //DINT
|
|||
|
case 0x0115: PLC_Addr++,DSIN(); break; //DSIN
|
|||
|
case 0x0117: PLC_Addr++,DCOS(); break; //DCOS
|
|||
|
case 0x0119: PLC_Addr++,DTAN(); break; //DTAN
|
|||
|
|
|||
|
|
|||
|
case 0x0136: PLC_Addr++,SWAP(); break; //SWAP
|
|||
|
case 0x0137: PLC_Addr++,DSWAP(); break; //DSWAP
|
|||
|
|
|||
|
case 0x0150: PLC_Addr++,TCMP(); break; //TCMP
|
|||
|
case 0x0152: PLC_Addr++,TZCP(); break; //TZCP
|
|||
|
case 0x0154: PLC_Addr++,TADD(); break; //TADD
|
|||
|
case 0x0156: PLC_Addr++,TSUB(); break; //TSUB
|
|||
|
case 0x015C: PLC_Addr++,TRD(); break; //TRD
|
|||
|
case 0x015E: PLC_Addr++,TWR(); break; //TWR
|
|||
|
case 0x0164: PLC_Addr++,GRY(); break; //GRY
|
|||
|
case 0x0165: PLC_Addr++,DGRY(); break; //DGRY
|
|||
|
case 0x0166: PLC_Addr++,GBIN(); break; //GBIN
|
|||
|
case 0x0167: PLC_Addr++,DGBIN(); break; //DGBIN
|
|||
|
|
|||
|
|
|||
|
case 0x01C2: PLC_Addr++,expand_LD(); break; //M1535<33><35><EFBFBD>ϵ<EFBFBD>ָ<EFBFBD><D6B8>
|
|||
|
case 0x01C3: PLC_Addr++,expand_LDI(); break; //
|
|||
|
case 0x01C4: PLC_Addr++,expand_AND(); break; //
|
|||
|
case 0x01C5: PLC_Addr++,expand_ANI(); break; //
|
|||
|
case 0x01C6: PLC_Addr++,expand_OR(); break; //
|
|||
|
case 0x01C7: PLC_Addr++,expand_ORI(); break; //
|
|||
|
|
|||
|
case 0x01CA: PLC_Addr++,LDP(); break; //<2F><><EFBFBD><EFBFBD><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x01CB: PLC_Addr++,LDF(); break; //<2F><><EFBFBD><EFBFBD><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x01CC: PLC_Addr++,ANDP(); break; //<2F><><EFBFBD><EFBFBD><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x01CD: PLC_Addr++,ANDF(); break; //<2F><><EFBFBD><EFBFBD><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x01CE: PLC_Addr++,ORP(); break; //<2F><><EFBFBD><EFBFBD><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0x01CF: PLC_Addr++,ORF(); break; //<2F><><EFBFBD><EFBFBD><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
|
|||
|
case 0X01D0: PLC_Addr++,amount(); break; //LD 16λ<36><CEBB><EFBFBD>ڱȽ<DAB1>
|
|||
|
case 0X01D1: PLC_Addr++,Damount(); break; //LD 32λ<32><CEBB><EFBFBD>ڱȽ<DAB1>
|
|||
|
case 0X01D2: PLC_Addr++,big(); break; //LD 16λ<36><CEBB><EFBFBD>ڱȽ<DAB1>
|
|||
|
case 0X01D3: PLC_Addr++,Dbig(); break; //LD 32λ<32><CEBB><EFBFBD>ڱȽ<DAB1>
|
|||
|
case 0X01D4: PLC_Addr++,less(); break; //LD 16λС<CEBB>ڱȽ<DAB1>
|
|||
|
case 0X01D5: PLC_Addr++,Dless(); break; //LD 32λС<CEBB>ڱȽ<DAB1>
|
|||
|
case 0X01D8: PLC_Addr++,no_amount(); break; //LD 16λ<36><CEBB><EFBFBD><EFBFBD><EFBFBD>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
case 0X01D9: PLC_Addr++,Dno_amount(); break; //LD 32λ<32><CEBB><EFBFBD><EFBFBD><EFBFBD>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
case 0X01DA: PLC_Addr++,less_amount(); break; //LD 16λС<CEBB>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>
|
|||
|
case 0X01DB: PLC_Addr++,Dless_amount(); break; //LD 32λС<CEBB>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>
|
|||
|
case 0X01DC: PLC_Addr++,big_amount(); break; //LD 16λ<36><CEBB><EFBFBD>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>
|
|||
|
case 0X01DD: PLC_Addr++,Dbig_amount(); break; //LD 32λ<32><CEBB><EFBFBD>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>
|
|||
|
|
|||
|
case 0X01E0: PLC_Addr++,amount_and(); break; //LD AND 16λ<36><CEBB><EFBFBD>ڱȽ<DAB1>
|
|||
|
case 0X01E1: PLC_Addr++,Damount_and(); break; //LD AND 32λ<32><CEBB><EFBFBD>ڱȽ<DAB1>
|
|||
|
case 0X01E2: PLC_Addr++,big_and(); break; //LD AND 16λ<36><CEBB><EFBFBD>ڱȽ<DAB1>
|
|||
|
case 0X01E3: PLC_Addr++,Dbig_and(); break; //LD AND 32λ<32><CEBB><EFBFBD>ڱȽ<DAB1>
|
|||
|
case 0X01E4: PLC_Addr++,less_and(); break; //LD AND 16λС<CEBB>ڱȽ<DAB1>
|
|||
|
case 0X01E5: PLC_Addr++,Dless_and(); break; //LD AND 32λС<CEBB>ڱȽ<DAB1>
|
|||
|
case 0X01E8: PLC_Addr++,no_amount_and(); break; //LD 16λ<36><CEBB><EFBFBD><EFBFBD><EFBFBD>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
case 0X01E9: PLC_Addr++,Dno_amount_and(); break; //LD 32λ<32><CEBB><EFBFBD><EFBFBD><EFBFBD>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
case 0X01EA: PLC_Addr++,less_amount_and(); break; //LD AND 16λС<CEBB>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>
|
|||
|
case 0X01EB: PLC_Addr++,Dless_amount_and(); break; //LD AND 32λС<CEBB>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>
|
|||
|
case 0X01EC: PLC_Addr++,big_amount_and(); break; //LD AND 16λ<36><CEBB><EFBFBD>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>
|
|||
|
case 0X01ED: PLC_Addr++,Dbig_amount_and(); break; //LD AND 32λ<32><CEBB><EFBFBD>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>
|
|||
|
|
|||
|
case 0X01F0: PLC_Addr++,amount_OR(); break; //LD OR 16λ<36><CEBB><EFBFBD>ڱȽ<DAB1>
|
|||
|
case 0X01F1: PLC_Addr++,Damount_OR(); break; //LD OR 32λ<32><CEBB><EFBFBD>ڱȽ<DAB1>
|
|||
|
case 0X01F2: PLC_Addr++,big_OR(); break; //LD OR 16λ<36><CEBB><EFBFBD>ڱȽ<DAB1>
|
|||
|
case 0X01F3: PLC_Addr++,Dbig_OR(); break; //LD OR 32λ<32><CEBB><EFBFBD>ڱȽ<DAB1>
|
|||
|
case 0X01F4: PLC_Addr++,less_OR(); break; //LD OR 16λС<CEBB>ڱȽ<DAB1>
|
|||
|
case 0X01F5: PLC_Addr++,Dless_OR(); break; //LD OR 32λС<CEBB>ڱȽ<DAB1>
|
|||
|
case 0X01F8: PLC_Addr++,no_amount_OR(); break; //LD 16λ<36><CEBB><EFBFBD><EFBFBD><EFBFBD>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
case 0X01F9: PLC_Addr++,Dno_amount_OR(); break; //LD 32λ<32><CEBB><EFBFBD><EFBFBD><EFBFBD>ڱȽ<DAB1>ָ<EFBFBD><D6B8>
|
|||
|
case 0X01FA: PLC_Addr++,less_amount_OR(); break; //LD OR 16λС<CEBB>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>
|
|||
|
case 0X01FB: PLC_Addr++,Dless_amount_OR(); break; //LD OR 32λС<CEBB>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>
|
|||
|
case 0X01FC: PLC_Addr++,big_amount_OR(); break; //LD OR 16λ<36><CEBB><EFBFBD>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>
|
|||
|
case 0X01FD: PLC_Addr++,Dbig_amount_OR(); break; //LD OR 32λ<32><CEBB><EFBFBD>ڵ<EFBFBD><DAB5>ڱȽ<DAB1>
|
|||
|
|
|||
|
case 0x000F: PLC_Addr=PLC_Addr; break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ENDָ<44><D6B8><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
case 0XF7FF: PLC_Addr++,RET(); break; //RET
|
|||
|
|
|||
|
default:PLC_PROG_ERROR(M8065,02); PLC_Addr++; break; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void find_p(void)//<2F><><EFBFBD><EFBFBD> P <20><><EFBFBD>ڵĵ<DAB5>ַ
|
|||
|
{
|
|||
|
u16 temp;
|
|||
|
PLC_Addr=PLC_START_Address;
|
|||
|
for(temp=0;temp<15999;temp++)//<2F>ܹ<EFBFBD>16000<30><30>
|
|||
|
{
|
|||
|
if((*PLC_Addr&0xFF00)==0xB000)
|
|||
|
PLC_P_Addr[*PLC_Addr%0x100]=PLC_Addr;
|
|||
|
PLC_Addr++;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void RST_Y(void)
|
|||
|
{PLC_16BIT[80]=PLC_16BIT[81]=0;}
|
|||
|
|
|||
|
u16 find_toend(void)//<2F><><EFBFBD><EFBFBD> P <20><><EFBFBD>ڵĵ<DAB5>ַ
|
|||
|
{
|
|||
|
u16 temp;
|
|||
|
PLC_Addr=PLC_START_Address-1;
|
|||
|
temp=0;
|
|||
|
do{PLC_Addr++; temp++;}
|
|||
|
while((!(*PLC_Addr==0x000f))&&(temp<15998));
|
|||
|
return temp;
|
|||
|
}
|
|||
|
|
|||
|
// СС<D0A1>ɣ<EFBFBD>20160929<32>Ż<EFBFBD>
|
|||
|
void PLC_ProInstructParse(void)
|
|||
|
{
|
|||
|
static u8 puls,run_flag;
|
|||
|
if(PLC_RUN) //<2F>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>г<EFBFBD><D0B3><EFBFBD>
|
|||
|
{
|
|||
|
if(run_flag == 1)
|
|||
|
{
|
|||
|
run_flag = 0;
|
|||
|
PLC_8BIT(0X01E0)=0x09;
|
|||
|
}
|
|||
|
if(PLC_8BIT(0X01E0)==0x09) //<2F>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>г<EFBFBD><D0B3><EFBFBD>
|
|||
|
{
|
|||
|
PLC_BIT_ON(M8000); //<2F><><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>M80000ΪON
|
|||
|
PLC_BIT_OFF(M8001); //<2F><><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>M80001Ϊoff
|
|||
|
run_Lamp; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>
|
|||
|
if(edit_prog==0x00) //<2F>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD>༭<EFBFBD><E0BCAD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭һ<E0BCAD>γ<EFBFBD><CEB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>P<EFBFBD><50><EFBFBD>ڵ<EFBFBD>ַ
|
|||
|
{
|
|||
|
find_p();
|
|||
|
edit_prog=1;
|
|||
|
if(find_toend()>15998)
|
|||
|
{
|
|||
|
PLC_8BIT(0X01E0)=0x09;
|
|||
|
goto all_end;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if(puls==0x00) //<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>8002 8003
|
|||
|
{
|
|||
|
PLC_BIT_ON(M8002);
|
|||
|
PLC_BIT_OFF(M8003);
|
|||
|
}
|
|||
|
|
|||
|
PLC_Addr=PLC_START_Address; //PLC<4C><43><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>ַ
|
|||
|
if(Write_Pro_flag == 0)
|
|||
|
{
|
|||
|
PLC_IO_Refresh(); //ˢ<><CBA2>Y<EFBFBD><59><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
do
|
|||
|
{
|
|||
|
switch(*PLC_Addr/0x100) // ȡ<><C8A1>8λ<38><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
case 0x06: operation_T(),PLC_Addr++; break; //operation all timer
|
|||
|
case 0x0E: operation_C(),PLC_Addr++; break; //
|
|||
|
|
|||
|
/* <20><><EFBFBD><EFBFBD>SλԪ<CEBB><D4AA><EFBFBD><EFBFBD><EFBFBD>еĺ<D0B5><C4BA><EFBFBD> */
|
|||
|
case 0x20: LD(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x30: LDI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x40: AND(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x50: ANI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x60: OR(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x70: ORI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
/* <20><><EFBFBD><EFBFBD>SλԪ<CEBB><D4AA><EFBFBD><EFBFBD><EFBFBD>еĺ<D0B5><C4BA><EFBFBD> */
|
|||
|
case 0x21: LD(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x31: LDI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x41: AND(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x51: ANI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x61: OR(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x71: ORI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
/* <20><><EFBFBD><EFBFBD>SλԪ<CEBB><D4AA><EFBFBD><EFBFBD><EFBFBD>еĺ<D0B5><C4BA><EFBFBD> */
|
|||
|
case 0x22: LD(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x32: LDI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x42: AND(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x52: ANI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x62: OR(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x72: ORI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
/* <20><><EFBFBD><EFBFBD>SλԪ<CEBB><D4AA><EFBFBD><EFBFBD><EFBFBD>еĺ<D0B5><C4BA><EFBFBD> */
|
|||
|
case 0x23: LD(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x33: LDI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x43: AND(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x53: ANI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x63: OR(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x73: ORI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
/* <20><><EFBFBD><EFBFBD>XλԪ<CEBB><D4AA><EFBFBD><EFBFBD><EFBFBD>еĺ<D0B5><C4BA><EFBFBD> */
|
|||
|
case 0x24: LD(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x34: LDI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x44: AND(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x54: ANI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x64: OR(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x74: ORI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
/* <20><><EFBFBD><EFBFBD>YλԪ<CEBB><D4AA><EFBFBD><EFBFBD><EFBFBD>еĺ<D0B5><C4BA><EFBFBD> */
|
|||
|
case 0x25: LD(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x35: LDI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x45: AND(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x55: ANI(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x65: OR(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x75: ORI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XC5: OUT(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XD5: BIT_SET(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XE5: RST(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
/* <20><><EFBFBD><EFBFBD>TλԪ<CEBB><D4AA><EFBFBD><EFBFBD><EFBFBD>еĺ<D0B5><C4BA><EFBFBD> */
|
|||
|
case 0x26: LD(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x36: LDI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x46: AND(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x56: ANI(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x66: OR(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x76: ORI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XC6: OUT(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
/* <20><><EFBFBD><EFBFBD>TλԪ<CEBB><D4AA><EFBFBD><EFBFBD><EFBFBD>еĺ<D0B5><C4BA><EFBFBD> */
|
|||
|
case 0x27: LD(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x37: LDI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x47: AND(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x57: ANI(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x67: OR(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x77: ORI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XC7: OUT(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
/* <20><><EFBFBD><EFBFBD>M0_255λԪ<CEBB><D4AA><EFBFBD><EFBFBD><EFBFBD>еĺ<D0B5><C4BA><EFBFBD> */
|
|||
|
case 0x28: LD(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x38: LDI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x48: AND(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x58: ANI(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x68: OR(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x78: ORI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XC8: OUT(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XD8: BIT_SET(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XE8: RST(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
/* <20><><EFBFBD><EFBFBD>M256_511λԪ<CEBB><D4AA><EFBFBD><EFBFBD><EFBFBD>еĺ<D0B5><C4BA><EFBFBD> */
|
|||
|
case 0x29: LD(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x39: LDI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x49: AND(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x59: ANI(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x69: OR(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x79: ORI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XC9: OUT(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XD9: BIT_SET(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XE9: RST(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
/* <20><><EFBFBD><EFBFBD>M512_767λԪ<CEBB><D4AA><EFBFBD><EFBFBD><EFBFBD>еĺ<D0B5><C4BA><EFBFBD> */
|
|||
|
case 0x2A: LD(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x3A: LDI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x4A: AND(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x5A: ANI(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x6A: OR(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x7A: ORI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XCA: OUT(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XDA: BIT_SET(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XEA: RST(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
/* <20><><EFBFBD><EFBFBD>M768_1023λԪ<CEBB><D4AA><EFBFBD><EFBFBD><EFBFBD>еĺ<D0B5><C4BA><EFBFBD> */
|
|||
|
case 0x2B: LD(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x3B: LDI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x4B: AND(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x5B: ANI(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x6B: OR(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x7B: ORI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XCB: OUT(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XDB: BIT_SET(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XEB: RST(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
/* <20><><EFBFBD><EFBFBD>M1024_1279λԪ<CEBB><D4AA><EFBFBD><EFBFBD><EFBFBD>еĺ<D0B5><C4BA><EFBFBD> */
|
|||
|
case 0x2C: LD(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x3C: LDI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x4C: AND(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x5C: ANI(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x6C: OR(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x7C: ORI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XCC: OUT(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XDC: BIT_SET(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XEC: RST(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
/* <20><><EFBFBD><EFBFBD>M1280_1535λԪ<CEBB><D4AA><EFBFBD><EFBFBD><EFBFBD>еĺ<D0B5><C4BA><EFBFBD> */
|
|||
|
case 0x2D: LD(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x3D: LDI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x4D: AND(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x5D: ANI(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x6D: OR(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x7D: ORI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XCD: OUT(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XDD: BIT_SET(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XED: RST(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
/* <20><><EFBFBD><EFBFBD>C0-C255λԪ<CEBB><D4AA><EFBFBD><EFBFBD><EFBFBD>еĺ<D0B5><C4BA><EFBFBD> */
|
|||
|
case 0x2E: LD(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x3E: LDI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x4E: AND(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x5E: ANI(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x6E: OR(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x7E: ORI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
/*m8000-m8255*/
|
|||
|
case 0x2F: LD(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x3F: LDI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x4F: AND(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x5F: ANI(0X0FFF&*PLC_Addr),PLC_Addr++; break;
|
|||
|
case 0x6F: OR(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0x7F: ORI(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XCF: OUT(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XDF: BIT_SET(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0XEF: RST(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
/**********************STL<54><4C><EFBFBD><EFBFBD>ģʽ***************************/
|
|||
|
case 0xF0: STL(0X0FFF&*PLC_Addr),PLC_Addr++; break; //S
|
|||
|
case 0xF1: STL(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0xF2: STL(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
case 0xF3: STL(0X0FFF&*PLC_Addr),PLC_Addr++; break; //
|
|||
|
|
|||
|
////////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ANB<4E><42>ORB<52><42>MPP<50><50>MRD<52><44>MPS<50><53>INV <20><>
|
|||
|
case 0XFF:
|
|||
|
{
|
|||
|
other_function(*PLC_Addr);
|
|||
|
PLC_Addr++;
|
|||
|
break; //MPP,MPS
|
|||
|
}
|
|||
|
case 0xB0: //ָ<><D6B8>P<EFBFBD><50>ʶ
|
|||
|
{
|
|||
|
PLC_Addr++;
|
|||
|
break;
|
|||
|
}
|
|||
|
case 0x00: //<2F><><EFBFBD><EFBFBD>0X001CΪFEND,0X000FΪENDָ<44><D6B8>
|
|||
|
{
|
|||
|
if(((*PLC_Addr%0x100)==0x1C)||((*PLC_Addr%0x100)==0x0F))
|
|||
|
goto all_end;
|
|||
|
}
|
|||
|
|
|||
|
//////////////////////////////////////////////////////////////
|
|||
|
// СС<D0A1>ɣ<EFBFBD>20160929ע<39>ͣ<EFBFBD>Ӧ<EFBFBD><D3A6>ָ<EFBFBD><D6B8>
|
|||
|
//////////////////////////////////////////////////////////////
|
|||
|
default: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD> ,<2C>˴<EFBFBD><CBB4><EFBFBD>Ҫִ<D2AA><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ16bit<69><74>ָ<EFBFBD><D6B8>
|
|||
|
{
|
|||
|
FNC_AppInstruct();
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}while(1);
|
|||
|
all_end:
|
|||
|
D8010=D8011=D8012=PLC_RUN_TIME; //<2F><><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8>ʱ<EFBFBD><CAB1>
|
|||
|
PLC_RUN_TIME=0; //<2F><><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8>ʱ<EFBFBD><CAB1>
|
|||
|
puls=0x01;
|
|||
|
PLC_BIT_OFF(M8002),PLC_BIT_ON(M8003); //<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>8002 8003
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PLC_BIT_OFF(M8000); //û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>M80000ΪOFF
|
|||
|
PLC_BIT_ON(M8001); //û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>M80001Ϊon
|
|||
|
D8012=0;
|
|||
|
edit_prog=0; //<2F><><EFBFBD><EFBFBD>ʱҪ<CAB1>õ<EFBFBD>
|
|||
|
puls=0; //<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>8002 8003
|
|||
|
Stop_Lamp; //<2F>ر<EFBFBD><D8B1><EFBFBD><EFBFBD>е<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4>л<EFBFBD><D0BB><EFBFBD>ֹͣ״̬<D7B4><CCAC><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD>
|
|||
|
if(Write_Pro_flag == 0)
|
|||
|
{
|
|||
|
RST_Y();
|
|||
|
PLC_IO_Refresh(); //ˢ<><CBA2>Y<EFBFBD><59><EFBFBD><EFBFBD>
|
|||
|
RST_T_D_C_M_data();
|
|||
|
}
|
|||
|
PLC_STL_CMD = PLC_STL_Status = 0; //<2F>ϴγ<CFB4><CEB3><EFBFBD><EFBFBD>еIJ<D0B5><C4B2><EFBFBD>
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
RST_Y(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4>л<EFBFBD><D0BB><EFBFBD>ֹͣ״̬<D7B4><CCAC><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD>
|
|||
|
PLC_BIT_OFF(M8000); //û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>M80000ΪOFF
|
|||
|
PLC_BIT_ON(M8001); //û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>M80001Ϊon
|
|||
|
D8012=0;
|
|||
|
edit_prog=0; //<2F><><EFBFBD><EFBFBD>ʱҪ<CAB1>õ<EFBFBD>
|
|||
|
puls=0; //<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>8002 8003
|
|||
|
Stop_Lamp; //<2F>ر<EFBFBD><D8B1><EFBFBD><EFBFBD>е<EFBFBD>
|
|||
|
Write_Pro_flag = 0;
|
|||
|
PLC_IO_Refresh();
|
|||
|
|
|||
|
PLC_STL_CMD = PLC_STL_Status = 0;
|
|||
|
if(run_flag == 0)
|
|||
|
{
|
|||
|
run_flag = 1;
|
|||
|
PLC_RUN_TIME=0;
|
|||
|
RST_T_D_C_M_data();
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
PLC_16BIT[0X701]=0X000; //<2F><><EFBFBD>ð汾<C3B0><E6B1BE>
|
|||
|
}
|
|||
|
|
|||
|
|