![]() |
|
Tài trợ cho PIC Vietnam |
||||||||
| Giao tiếp USB, CAN, I2C, SPI, USART... Những giao tiếp được tích hợp trên PIC |
|
|
Ðiều Chỉnh | Xếp Bài |
|
|
#11 |
|
Đệ tử 2 túi
Tham gia ngày: Nov 2008
Bài gửi: 45
: |
Code:
i=20;
while((command(0x40,0,0,0x95)!=1)&&(i>0)) { command(0x40,0,0,0x95);--i; }
if(i==0) return 1;
Code:
command(0x40,0,0,0x95);
i=100;
while(spi_read(0xFF)!= 0x01)
{
if(i== 0) return 1;
i--;
}
void command(int8 bef,long adrh,long adrl,int8 bes) Code:
{
spi_write(bef);
spi_write(make8(adrh,1));
spi_write(make8(adrh,0));
spi_write(make8(adrl,1));
spi_write(make8(adrh,0));
spi_write(bes);
}
thay đổi nội dung bởi: falleaf, 03-12-2008 lúc 12:43 PM. |
|
|
|
| Ðiều Chỉnh | |
| Xếp Bài | |
|
|