MikroElektronika PIC Microcontrollers PIC18 Uživatelský manuál Strana 31

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 88
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 30
Robotics experiment with PIC microcontroller l 31
Activity 1-1 LED testing
See the Figure A1-1, RB3 of PIC16F887 is connected to LED via current limited resistor
510. For turning-on this LED must send logic “1” to this port. and send logic “0” for turning-off.
A1.1.1 Write program following the Listing A1-1 then compile and download to RBX-877
V2.0 Robot Controller board. See the operation.
LED at RB3 on.
A1.1.2 Write program following the Listing A1-2 then compile and download to RBX-877
V2.0 Robot Controller board. See the operation.
LED at RB3 will blink with 0.5 second duration.
Figure A1-1 : LED connection on RBX-877 V2.0 Robot Controller board
21+$.&&%
!$
4*!
R9
510
LED3
4*!
void main()
{
TRISB.F3=0; // Set RB3 ==> Output
PORTB.F3=1; // Turn on RB3
}
Listing A1-1 : The C program for Turning on the RB3-LED of the RBX-877
V2.0 Robot Controller board
void main()
{
TRISB.F3=0; // Set RB3 ==> Output
while(1)
{
PORTB.F3=1; // Turn on RB3
Delay_ms(500);
PORTB.F3=0; // Turn off RB3
Delay_ms(500);
}
}
Listing A1-2 : The C program for Blinking the RB3-LED of the RBX-877 V2.0
Robot Controller board
Zobrazit stránku 30
1 2 ... 26 27 28 29 30 31 32 33 34 35 36 ... 87 88

Komentáře k této Příručce

Žádné komentáře