![]() |
|
Tài trợ cho PIC Vietnam |
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 |
![]() |
|
Ðiều Chỉnh | Xếp Bài |
|
![]() |
#1 |
Đệ 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 |
![]() |
![]() |
![]() |
#2 | |
Trưởng lão PIC bang
|
Trích:
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 |
|
![]() |
![]() |
![]() |
#3 |
Đệ 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);} } Code:
int main() { init...... hienthi(t_dat,chuoi1); } 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 thay đổi nội dung bởi: tungnh, 10-10-2008 lúc 01:15 AM. |
![]() |
![]() |
![]() |
#4 |
Trưởng lão PIC bang
|
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 |
![]() |
![]() |
![]() |
|
|