Advertisement
当前位置:
威纶HMI锁机(隔时更新码/改HMI时间无效)
回复 | 人气 | 打印
jxlgw 个人主页 给TA发消息 加TA为好友 发表于:2019-01-11 15:36:58 楼主

哎 被恶意公开了

帖子也删不掉

没办法

下次不会用了

前面楼主还有2个帖子,可以下载使用,有需要新版的可以联系索取 站内信


新的在第二个版本帖子有说,可以根据提供的注册码实时更新需要的锁机时长,及修复一些问题  等...


分享到: 收藏 回复 举报

fsjnzhouyan 个人主页 给TA发消息 加TA为好友 发表于:2019-01-12 10:35:20 1楼
 

楼主宏指令加密没有的。


现分享宏指令给有兴趣者参考。


1.png


LockCode   宏指令

//lock code for lock hmi and plc
macro_command main()
short get_year,get_month,get_day,get_hour,get_version,get_machine,get_minute
short get_time[5],compare_minute
short year_day,year_month,month_hour,day_hour,machine_minute,machine_hour_minute
char year_day_asc[3],year_month_asc[3],month_hour_asc[3],day_hour_asc[3],minute_asc[2]
char bind_year_day[20],bind_year_month[20],version_code[4],machine_code[4],forever_code[4]
char cmp_str1[20],cmp_str2[20],temp_str[20]
short month_re,day_re,RAND_version,RAND_num
bool test_bool1,set_bool = true
bool result1,result2,result3,result4,result5,result6
GetData(get_time[0], "Local HMI", LW, 9018, 5)
GetData(get_version, "Local HMI", RW, 0, 1)
GetData(get_machine, "Local HMI", RW, 3, 1)
GetData(compare_minute, "Local HMI", LW, 9, 1)
get_minute = get_time[0]
year_day = get_time[2]+get_time[4]
year_month = get_time[3]+get_time[4]
month_hour = get_time[1]+get_time[3]
day_hour = get_time[1]+get_time[2]
machine_minute = get_machine + compare_minute
machine_hour_minute = get_machine + compare_minute + get_time[1]
DEC2ASCII(year_day, year_day_asc[0], 3)
DEC2ASCII(month_hour, month_hour_asc[0], 3)
DEC2ASCII(year_month, year_month_asc[0], 3)
DEC2ASCII(day_hour, day_hour_asc[0], 3)
HEX2ASCII(get_version, version_code[0], 4)
HEX2ASCII(machine_minute, machine_code[0], 4)
HEX2ASCII(machine_hour_minute, forever_code[0], 4)
HEX2ASCII(compare_minute, minute_asc[0], 2)
SetData(year_day_asc[0], "Local HMI", LW, 2, 3)
SetData(month_hour_asc[0], "Local HMI", LW, 0, 3)
SetData(year_month_asc[0], "Local HMI", LW, 7, 3)
SetData(day_hour_asc[0], "Local HMI", LW, 5, 3)
SetData(machine_code[0], "Local HMI", LW, 50, 4)
SetData(forever_code[0], "Local HMI", LW, 52, 4)
SetData(minute_asc[0], "Local HMI", LW, 54, 2)
FILL(bind_year_day[0], 0, 16)
FILL(bind_year_month[0], 0, 16)
FILL(temp_str[0], 0, 16)
StringCat(month_hour_asc[0], bind_year_day[0])//result1 = 3
StringCat(year_day_asc[0], bind_year_day[3])//result2 = 3
StringCat(version_code[0], bind_year_day[6])//result3 = 
StringCat(minute_asc[0], bind_year_day[10])
StringCat(machine_code[0], bind_year_day[12])
StringCat(forever_code[0], bind_year_month[0])//result4 = 
StringCat(year_month_asc[0], bind_year_month[4])
StringCat(minute_asc[0], bind_year_month[7])//result6 = 
StringCat(version_code[0], bind_year_month[9])
StringCat(day_hour_asc[0], bind_year_month[13])//result5 = 
SetData(bind_year_day[0], "Local HMI", LW, 10, 16)
SetData(bind_year_month[0], "Local HMI", LW, 20, 16)
GetData(cmp_str1[0], "Local HMI", LW, 30, 16)
GetData(cmp_str2[0], "Local HMI", LW, 40, 16)
if (compare_minute-1)>get_minute or (compare_minute+1)<get_minute then    
    SetData(get_minute, "Local HMI", LW, 9, 1)
    RAND(RAND_num)
    RAND_version = RAND_num
    SetData(RAND_version, "Local HMI", RW, 0, 1)
    compare_minute = get_minute
end if
result1 = StringCompare(cmp_str1[0], bind_year_day[0])
//if cmp_str1[0]==bind_year_day[0] and cmp_str1[1]==bind_year_day[1] and cmp_str1[2]==bind_year_day[2] and cmp_str1[3]==bind_year_day[3] and cmp_str1[4]==bind_year_day[4] and cmp_str1[5]==bind_year_day[5] and cmp_str1[6]==bind_year_day[6] and cmp_str1[7]==bind_year_day[7] and cmp_str1[8]==bind_year_day[8] and cmp_str1[9]==bind_year_day[9] then
//    test_bool1=true
//    SetData(get_time[2], "Local HMI", RW, 2, 1)
//    SetData(get_time[1], "Local HMI", RW, 1, 1)
//    RAND(RAND_num)
//    RAND_version = RAND_num
//    SetData(RAND_version, "Local HMI", RW, 0, 1)
//else if cmp_str1[0]<>bind_year_day[0] or cmp_str1[1]<>bind_year_day[1] or cmp_str1[2]<>bind_year_day[2] or cmp_str1[3]<>bind_year_day[3] or cmp_str1[4]<>bind_year_day[4] or cmp_str1[5]<>bind_year_day[5] or cmp_str1[6]<>bind_year_day[6] or cmp_str1[7]<>bind_year_day[7] or cmp_str1[8]<>bind_year_day[8] or cmp_str1[9]<>bind_year_day[9] then
//    test_bool1=false
//end if
if result1 then
    test_bool1=true
    SetData(get_time[3], "Local HMI", RW, 2, 1)
    SetData(get_time[2], "Local HMI", RW, 1, 1)
    SetData(get_time[2], "Local HMI", RW, 5, 1)
    SetData(get_time[3], "Local HMI", RW, 6, 1)
    RAND(RAND_num)
    RAND_version = RAND_num
    SetData(RAND_version, "Local HMI", RW, 0, 1)
else if not result1 then
    test_bool1=false
end if
if test_bool1 then
    SetData(set_bool, "Local HMI", LB, 0, 1)
    SetData(set_bool, "Local HMI", RW_Bit, 4.1, 1)
    DELAY(500)
    SetData(temp_str[0], "Local HMI", LW, 30, 16)    
end if
result2 = StringCompare(cmp_str2[0],bind_year_month[0])
if result2 then
    SetData(set_bool, "Local HMI", RW_Bit, 4.0, 1)
    SetData(set_bool, "Local HMI", RW_Bit, 4.1, 1)
else if not result2 then
    SetData(temp_str[0], "Local HMI", LW, 40, 16)
end if

end macro_command

  回复 引用 举报
fsjnzhouyan 个人主页 给TA发消息 加TA为好友 发表于:2019-01-12 10:38:24 2楼
 

TimeLock_Machine    宏指令

  

macro_command main()
bool lock_flag,get_lock,lock_delay,true_bool = true,false_bool = false
short get_month,get_day,month_re,day_re,month_count,day_count
GetData(get_month, "Local HMI", LW, 9021, 1)
GetData(get_day, "Local HMI", LW, 9020, 1)
GetData(month_re, "Local HMI", RW, 2, 1)
GetData(day_re, "Local HMI", RW, 1, 1)
GetData(lock_flag, "Local HMI", RW_Bit, 4.0, 1)
GetData(get_lock, "Local HMI", LB, 1, 1)
if month_re<>12 and not lock_flag then
    if (get_month==(month_re+1) and get_day>=day_re) or (get_month>=(month_re+1)) or (get_month<=(month_re-1)) or (get_day<day_re and get_month==month_re) then
        SetData(false_bool, "Local HMI", RW_Bit, 4.1, 1)
        SetData(false_bool, "Local HMI", LB, 0, 1)
    end if
else if month_re==12 and not lock_flag then
    if (get_month==1 and get_day>=day_re) or get_month>=2 then
        SetData(false_bool, "Local HMI", RW_Bit, 4.1, 1)
        SetData(false_bool, "Local HMI", LB, 0, 1)
    end if
else if lock_flag then
    SetData(true_bool, "Local HMI", RW_Bit, 4.1, 1)
end if
if get_lock then
    SetData(false_bool, "Local HMI", RW_Bit, 4.1, 1)
    SetData(false_bool, "Local HMI", LB, 1, 1)
    SetData(false_bool, "Local HMI", LB, 0, 1)
end if
end macro_command

  回复 引用 举报
fsjnzhouyan 个人主页 给TA发消息 加TA为好友 发表于:2019-01-12 10:40:53 3楼
 

Time_Change_Lock  宏指令


macro_command main()
short day_re,month_re,day_get,month_gt,hour_get,minute_get,second_get,day_temp,month_temp
short get_time[5]
bool false_bool = false,lock_flag
GetData(get_time[0], "Local HMI", LW, 9018, 5)
GetData(second_get, "Local HMI", LW, 9017, 1)
GetData(lock_flag, "Local HMI", RW_Bit, 4.0, 1)
//SetData(get_time[2], "Local HMI", RW, 5, 1)
//SetData(get_time[3], "Local HMI", RW, 6, 1)
if (get_time[4]%4) == 0 then
    if get_time[3]==1 or get_time[3]==3 or get_time[3]==5 or get_time[3]==7 or get_time[3]==8 or get_time[3]==10 or get_time[3]==12 then
        if get_time[1]==23 and get_time[0]==59 and second_get==59 then
            if get_time[2]<>31 then
                day_temp = get_time[2]+1
                SetData(day_temp, "Local HMI", RW, 5, 1)
            else if get_time[2]==31 then
                day_temp = 1
                if get_time[3]==12 then
                    month_temp = 1
                else if get_time[3]<>12 then
                    month_temp = get_time[3]+1
                end if
                SetData(day_temp, "Local HMI", RW, 5, 1)
                SetData(month_temp, "Local HMI", RW, 6, 1)
            end if
        end if
    else if get_time[3]==4 or get_time[3]==6 or get_time[3]==9 or get_time[3]==11 then
         if get_time[1]==23 and get_time[0]==59 and second_get==59 then
            if get_time[2]<>30 then
                day_temp = get_time[2]+1
                SetData(day_temp, "Local HMI", RW, 5, 1)
            else if get_time[2]==30 then
                day_temp = 1
                month_temp = get_time[3]+1
                SetData(day_temp, "Local HMI", RW, 5, 1)
                SetData(month_temp, "Local HMI", RW, 6, 1)
            end if
        end if
    else if get_time[3]==2 then
        if get_time[1]==23 and get_time[0]==59 and second_get==59 then
            if get_time[2]<>29 then
                day_temp = get_time[2]+1
                SetData(day_temp, "Local HMI", RW, 5, 1)
            else if get_time[2]==29 then
                day_temp = 1
                month_temp = get_time[3]+1
                SetData(day_temp, "Local HMI", RW, 5, 1)
                SetData(month_temp, "Local HMI", RW, 6, 1)
            end if
        end if
    end if
else if (get_time[4]%4) <> 0 then
    if get_time[3]==1 or get_time[3]==3 or get_time[3]==5 or get_time[3]==7 or get_time[3]==8 or get_time[3]==10 or get_time[3]==12 then
        if get_time[1]==23 and get_time[0]==59 and second_get==59 then
            if get_time[2]<>31 then
                day_temp = get_time[2]+1
                SetData(day_temp, "Local HMI", RW, 5, 1)
            else if get_time[2]==31 then
                day_temp = 1
                if get_time[3]==12 then
                    month_temp = 1
                else if get_time[3]<>12 then
                    month_temp = get_time[3]+1
                end if
                SetData(day_temp, "Local HMI", RW, 5, 1)
                SetData(month_temp, "Local HMI", RW, 6, 1)
            end if
        end if
    else if get_time[3]==4 or get_time[3]==6 or get_time[3]==9 or get_time[3]==11 then
         if get_time[1]==23 and get_time[0]==59 and second_get==59 then
            if get_time[2]<>30 then
                day_temp = get_time[2]+1
                SetData(day_temp, "Local HMI", RW, 5, 1)
            else if get_time[2]==30 then
                day_temp = 1
                month_temp = get_time[3]+1
                SetData(day_temp, "Local HMI", RW, 5, 1)
                SetData(month_temp, "Local HMI", RW, 6, 1)
            end if
        end if
    else if get_time[3]==2 then
        if get_time[1]==23 and get_time[0]==59 and second_get==59 then
            if get_time[2]<>28 then
                day_temp = get_time[2]+1
                SetData(day_temp, "Local HMI", RW, 5, 1)
            else if get_time[2]==28 then
                day_temp = 1
                month_temp = get_time[3]+1
                SetData(day_temp, "Local HMI", RW, 5, 1)
                SetData(month_temp, "Local HMI", RW, 6, 1)
            end if
        end if
    end if
end if
if second_get<>59 and get_time[1]<>23 and get_time[0]<>59 and not lock_flag then
    GetData(day_re, "Local HMI", RW, 5, 1)
    GetData(month_re, "Local HMI", RW, 6, 1)
    if month_re<>get_time[3] or day_re<>get_time[2] then
        SetData(false_bool, "Local HMI", RW_Bit, 4.1, 1)
    end if
end if
end macro_command

  回复 引用 举报
gk2017 个人主页 给TA发消息 加TA为好友 发表于:2019-01-17 09:44:47 4楼
 

谢谢楼主的分享,下载来看看

  回复 引用 举报
lyx19850815 个人主页 给TA发消息 加TA为好友 发表于:2019-01-21 16:55:10 5楼
 

宏指今结合PLC加密,可以更加安全

  回复 引用 举报

相关主题
周点击排行
周回复排行
    最新求助
      Advertisement Advertisement