![]() |
|
Tài trợ cho PIC Vietnam |
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 |
|
![]() |
#1 |
Nhập môn đệ tử
Tham gia ngày: Feb 2013
Bài gửi: 1
: |
giúp e sửa lỗi đoạn code trên với...code báo sai chỗ void main :(
#include <16f877a.h>
#FUSES NOWDT, HS, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT #device ADC=10 #use delay(clock=200000000) #byte portb=0x06 #byte porta=0x05 #byte portd=0x08 #bit d0=portd.0 #bit d1=portd.1 #use fast_io(a) #use fast_io(b) #use fast_io(d) int8 const LED[]={0xc0,//0 0xc0,//0 0xf9,//1 0xa4,//2 0xb0,//3 0x99,//4 0x92,//5 0x83,//6 0xf8,//7 0x80,//8 0x98,//9 } void main() { int i; int8 x,read,hangchuc,hangdonvi; setup_adc(ADC_CLOCK_INTERNAL); setup_adc_ports(AN0_AN1_VREF_VREF); set_adc_channel(0); delay_us(10); while(1) { x= read_adc(); x= (int16) ((float)read_adc() * 500/1024); read=x; hangchuc=read/10; hangdonvi=read%10; for(i=0;i<=99;i++) { output_low(d0); output_b(LED[hangchuc]); delay_ms(10); output_low(d1); output_b(LED[hangdonvi]); delay_ms(10); } } } |
![]() |
![]() |
![]() |
|
|