PDA

View Full Version : giao tiếp giữa PIC6F877A và MT8880


nc2
05-11-2008, 10:43 PM
xin chào mọi người!
mình đang làm đề tài có liên quan tới con PIC 16F877A và con MT8880
với lại cũng mới học lập trình PIC nên có gặp chút rắc rối xung quanh vấn đề này!
Nếu có ai đã làm cái này hay cao thủ nào biết về vấn đề này xin chỉ giúp
cụ thể các vấn đề sau:
- muốn kiểm tra xem con MT còn sống hay đã chết thì làm thế nào
- viết chương trình (bằng C ) để lâý dữ liệu từ MT vào PIC thì làm thế nào?(có cần khởi tạo gì cho MT không--> vấn đề này xin vui lòng nói rõ giùm)
Giả sử sơ đồ mạch như mô tả sau:
- tín hiệu điện thoại vào = DTMF vao
- DTMF 0-->DTMF7 đưa vào portB
- IRQ đưa vào D0

thanks!

nc2
05-11-2008, 10:52 PM
đây là sơ dồ kết nối của MT8880 vào PIC

nc2
08-11-2008, 08:19 AM
sao không có ai tham gia vậy ta!!
huhuhu.... không biết nên làm sao?
mày mò hoài mà vẫn không được.
please help me!!!

falleaf
15-11-2008, 06:28 PM
http://hackedgadgets.com/2007/03/27/alarm-phone-dialer/

Xem toàn bộ tài liệu hướng dẫn ở đây.

Download phần source code để tham khảo ở đây: http://www.elektronika.ba/projekti/?akc=daj_projekt&idprojekt=7

Chúc vui

huongngoclan
13-07-2009, 11:58 AM
các cao thủ ơi giúp em với em đang làm đồ án liên quan đến mạng điện thoại cố định nhưng khi test phần cứng tạo tín hiệu DTMF không được. đây là chương trình quay số của em các cao thủ xem giúp em với sao em test mãi mà không ra được tín hiệu gì.
Khi em test phần cứng tại đầu vào biến áp âm tần kết nối với đường line thì có điện áp nhưng sau biến áp thì lại không có điện áp là sao? các cao thủ giúp em với.Em gửi cả sơ đồ phần cứng luôn các cao thủ xem giúp em với.


#include <16F877A.h>
#include <def_877a.h>
#FUSES NOWDT, HS, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT
#use delay(clock=20000000)
#DEFINE Q2 PIN_b7
#DEFINE CS PIN_b6
#DEFINE RS0 PIN_b5
#DEFINE RW PIN_b4
#DEFINE D3 PIN_b3
#DEFINE D2 PIN_b2
#define d1 pin_b1
#DEFINE D0 PIN_b0
#define bell pin_e2
#define pickup pin_e1
#define detect pin_e0
#define sensor pin_c3
void initMT8880();
void ngat();
void setup();
void khong();
void mot();
void hai();
void ba();
void bon();
void nam();
void sau();
void bay();
void tam();
void chin();
MAIN()
{
set_tris_b(0);
portb=0xff;
set_tris_e(0b101);
porte=0b101;
initMT8880();

while(1){
if (rc3==1){
output_high(pin_e1);
delay_ms(500);
khong();
delay_ms(500);
chin();
delay_ms(500);
tam();
delay_ms(500);
sau();
delay_ms(500);

}
}
}

void initMT8880()
{
delay_us (5000);
portb=0xFF;delay_us(200);
output_low(cs);
delay_us(200);
portb=0x60;delay_us(200);
output_low(cs);
output_high(q2);
delay_us(200);
portb=0x60;delay_us(200);
output_low(cs);
output_high(q2);
delay_us(200);
portb=0x68;delay_us(200);
output_low(cs);
output_high(q2);
delay_us(200);
portb=0x60;delay_us(200);
output_low(cs);
output_high(q2);
delay_us(200);
portb=0xFF;delay_us(200);
output_low(cs);
output_high(q2);
delay_us(200);
output_high(cs);
output_low(q2);
delay_us(200);
}

//================================================== ===================

void ngat()
{
portb=0xE2;
delay_us(200);
output_low(cs);
delay_us(7000);
output_high(cs);
output_low(q2);
delay_us(200);
}

//================================================== ===================

void setup()
{
portb=0xEB;
delay_us(200);
output_low(cs);
output_high(q2);
delay_us(200);
portb=0xE0;
delay_us(200);
output_low(cs);
output_high(q2);
delay_us(200);
output_high(cs);
output_low(q2);
delay_us(200);
}

//================================================== ===================

void khong()
{
setup();

portb=0xCA;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}
//================================================== ===================

void mot()
{
setup();

portb=0xC1;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}

//==================================================

void hai()
{
setup();

portb=0xC2;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}




//================================================== ===================

void ba()
{
setup();

portb=0xC3;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}
//================================================== ===================

void bon()
{
setup();

portb=0xC4;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}
//================================================== ===================

void nam()
{
setup();

portb=0xC5;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}
//================================================== ===================

void sau()
{
setup();

portb=0xC6;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}
//================================================== ===================

void bay()
{
setup();

portb=0xC7;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}
//================================================== ===================

void tam()
{
setup();

portb=0xC8;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}
//================================================== ===================

void chin()
{
setup();

portb=0xC9;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}

honest_man911
04-08-2009, 12:33 AM
ban co the giai thich ro hon 1 chut dc ko chu minh moi hoc con ga lam!

quangvt07
27-04-2010, 12:04 PM
http://hackedgadgets.com/2007/03/27/alarm-phone-dialer/

xem toàn bộ tài liệu hướng dẫn ở đây.

Download phần source code để tham khảo ở đây: http://www.elektronika.ba/projekti/?akc=daj_projekt&idprojekt=7

chúc vui

hihi minh tim hoai ma ko thay suỎce code dau het ban oi ban chi minh voi

quangvt07
27-04-2010, 12:04 PM
Hihi mt8880 phat dtmf can wa may buoc khoi tao

quangvt07
27-04-2010, 12:10 PM
các cao thủ ơi giúp em với em đang làm đồ án liên quan đến mạng điện thoại cố định nhưng khi test phần cứng tạo tín hiệu dtmf không được. đây là chương trình quay số của em các cao thủ xem giúp em với sao em test mãi mà không ra được tín hiệu gì.
Khi em test phần cứng tại đầu vào biến áp âm tần kết nối với đường line thì có điện áp nhưng sau biến áp thì lại không có điện áp là sao? Các cao thủ giúp em với.em gửi cả sơ đồ phần cứng luôn các cao thủ xem giúp em với.


#include <16f877a.h>
#include <def_877a.h>
#fuses nowdt, hs, noput, noprotect, nodebug, nobrownout, nolvp, nocpd, nowrt
#use delay(clock=20000000)
#define q2 pin_b7
#define cs pin_b6
#define rs0 pin_b5
#define rw pin_b4
#define d3 pin_b3
#define d2 pin_b2
#define d1 pin_b1
#define d0 pin_b0
#define bell pin_e2
#define pickup pin_e1
#define detect pin_e0
#define sensor pin_c3
void initmt8880();
void ngat();
void setup();
void khong();
void mot();
void hai();
void ba();
void bon();
void nam();
void sau();
void bay();
void tam();
void chin();
main()
{
set_tris_b(0);
portb=0xff;
set_tris_e(0b101);
porte=0b101;
initmt8880();

while(1){
if (rc3==1){
output_high(pin_e1);
delay_ms(500);
khong();
delay_ms(500);
chin();
delay_ms(500);
tam();
delay_ms(500);
sau();
delay_ms(500);

}
}
}

void initmt8880()
{
delay_us (5000);
portb=0xff;delay_us(200);
output_low(cs);
delay_us(200);
portb=0x60;delay_us(200);
output_low(cs);
output_high(q2);
delay_us(200);
portb=0x60;delay_us(200);
output_low(cs);
output_high(q2);
delay_us(200);
portb=0x68;delay_us(200);
output_low(cs);
output_high(q2);
delay_us(200);
portb=0x60;delay_us(200);
output_low(cs);
output_high(q2);
delay_us(200);
portb=0xff;delay_us(200);
output_low(cs);
output_high(q2);
delay_us(200);
output_high(cs);
output_low(q2);
delay_us(200);
}

//================================================== ===================

void ngat()
{
portb=0xe2;
delay_us(200);
output_low(cs);
delay_us(7000);
output_high(cs);
output_low(q2);
delay_us(200);
}

//================================================== ===================

void setup()
{
portb=0xeb;
delay_us(200);
output_low(cs);
output_high(q2);
delay_us(200);
portb=0xe0;
delay_us(200);
output_low(cs);
output_high(q2);
delay_us(200);
output_high(cs);
output_low(q2);
delay_us(200);
}

//================================================== ===================

void khong()
{
setup();

portb=0xca;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}
//================================================== ===================

void mot()
{
setup();

portb=0xc1;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}

//==================================================

void hai()
{
setup();

portb=0xc2;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}




//================================================== ===================

void ba()
{
setup();

portb=0xc3;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}
//================================================== ===================

void bon()
{
setup();

portb=0xc4;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}
//================================================== ===================

void nam()
{
setup();

portb=0xc5;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}
//================================================== ===================

void sau()
{
setup();

portb=0xc6;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}
//================================================== ===================

void bay()
{
setup();

portb=0xc7;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}
//================================================== ===================

void tam()
{
setup();

portb=0xc8;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}
//================================================== ===================

void chin()
{
setup();

portb=0xc9;
delay_us(200);
output_low(cs);
delay_us(15000);
output_high(cs);
delay_us(200);

ngat();
}

hihi ban thu gui hinh mat len moi nguoi se chi giup cho
ah ma chan cs hinh nhu la noi mass do

tancdctvt
06-11-2010, 10:48 AM
hix!minh lam de tai bao chay qua dien thoai ban cung lien quan den con nay ma chua hieu j het ca
do an minh nhu sau:
nhap ban phim-> hien thi lcd so dien thoai-> lưu vao bo nho pic-> khi co bao chay thi lay sdt trong bo nho ra-> kich mt8880 hoat dong phat so ma mnh da lưu-> tong dai goi toi so may minh da luu.
Day la mot de tai lon ai quan tam thi trao voi nhau nha!
sdt minh ne 01672887799