![]() |
|
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 |
|
|
#9 |
|
Đệ 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. |
|
|
|
|
|