[$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] [$name] LCD1602屏幕的初始化积木 [$引脚占用列表,用于提示冲突] [($_xgm$valueRS),type=pin]|1602积木里已占用引脚 [($_xgm$valueRW),type=pin]|1602积木里已占用引脚 [($_xgm$valueE),type=pin]|1602积木里已占用引脚 [($_xgm$valueD0),type=pin]|1602积木里已占用引脚 [($_xgm$valueD0),type=pin]|1602积木里已占用引脚 [$寄存器占用列表,用于提示冲突,但=>后的值没变则不提示冲突] [$中断函数号占用列表,用于提示冲突] [$thread_do] [$cs] [$shared_func_In_main_c] @@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,"","","","")% [$function_ref_define_in_headfile] @@file=lcd1602.h extern u8 tempstr_$rnd_varname_pre$[]; //---重定义关键词---// #ifndef uchar #define uchar unsigned char #endif #ifndef uint #define uint unsigned int #endif char LcdWriteData$rnd_varname_pre$(struct pt *process_pt,uchar dat); char LcdInit$rnd_varname_pre$(struct pt *process_pt,u8 inn); extern struct pt pt_init_$rnd_varname_pre$; extern u8 is_inited_lcd_$rnd_varname_pre$; char LCD1602_ShowNum$rnd_varname_pre$(struct pt *process_pt,u8 x, u8 y, long num); char LCD1602_Clear$rnd_varname_pre$(struct pt *process_pt,u8 inn); char LCD1602_SetCursor$rnd_varname_pre$(struct pt *process_pt,unsigned char x,unsigned char y); char LCD1602_ShowChar$rnd_varname_pre$(struct pt *process_pt,unsigned char xpos,unsigned char ypos,char xsz); char write_cg$rnd_varname_pre$(struct pt *process_pt,u8 cg_1602[],u16 cg_len,unsigned char xpos,unsigned char ypos,u8 cg_char_index); char LCD1602_ShowStr$rnd_varname_pre$(struct pt *process_pt,unsigned char xpos,unsigned char ypos,char *p); [$replace_map] $_xgm$valueRS = $field$RS,mytype|pin, ptype|TIMES $_xgm$valueRW = $field$RW,mytype|pin, ptype|TIMES $_xgm$valueE = $field$E,mytype|pin, ptype|TIMES $_xgm$valueD0 = $field$D0,mytype|pin, ptype|TIMES [$init_code_for_define_area] @@file=lcd1602.c #include "protothread.h" #include "app_process.h" #include "sys/timer.h" #include "Extline_Lib.h" #include "Lib_base.h" //考虑PROCESS2_WAIT_UNTIL宏 char* itoa_nouse_intrr(long num,char* str, u8 base); struct pt pt_init_$rnd_varname_pre$; void delay_ms1$rnd_varname_pre$(u32 todelays ){ u32 delay_ccc_; u16 delay_ccc2_; for(delay_ccc_=0;delay_ccc_1)return; while((*p22)!='\0') { call_PT_func( LCD1602_ShowChar$rnd_varname_pre$ , &pt_ss22_$rnd_varname_pre$ , xpos22++,ypos22,*p22++); PT_YIELD(process_pt); if(*p22=='\n') { xpos22=0; ypos22++; p22++; } } isok=1; PT_END(process_pt); } u8 temp1str$rnd_varname_pre$[12]; char LCD1602_ShowNum$rnd_varname_pre$(struct pt *process_pt,u8 x, u8 y, long num) { PT_BEGIN(process_pt); memset(temp1str$rnd_varname_pre$,'\0',10); itoa_nouse_intrr(num, temp1str$rnd_varname_pre$, 10);//比_itoa范围大 call_PT_func( LCD1602_ShowStr$rnd_varname_pre$ , &pt_ss_$rnd_varname_pre$ ,x,y,temp1str$rnd_varname_pre$); PT_END(process_pt); } [$init_code_for_define_area_once] @@file=lcd1602.c u8 tempstr_$rnd_varname_pre$[12]; /********************************** 当使用的是4位数据传输的时候定义, 使用8位取消这个定义 **********************************/ //#define LCD1602_4PINS //---重定义关键词---// #ifndef uchar #define uchar unsigned char #endif #ifndef uint #define uint unsigned int #endif [$init_code_for_init_val] is_inited_lcd_$rnd_varname_pre$=0; #get_P口_to_PxM1_PxM0_set_code(group_xml,rand1,block_name,ref_complier,extinfo,"[($_xgm$valueRS),type=pin]","1","1602 RS")% #get_P口_to_PxM1_PxM0_set_code(group_xml,rand1,block_name,ref_complier,extinfo,"[($_xgm$valueRW),type=pin]","1","1602 RW")% #get_P口_to_PxM1_PxM0_set_code(group_xml,rand1,block_name,ref_complier,extinfo,"[($_xgm$valueE),type=pin]","1","1602 E")% #get_P口_to_PxM1_PxM0_set_codePort(group_xml,rand1,block_name,ref_complier,extinfo,"[($_xgm$valueD0),type=pin]","1","255","1602 D0-7")% IO_Write( [($_xgm$valueE),type=pin] ,0) ; call_PT_func( LcdInit$rnd_varname_pre$ , &pt_init_$rnd_varname_pre$,0); [$timer0_1ms_code] [$run] [$toolbox_block_code]