PIC Vietnam

Go Back   PIC Vietnam > Microchip PIC > Cơ bản về vi điều khiển và PIC

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

Cơ bản về vi điều khiển và PIC Những bài hướng dẫn cơ bản nhất để làm quen với vi điều khiển PIC

 
 
Ðiều Chỉnh Xếp Bài
Prev Previous Post   Next Post Next
Old 16-05-2010, 11:00 AM   #1
xkshut
Nhập môn đệ tử
 
Tham gia ngày: May 2010
Bài gửi: 2
:
HELP!!! mạch đo nhiệt độ dùng pic16f

các bác giúp em với,em đang làm mạch đo nhiệt độ dùng pic16f và lm335,em mô phỏng trên proteus 75SP3 mà nó báo 2 lỗi là :
1.Bad HEX File Format
The program file is not a valid Intel HEX file, is corrupted or else the file format contains non-standard extensions which are not recognized by Proteus VSM.
Check that the program file is actually an Intel HEX file. If you are sure that it is, please contact technical support for assistance.
2.Real time simulation failed to start.
Em làm mạch theo hướng dẫn đây http://www.scribd.com/doc/17108787/L...o-PIc-Bang-CSS phần code của em đây :
//================================================= =======
// Ten chuong trinh : Mach do nhiet do
// Nguoi thuc hien : xkshut
// Ngay thuc hien : 16/05/2010
// Phien ban : 1.0
// Mo ta phan cung : Dung PIC16F877A - thach anh 20MHz
// : LCD giao tiep voi PORTD
// : Dau ra LM335 dua vao chan AN0
//----------------------------------------------------------------
// Ngay hoan thanh : 16/05/2010
// Ngay kiem tra : 16/05/2010
// Nguoi kiem tra : xkshut
//----------------------------------------------------------------
// Chu thich : hoac cac chu thich khac
// : dung che do Power On Reset
// : chuong trinh viet cho PIC Tutorial
//================================================= =======
#include <16F877A.h>
#include <def_877a.h>
#device *=16 adc=10
#FUSES NOWDT, HS, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT,
NOLVP, NOCPD, NOWRT
#use delay(clock=20000000)
#use rs232(baud=115200,parity=N,xmit=PIN_C6,rcv=PIN_C7, bits=9)
#include <lcd_lib_4bit.c> // Thu vien ham cho LCD
int8 low,high,key,mode,min,max,mode1,i;
int1 do_F;
void convert_bcd(int8 x);
void bao_dong();
void test();
//-----------------------------------------------------------------
void main()
{
float value;
on_off =1;
min =15; //nhiet do min default
max =35; //nhiet do max default
do_F =0 ;
i = 50 ;
mode =0 ;
mode1 = 0 ;
trisa = 0xFF;
trisb = 0x01;
trisd = 0x00;
LCD_init();
Printf(LCD_putchar,"Lop DT8 - BKHN");
LCD_putcmd(0xC0);
Printf(LCD_putchar,"Khoi tao...");
// Khoi tao cho ngat ngoai
enable_interrupts (INT_EXT);
ext_int_edge(H_TO_L);
enable_interrupts (GLOBAL);
// Khoi tao che do cho bo ADC
setup_adc_ports(AN0);
setup_adc(ADC_CLOCK_INTERNAL);
delay_us(10);
// Lay mau nhiet do lan dau tien
value=(float)read_adc();
value = (value - 558.5)/2.048; // For 5V supply
// value = (value - 754.8)/2.048; // For 3.7V Supply
// value = (value - 698.2)/2.048; // For 4V supply
convert_bcd((int8)value); // Tach so tram, chuc, donvi de hien thi len LED 7
delay_ms(1000);
LCD_putcmd(0xC0);
Printf(LCD_putchar,"Khoi tao xong");
while(1)
{
if (i==50)
{
value = read_adc();
value=(value-558.5)/2.048;
if (do_F==1) value=1.8*value+32;
convert_bcd((int8)value);
printf("\n\rNhiet do phong: %u",value);// Gui gia tri len may tinh
LCD_putcmd(0xC0);
printf(LCD_putchar," Temp = ");
LCD_putchar(high); LCD_putchar(low);
if (do_F==0) printf(LCD_putchar," C");
else printf(LCD_putchar," F");
i=0;
}
i++;
if(((int8)value > 40) || ((int8)value < 15)) on_off=1;
else
{
on_off = 0;
LCD_Putcmd(0xCF);
LCD_putchar(" ");
blink=0;
}
if (on_off==1)
{
if (blink==0) {
LCD_Putcmd(0xCF);LCD_putchar("!");blink=1;delay_ms (250);}
else {LCD_Putcmd(0xCF);LCD_putchar(" ");blink=0;delay_ms(250);}
}
}
}//end main-----------------------------------------------------------
#INT_EXT
void test()
{
if (do_F == 1) do_F=0;
else do_F=1;
}
void convert_bcd(int8 x)
{
low=x%10; //chia lay phan du, so hang don vi
high=x/10; //tach hang tram va hang chuc
low = low + 0x30;
high = high + 0x30;
}
void bao_dong(){
int8 i;
if (blink == 0) blink = 1;
else blink=0;
for(i=0;i<50;i++)
{
LCD_Putcmd(0xCF);
if (blink==0) LCD_putchar("!");
else LCD_putchar(" ");
}
}

Mong các bác giúp em !
xkshut 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à 08:31 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