PIC Vietnam

Go Back   PIC Vietnam > Microchip PIC > dsPIC - Bộ điều khiển tín hiệu số 16-bit

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

dsPIC - Bộ điều khiển tín hiệu số 16-bit Theo dự kiến của Microchip, vào khoảng năm 2011 dsPIC sẽ có doanh số lớn hơn PIC

Trả lời
 
Ðiều Chỉnh Xếp Bài
Old 09-10-2008, 09:26 PM   #1
tungnh
Đệ tử 5 túi
 
Tham gia ngày: Sep 2007
Bài gửi: 94
:
Bác cho em hỏi thêm : Những cảnh báo sau co "nguy hiểm" không bác :
Code:
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c: In function '_INT0Interrupt':
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c:860: warning:  PSV model not specified for '_INT0Interrupt';
   assuming 'auto_psv' this may affect latency
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c: In function '_INT1Interrupt':
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c:868: warning:  PSV model not specified for '_INT1Interrupt';
   assuming 'auto_psv' this may affect latency
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c: In function '_INT2Interrupt':
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c:878: warning:  PSV model not specified for '_INT2Interrupt';
   assuming 'auto_psv' this may affect latency
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c: In function '_ADCInterrupt':
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c:883: warning:  PSV model not specified for '_ADCInterrupt';
   assuming 'auto_psv' this may affect latency
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c: In function '_T1Interrupt':
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c:887: warning:  PSV model not specified for '_T1Interrupt';
   assuming 'auto_psv' this may affect latency
tungnh vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
Old 09-10-2008, 11:26 PM   #2
namqn
Trưởng lão PIC bang
 
Tham gia ngày: Feb 2006
Nơi Cư Ngụ: Tp. HCM, Việt Nam
Bài gửi: 3,025
:
Send a message via Yahoo to namqn
Trích:
Nguyên văn bởi tungnh View Post
Bác cho em hỏi thêm : Những cảnh báo sau co "nguy hiểm" không bác :
Code:
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c: In function '_INT0Interrupt':
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c:860: warning:  PSV model not specified for '_INT0Interrupt';
   assuming 'auto_psv' this may affect latency
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c: In function '_INT1Interrupt':
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c:868: warning:  PSV model not specified for '_INT1Interrupt';
   assuming 'auto_psv' this may affect latency
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c: In function '_INT2Interrupt':
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c:878: warning:  PSV model not specified for '_INT2Interrupt';
   assuming 'auto_psv' this may affect latency
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c: In function '_ADCInterrupt':
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c:883: warning:  PSV model not specified for '_ADCInterrupt';
   assuming 'auto_psv' this may affect latency
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c: In function '_T1Interrupt':
C:\Documents and Settings\Lenovo\Desktop\lonhiet.c:887: warning:  PSV model not specified for '_T1Interrupt';
   assuming 'auto_psv' this may affect latency
Những cảnh báo trên chỉ nhắc nhở rằng bạn không chọn mô hình PSV cho các trình xử lý ngắt, do đó auto_psv sẽ được giả định. Những cảnh báo này không "nguy hiểm".

Thân,
__________________
Biển học mênh mông, sức người có hạn.

Đang gặp vấn đề cần được giúp đỡ? Hãy dành ra vài phút đọc luồng sau:
http://www.picvietnam.com/forum/showthread.php?t=1263
namqn vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
Old 10-10-2008, 12:57 AM   #3
tungnh
Đệ tử 5 túi
 
Tham gia ngày: Sep 2007
Bài gửi: 94
:
Anh ơi em viết hàm con hiển thị số dạng float ra màn hình cụ thể như sau :
Code:
void hienthi( float o, unsigned char a[15])
{
	LCD_cmd4(LCD_homeL1);			// ve dau dong thu 2
	Delay_ms(100);
	_PSV=1;
	PSVPAG = __builtin_psvpage(a);
	idx = 0;
	Delay_ms(50);
	while (a[idx]) {		//Xuat chuoi ra dong thu nhat cua LCD
	LCD_dat4(a[idx++]);
	Delay_ms(1);}
//////// Doi kieu float sang char/////////
  	 i=0;
  	l=0; 
	o=(o*1000)/10;
out=(long int)(o + 0.5);        
ra=out;
        while(out!=0)
            {
           in= (long int)( out%10);
           out=(long int)(out/10);
           i=i+1;
             }

           j=i-1;

          for (k=i;k!=0;k--)
            { 
             doi_mu(j);
             in=(long int)(ra/mu);
             ra=(long int)( ra%mu);
             doi_asci(in);
             s[l]=ch;
             j--;
             l++;
            }  

	LCD_cmd4(LCD_homeL2);			// ve dau dong thu 2
	Delay_ms(100);
		_PSV=1;
	PSVPAG = __builtin_psvpage(s);
	idx = 0;
	Delay_ms(50);
	while (s[idx]) {		//Xuat chuoi ra dong thu nhat cua LCD
	LCD_dat4(s[idx++]);
	Delay_ms(1);}
}
ở hàm main em viết
Code:
int main()
                {
                 init......
	hienthi(t_dat,chuoi1);
                 }
Em viết như vậy nó báo lỗi thế này ( con trỏ báo lỗi ở cuối hàm hienthi()) .
Code:
C:\Documents and Settings\Lenovo\Desktop\lonhiet2.c:183: warning: passing argument 2 of 'hienthi' discards qualifiers from pointer target type
C:\Documents and Settings\Lenovo\Desktop\lonhiet2.c: In function 'hienthi':
C:\Documents and Settings\Lenovo\Desktop\lonhiet2.c:497: internal compiler error: in instantiate_virtual_regs_lossage, at function.c:1442
Còn khi em không viết hàm con hienthi() mà đua thẳng vào hàm main thì nó không báo lỗi nữa ( nếu đưa thẳng vào hàm main thì chương trình sẽ rất dài ) Em sửa từ sáng đến giờ không biết sai ở đâu. ánh giúp em với ( xin lỗi anh vì em mới học nên hỏi hơi nhiều )

thay đổi nội dung bởi: tungnh, 10-10-2008 lúc 01:15 AM.
tungnh vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
Old 10-10-2008, 03:16 AM   #4
namqn
Trưởng lão PIC bang
 
Tham gia ngày: Feb 2006
Nơi Cư Ngụ: Tp. HCM, Việt Nam
Bài gửi: 3,025
:
Send a message via Yahoo to namqn
Không rõ a[] và s[] của bạn được khai báo ra sao. PSV chỉ dùng cho các hằng được lưu trong bộ nhớ chương trình hay trong EEPROM. Bạn không cần truyền con trỏ của các mảng này đến hàm hienthi() của bạn (cứ dùng chúng như mảng hằng toàn cục).

Lập trình cho PIC khác với lập trình cho máy tính nói chung, vì tài nguyên của PIC rất hạn chế. Theo tôi, cách thực hiện của bạn khá rối rắm.

Bạn có thể tham khảo các đoạn code C sau về chuyển dữ liệu nhị phân thành chuỗi ASCII, và phần code liên quan đến việc hiện thực phép chia cho 10:
http://www.piclist.com/techref/langu...onvertbase.htm

Thân,
__________________
Biển học mênh mông, sức người có hạn.

Đang gặp vấn đề cần được giúp đỡ? Hãy dành ra vài phút đọc luồng sau:
http://www.picvietnam.com/forum/showthread.php?t=1263
namqn vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn
Trả lờ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à 10:49 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