Nkhaniyi kuti musunthire kwambiri Diwen Developer Forum yopambana mphoto yotsegulira gwero - T5L-based smtp mail sender , akatswiri amagwiritsa ntchito T5L smart screen , kupyolera mu WiFi module kuti apeze seva ya smtp , kuti akwaniritse ntchito yotumiza maimelo kwa woyang'anira , ntchito ya chophimba kulowa imelo adiresi wolandira , imelo mutu, imelo zili ndi zina zambiri akhoza athandizira pa zenera. Ndizofunikira kudziwa kuti zomwe zili mu imelo zimathandiziranso zolemba zomveka, zowongolera masinthidwe, kuyika mtundu walemba ndi njira zina zosinthira.
1.Programme Architecture
T5L smart screen imayang'anira gawo la WiFi kuti lizilumikizana ndi seva ya smtp kudzera pa serial port 5 kuti mukwaniritse ntchito yotumiza maimelo.
![](https://ecdn6.globalso.com/upload/p/1355/source/2024-03/65f969e7ea32035860.png)
![awa (1)](https://ecdn6.globalso.com/upload/p/1355/source/2024-03/65f96bc1027de84836.jpg)
2.Chitukuko cha Interface
Pulogalamu ya DGUS imamaliza kupanga mawonekedwe owonetsera ndi kukhudza kudzera pakukweza kwa zigawo. Ogwiritsa ntchito amangofunika kukweza zithunzi zomwe zakonzedwa mu pulogalamu ya DGUS ndikukhazikitsa zowonetsera ndi kukhudza.
![awa (2)](https://ecdn6.globalso.com/upload/p/1355/source/2024-03/65f96bc23a89741572.jpg)
1. C51SzambiriDchizindikiro
T5L smart screen serial port 5 imalumikizana ndi gawo la WiFi kuti amalize kuyanjana ndi seva ya smtp. Gawo lalikulu la code ndi motere:
void uart5_init(u32 baud)
{
SCON3T = 0x80;
SCON3R = 0x80;
baud = (u32) ((kawiri)(FOSC/8.0)/baud);
BODE3_DIV_H = (wamba>>8)&0xff;
BODE3_DIV_L = zoipa&0xff;
ES3R = 0;
ES3T = 0;
}
opanda u5_send_byte(u8 byte)
{
SBUF3_TX = baiti;
pamene(!(SCON3T&0x01));
SCON3T &= 0xfe;
}
opanda u5_send_bytes(u8 *bytes,u16 len)
{
u16 ndi;
za(i=0;i
{
SBUF3_TX = mabayiti;
pamene(!(SCON3T&0x01));
SCON3T &= 0xfe;
}
}
void get_input(u8 * val, u8 len)
{
u8 ndi;
za(i=0;i
{
ngati (val==0xff)
{
ndi = 0x00;
vali[i+1] = 0x00;
kubwerera;
}
}
}
u8 esp8266_send_cmd(u8 *cmd,u8 *ack,u16 waittime,u8 clearBuffer)
{
u8 res=0;
rx_stay=0;
ngati (ack&&waittime&&cmd)
{
nthawi (--waittime)
{
sys_kuchedwa_ms(10);
ngati(rx_sta&0X8000)
{
ngati(esp8266_check_respond(ack))
kupuma;
}
}
ngati(waittime==0)res=1;
ngati(clearBuffer==1)rx_sta=0;
}
kubwereranso;
}
mtundu wa typedef{
ndi 8cmd;
u8 imelo[20];
u8 dzina[20];
u8 mutu[20];
u8 msg[60];
}EMAIL_INFO;
EMAIL_INFO imelo_info;
u8 kuyankha[80];
u8 wifi_name[30];
u8 wifi_passwd[30];
u8 seva[30];
u8 doko[30];
u8 dzina lolowera[30];
u8 auth_code[30];
u8 rx_stay;
sys_read_vp(0x1000,(u8*)&btn_val,1);
ngati (btn_val)
{
ngati(btn_val==1)
{
sys_read_vp(0x3000,email_info.name,10);
sys_read_vp(0x3020,email_info.email,10);
sys_read_vp(0x3040,email_info.title,10);
sys_read_vp(0x3060,email_info.msg,30);
get_input(email_info.name,20);
get_input(email_info.email,20);
get_input(email_info.title,20);
get_input(email_info.msg,60);
send_packet((u8*)&email_info,sizeof(EMAIL_INFO));
ngati (rx_sta)
send_mail(email_info.email, email_info.title, email_info.msg);
}mwina ngati(btn_val==2)
{
sys_read_vp(0x3100,wifi_name,15);
sys_read_vp(0x3120,wifi_passwd,15);
get_input(wifi_name,30);
get_input(wifi_passwd,30);
}mwina ngati(btn_val==3)
{
sys_read_vp(0x3200,seva,15);
sys_read_vp(0x3220,port,15);
sys_read_vp(0x3240,dzina,15);
sys_read_vp(0x3260,auth_code,15);
get_input(seva,30);
get_input(port,30);
get_input(dzina lolowera,30);
get_input(auth_code,30);
}
btn_val = 0;
sys_write_vp(0x1000,(u8*)&btn_val,1);
}
sys_read_vp(0x2050,(u8*)&btn_val2,1);
ngati(btn_val2!=val_val)
{
ngati(btn_val2==1)
sys_write_vp(0x3060,"Iyi ndi imelo yochokera ku T5L!\0\0",30);
ngati (btn_val2==2)
sys_write_vp(0x3060,"
\0\0,30);
ngati (btn_val2==3)
sys_write_vp(0x3060," Zolimba
Chofiira
\0\0,30);
old_val = btn_val2;
}
Nthawi yotumiza: Oct-31-2023