IC卡扩展内存写入
从s1_Start指定的地址读取由s2_Number指定字数的数据,并写入d_Start指定的IC卡中的扩展内存区。
输入
源数据,起始16位区域
要读取后再写入IC卡的字数
IC卡扩展内存的目标区域
所有用于编程此函数的输入和输出变量已在POU头中声明。 所有编程语言使用相同的POU头。
VAR
Var_Real: REAL:=0.0;
Write_To_ICCard: BOOL:=FALSE;
Read_From_ICCard: BOOL:=FALSE;
ICCardStartAdr: DINT:=0;
END_VAR
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 7 ;
NETWORK_BODY
B(B_F,E_ADD-2!,Instance,9,2,15,7,,?DEN?D?D?AENO?C);
B(B_VAROUT,,Var_Real,15,4,17,6,);
B(B_CONTACT,,sys_bPulse1s,4,3,6,5,R);
B(B_COMMENT,,Just count th REAL value up,2,1,16,2,);
B(B_VARIN,,22.33,7,5,9,7,);
B(B_VARIN,,Var_Real,7,4,9,6,);
L(1,4,4,4);
L(6,4,9,4);
L(1,0,1,7);
END_NETWORK_BODY
END_NET_WORK
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 13 ;
NETWORK_BODY
B(B_F,F13_ICWT!,Instance,20,2,28,8,,?DEN?Ds1_Start?Ds2_Number?Dd_Start?AENO);
B(B_CONTACT,,Write_To_ICCard,10,3,12,5,R);
B(B_F,Adr_Of_Var_I!,Instance,8,5,15,7,,?D?C);
B(B_VARIN,,Var_Real,6,5,8,7,);
B(B_F,Size_Of_Var!,Instance,8,7,15,9,,?D?C);
B(B_F,INT_TO_DINT!,Instance,8,9,16,11,,?D?C);
B(B_VARIN,,ICCardStartAdr,6,11,8,13,);
B(B_COMMENT,,Write REAL value to IC card,2,1,16,2,);
L(1,4,10,4);
L(12,4,20,4);
L(8,6,8,8);
L(15,6,16,6);
L(16,5,16,6);
L(16,5,20,5);
L(7,9,16,9);
L(7,9,7,10);
L(7,10,8,10);
L(15,8,16,8);
L(16,8,16,9);
L(17,6,17,10);
L(17,6,20,6);
L(16,10,17,10);
L(8,12,19,12);
L(19,7,19,12);
L(19,7,20,7);
L(1,0,1,13);
END_NETWORK_BODY
END_NET_WORK
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 9 ;
NETWORK_BODY
B(B_CONTACT,,Write_To_ICCard,10,2,12,4,R);
B(B_VARIN,,ICCardStartAdr,8,3,10,5,);
B(B_F,Size_Of_Var!,Instance,8,5,15,7,,?D?C);
B(B_F,INT_TO_DINT!,Instance,8,7,16,9,,?D?C);
B(B_COMMENT,,Read REAL value from IC card,2,0,16,1,);
B(B_F,F12_ICRD!,Instance,18,1,26,6,,?DEN?Ds1_Start?Ds2_Number?AENO?Cd_Start);
B(B_F,Adr_Of_Var_O!,Instance,27,3,35,5,,?D?C);
B(B_VAROUT,,Var_Real,35,3,37,5,);
B(B_VARIN,,Var_Real,6,5,8,7,);
L(1,3,10,3);
L(7,7,16,7);
L(7,7,7,8);
L(7,8,8,8);
L(15,6,16,6);
L(16,6,16,7);
L(12,3,18,3);
L(26,4,27,4);
L(10,4,18,4);
L(18,5,18,8);
L(16,8,18,8);
L(1,0,1,9);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF DF(R901C) then
Var_Real := Var_Real + 22.33;
END_IF;
(* Write a REAL value to the IC Card *)
IF DF(Write_To_ICCard) then
F13_ICWT( s1_Start:= Adr_Of_Var( Var_Real ) , s2_Number:= INT_TO_DINT( Size_Of_Var( Var_Real ) ), d_Start:= ICCardStartAdr );
END_IF;
(*Read a REAL value from the IC Card*)
IF DF(Read_From_ICCard) then
F12_ICRD( s1_Start:= ICCardStartAdr, s2_Number:= INT_TO_DINT( Size_Of_Var( Var_Real ) ) ,
d_Start=> Adr_Of_Var( Var_Real ) );
END_IF;