robotics and pic programming

1
PIC Microcontroller Device Device 16f877 Crystal Oscillator: Xtal 20 Port B as Output: 00000000 – PORTB.7 00000000 – PORTB.6 00000000 – PORTB.5 00000000 – PORTB.4 00000000 – PORTB.3 00000000 – PORTB.2 00000000 – PORTB.1 00000000 – PORTB.0 Command: TRISB = 00000000 Port B as Input: 11111111 – PORTB.7 11111111 – PORTB.6 11111111 – PORTB.5 11111111 – PORTB.4 11111111 – PORTB.3 11111111 – PORTB.2 11111111 – PORTB.1 11111111 – PORTB.0 Command: TRISB = 11111111 Combination: 00001111 – PORTB.7-PORTB.4 are set as output while PORTB.3-PORTB.0 are set as input Command: TRISB = 00001111 Others: All: Input PORTB - Set PORTB as Input Output PORTB - Set PORTB as Output Specific: Input PORTB.1 - Set PORTB.1 as Input Output PORTB.1 - Set PORTB.1 as Output

Upload: reynard-kevin-francisco

Post on 19-Nov-2015

5 views

Category:

Documents


2 download

DESCRIPTION

PIC microcontroller sample

TRANSCRIPT

PIC Microcontroller DeviceDevice 16f877

Crystal Oscillator:Xtal 20

Port B as Output: 00000000 PORTB.700000000 PORTB.600000000 PORTB.500000000 PORTB.400000000 PORTB.300000000 PORTB.200000000 PORTB.100000000 PORTB.0

Command: TRISB = 00000000

Port B as Input: 11111111 PORTB.711111111 PORTB.611111111 PORTB.511111111 PORTB.411111111 PORTB.311111111 PORTB.211111111 PORTB.111111111 PORTB.0

Command: TRISB = 11111111

Combination:00001111 PORTB.7-PORTB.4 are set as output while PORTB.3-PORTB.0 are set as inputCommand: TRISB = 00001111

Others:

All:Input PORTB-Set PORTB as InputOutput PORTB-Set PORTB as OutputSpecific:Input PORTB.1-Set PORTB.1 as InputOutput PORTB.1-Set PORTB.1 as Output