[$is_event_jimu] 2 [$group_e] 元件事件库.串口通信积木 [$group] 元件库-通信器.$pname$ [$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] 串口的初始化积木 [$引脚占用列表,用于提示冲突] [$寄存器占用列表,用于提示冲突,但=>后的值没变则不提示冲突] [$中断函数号占用列表,用于提示冲突] [$shared_func_In_main_c] @@check_func_is_exist_ed=float2char_003 #get_global_codes(group_xml,rand1,block_name,ref_complier,extinfo,"float2char_003","float2char",true,"","","","")% ------use=funs_spliter_ruan--------------------- @@check_func_is_exist_ed=itoa_nouse_intrr #get_global_codes(group_xml,rand1,block_name,ref_complier,extinfo,"itoa_no_use_intreup","itoa_nouse_intrr",true,"","","","")% [$interrupt_1] [$thread_do] [$cs] [$function_ref_define_in_headfile] @@file=uart1.h #include "main.h" #include "usart_Lib.h" #include "protothread.h" #include "app_process.h" #include "sys/timer.h" #include "Extline_Lib.h" #include "Lib_base.h" //考虑PROCESS2_WAIT_UNTIL宏 char set_RE_pin_$rnd_varname_pre$(struct pt *process_pt,unsigned char is_Send ); [$init_code_for_define_area_once] @@file=uart1.c [$init_code_for_define_area] @@file=uart1.c #include "protothread.h" #include "app_process.h" #include "sys/timer.h" #include "Extline_Lib.h" #include "Lib_base.h" //考虑PROCESS2_WAIT_UNTIL宏 struct timer timer_csb2_$rnd_varname_pre$; char set_RE_pin_$rnd_varname_pre$(struct pt *process_pt,unsigned char is_Send ){ PT_BEGIN(process_pt); if(is_Send==1){ IO_Write([($_xgm$RE),type=pin] ,1) ; for(int ii=0;ii<99;ii++){;} } if(is_Send==0){ timer_set2(&timer_csb2_$rnd_varname_pre$, 100 );//单位:10us timer_restart2(&timer_csb2_$rnd_varname_pre$); PROCESS2_WAIT_UNTIL(process_pt , timer_expired2(&timer_csb2_$rnd_varname_pre$)!=0); //for(int ii=0;ii<4444;ii++){;}//至少延时4444,1444不行 IO_Write([($_xgm$RE),type=pin] ,0) ; } PT_END(process_pt); } [$init_code_for_init_val] TT_init_usart([($_xgm$dev_no),type=num],[($_xgm$brt),type=num],[($_xgm$jiaoyan),type=num],[($_xgm$recv_timeout),type=num],0,[($_xgm$RE),type=pin]); [$init_code_for_init_val_sim] API_funcs_for_sim.alert_to_js_tishi_cannot_sim_this_ele(p_item1_ref , "串口积木"); [$timer0_1ms_code] [$toolbox_block_code] 串口1引脚:PA9,PA10,串口2引脚:PA2,PA3,串口3引脚:PB10,PB11 串口4引脚:PC10,PC11,串口5引脚:PD12,PD2 5 9600 [$replace_map] $_xgm$dev_no = $field$dev_no,mytype|num, ptype|TIMES $_xgm$jiaoyan = $field$jiaoyan,mytype|num, ptype|TIMES $_xgm$brt = $field$brt,mytype|num, ptype|TIMES $_xgm$recv_timeout = $value$recv_timeout,mytype|num, ptype|TIMES $_xgm$RE = $field$RE,mytype|pin, ptype|TIMES