[$is_event_jimu] 0 [$group] 输入-带去抖动 [$group_e] IO事件库 [$last_ver_update_time] 2021-04-03 [$min_need_ver] 1.23 [$p_list] [$short_show_UIname] [$code_area_type] codes,exe_per_1ms,init_code [$blocks_type] line [$name] 4路按钮 [$thread_do] [$cs] [$cs_sim] API_funcs_for_sim.alert_to_js_tishi_cannot_sim_this_ele_with_ret(p_item1_ref , "带抖动的读IO积木(请用普通读IO积木)") [$function_ref_define_in_headfile] @@file=qudoudong.h void thread_IO1_t_$rnd_varname_pre$(); extern volatile unsigned char IO_state_cur_$rnd_varname_pre$; [$init_code_for_define_area] @@file=qudoudong.c #define max_lvbo_count_$rnd_varname_pre$ [($_xgm$qudong_time),type=num] #define IOin_$rnd_varname_pre$ [($_xgm$pin1_in),type=pin] volatile unsigned char IO_state_cur_$rnd_varname_pre$; signed short IO_state_ccc_$rnd_varname_pre$; void thread_IO1_t_$rnd_varname_pre$(){ if(IO_Read(IOin_$rnd_varname_pre$)==1){ if(IO_state_ccc_$rnd_varname_pre$<=max_lvbo_count_$rnd_varname_pre$){ IO_state_ccc_$rnd_varname_pre$++; } }else{ if(IO_state_ccc_$rnd_varname_pre$>=((-1)*max_lvbo_count_$rnd_varname_pre$)){ IO_state_ccc_$rnd_varname_pre$--; } } if(IO_state_ccc_$rnd_varname_pre$>=(max_lvbo_count_$rnd_varname_pre$-1)){ IO_state_cur_$rnd_varname_pre$=1; } if(IO_state_ccc_$rnd_varname_pre$<=((-1)*max_lvbo_count_$rnd_varname_pre$ + 1)){ IO_state_cur_$rnd_varname_pre$=0; } } [$init_code_for_define_area_sim] [$init_code_for_init_val] #get_P口_to_PxM1_PxM0_set_code(group_xml,rand1,block_name,ref_complier,extinfo,"[($_xgm$pin1_in),type=pin]","0","去抖动输入IO")% IO_Write([($_xgm$pin1_in),type=pin],1); IO_state_cur_$rnd_varname_pre$=1; [$init_code_for_init_val_sim] [$timer0_1ms_code] thread_IO1_t_$rnd_varname_pre$();//虚拟线程,不能含阻塞执行的部分,每1ms执行一次 [$toolbox_block_code] [$replace_map] $_xgm$pin1_in = $field$pin1_in ,mytype|pin, ptype|TIMES $_xgm$qudong_time = $field$qudong_time ,mytype|num, ptype|TIMES