Download docx - Xay Dung Cac Ham Xu Li

Transcript

Goihttp://lib.tvu.edu.vn/index.php/luanvandaihoc/dien-dientuvienthong/519-thit-k-mch-iu-khin-thit-b-t-xa-bng-tin-nhn-sms.htmlhttp://codientu.org/threads/6585/page-3AT+CLIP=1//hien thi so goi denATD01692488645; //thuc hien cuoc goi ditnhanAT+CMGF=1 //mo che do truyen/nhan tin nhan+CMTI: "SM",18 //tin nhan den luu vao dia chi 18AT+CMGR=dia chi tin nhan //doc tin nhan denXU LI TIN NHAN CANH BAOInt8 tem;//CANH BAOTRUE {TEM=1; IF (TEM) { GCB TEM=0} OUT LED; }//CANH BAO NGUONNGUON MAT=0-> { TEMP=1; IF (TEMP

//modum gui pic+CMTI: "SM",1

+CMGR: "REC UNREAD","+841692488645","","15/05/30,15:40:23+28"BLchar buffer[90];int8 count;

KHOI TAO MODUM SIMvoid dong_bo(){lcd_send_byte(0,0x01);//xoa man hinhlcd_send_byte(0,0x08); //ep tro ve dong 1LCD_Putc ("Test modum sim ...");delay_ms(500);lcd_send_byte(0,0xc0);//ep tro ve dau dong 2LCD_Putc ("Dang Dong Bo ...");delay_ms(1000);printf("at\r\n");delay_ms(500);printf("at\r\n");delay_ms(500);printf("at\r\n");delay_ms(500);printf("at\r\n");delay_ms(500);printf("ate0\r\n");delay_ms(500);printf("at+cmgf=1\r\n");//cho phep gui, nhan tin nhandelay_ms(500);printf("at+cmgd=1\r\n");//xoa noi dung tin nhan tai ngan so 1delay_ms(500);}

HM NGT NHN TIN NHN:#INT_RDAvoid ngat(){buffer[count]=getc();count++;}KHAI BAO CHO PHEP NGATvoid main() { enable_interrupts(global); enable_interrupts(int_rda); }KIEM TRA TIN NHAN/CUOC GOI DEN MODUM SIMvoid kt_buffer(){d=count;for(i=0;i