![]() |
![]() |
#2 |
Đệ tử 3 túi
Tham gia ngày: Oct 2006
Bài gửi: 46
: |
Bạn chưa config cho portA, ko biết bạn dùng pic gì, bạn phải mắc thêm một điện trở kéo lên ở ra4. Chương trình của bạn mình thừ dùng cho pic16f877a sửa lại như sau:
Code:
void main() { ADCON1=0x06; //config porta thanh digital in/out PORTA = 0; // Initialize PORTA TRISA = 0; // Configure PORTA as output PORTB = 0; // Initialize PORTB TRISB = 0; // Configure PORTB as output PORTC = 0; // Initialize PORTC TRISC = 0; // Configure PORTC as output PORTD = 0; // Initialize PORTD TRISD = 0; // Configure PORTD as output while(1) { PORTA = ~PORTA; // toggle PORTA Delay_ms(1000); // one second delay PORTB = ~PORTB; // toggle PORTB Delay_ms(1000); // one second delay PORTC = ~PORTC; // toggle PORTC Delay_ms(1000); // one second delay PORTD = ~PORTD; // toggle PORTD Delay_ms(1000); // one second delay } }
__________________
http://www.hieunghia.info Lướt web thoải mái với USB3G của Viettel http://www.hieunghia.info/tin-cong-n...3g-vietel.html ----------------------------------------------------------------------------------- Một chút giận,hai chút tham,lận đận cả đời ri cũng khổ. Trăm điều lành,ngàn điều nhịn,thong dong tấc dạ rứa mà vui |
![]() |
![]() |
|
|