PIC Vietnam

Go Back   PIC Vietnam > Microchip PIC > Chương trình dịch & các công cụ mô phỏng

Tài trợ cho PIC Vietnam
Trang chủ Đăng Kí Hỏi/Ðáp Thành Viên Lịch Tìm Kiếm Bài Trong Ngày Ðánh Dấu Ðã Ðọc Vi điều khiển

Chương trình dịch & các công cụ mô phỏng Khu vực này chỉ có thành viên diễn đàn mới được vào

 
 
Ðiều Chỉnh Xếp Bài
Prev Previous Post   Next Post Next
Old 13-11-2013, 06:40 PM   #5
cubom_sg
Nhập môn đệ tử
 
Tham gia ngày: Nov 2013
Bài gửi: 4
:
#include <16F877A.h>
#include <def_877a.h>
#include <string.h>
#FUSES NOWDT, HS, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT
#use delay(clock=20000000)
#use rs232(baud=4800,parity=N,xmit=PIN_C6,rcv=PIN_C7,bi ts=8)
#include <lcd_4bit.c> // file giao tiep LCD


#define tb1 RD0
#define tb2 RD1
#define tb3 RD2
#define tb4 RD3

#define PHONE_NUM " "

unsigned char str[60],str1[20],str2[20],str3[13];
char ch; int is1=0,is2=0,is3=0, is4=0;
int kt,is,isti,ngat,idex,idex1,index,index1; int ist=0,ist2=0;
//=============================================
#INT_RDA
Receive_isr()
{
ch = getc();

if(isti==1) //cho phep nhan khi da khoi tao thanh cong
{
if(ch==10 && index ==0) is=1; //bat dau cho phep nhan chuoi
if(ch==10 && index>0) {idex=index; ngat=1; isti = 2; } //KHI KET THUC MOT CHUOI
if(ch!=10 && ch!=13 && is == 1) { str[index] = ch; index++; }
}
if(isti==2) //cho phep nhan khi da khoi tao thanh cong
{
if(ch==10 && index1 ==0) is=1; //bat dau cho phep nhan chuoi
if(ch==10 && index1>0) {idex1=index1; ngat=2; isti = 0; } //KHI KET THUC MOT CHUOI
if(ch!=10 && ch!=13 && is == 1) { str1[index1] = ch; index1++; }
}
}

//------------
void send_sms()
{
putc('A'); putc('T'); putc('+'); putc('C'); putc('M'); putc('G'); putc('S'); putc('='); putc(34);
printf(PHONE_NUM); putc(34); putc(13); delay_ms(200);
putc(str3[0]); putc(str3[1]); putc(str3[2]); putc(str3[3]); putc(str3[4]); putc(str3[5]);
putc(str3[6]); putc(str3[7]); putc(str3[8]); putc(str3[9]); putc(str3[10]); putc(str3[11]); putc(26); putc(13); delay_ms(3000);
}
//----------------

int kiemtra()
{
int j,k;
for(j=0;j<idex;j++)
{
if(str2[0]==str[j])
{
for(k=0;k<Strlen(str2);k++)
{
if(str2[k] != str[j+k]) break;
}
if(k==strlen(str2)) { idex=0; index = 0; return 1; }
}
}
idex=0; index = 0; return 0;
}
//-------------------
int kiemtra1()
{
int j,k;
for(j=0;j<idex1;j++)
{
if(str2[0]==str1[j])
{
for(k=0;k<strlen(str2);k++)
{
if(str2[k] != str1[j+k]) break;
}
if(k==strlen(str2)) { return 1; }
}
}
return 0;
}


ccs cua e bi thieu file thu vien "lcd_lib_4bit1.c"
tren dien dan cung co cac file tuong tu nhu "lcd" , "lcd_4bit.c"
e da copy va past vao nhung van khong dich sang hex de nap chip duoc.
hinh nhu cac file trên thieu ham " LCD_putchar" va "LCD_putcmd".
bac nao co thu vien "lcd_lib_4bit1.c" cho e xin voi.
em chan thanh cam on>>>>>>>>>>
giai thich jum e doan chuong trinh tren.
mail: cubom_sg@yahoo.com.vn
cubom_sg vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
 

Ðiều Chỉnh
Xếp Bài

Quyền Sử Dụng Ở Diễn Ðàn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Smilies đang Mở
[IMG] đang Mở
HTML đang Tắt

Chuyển đến


Múi giờ GMT. Hiện tại là 09:58 PM.


Được sáng lập bởi Đoàn Hiệp
Powered by vBulletin®
Page copy protected against web site content infringement by Copyscape
Copyright © PIC Vietnam