PIC Vietnam

Go Back   PIC Vietnam > Microchip PIC > PIC - Thiết kế và Ứng dụng

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

PIC - Thiết kế và Ứng dụng Ý tưởng cho các sản phẩm sử dụng PIC/dsPIC và các sản phẩm của Microchip

 
 
Ðiều Chỉnh Xếp Bài
Prev Previous Post   Next Post Next
Old 13-07-2009, 11:58 AM   #5
huongngoclan
Nhập môn đệ tử
 
Tham gia ngày: Sep 2006
Bài gửi: 1
:
Red face giao tiếp MT8880 với pic6f887a

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();
}
huongngoclan vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
 


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à 01:46 AM.


Đượ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