Selecting the type of port pins
Before you start playing with the port pins, you should declare their type. Each one can be Input or Output. for selecting a pin as output you should clear it's respective TRIS bit for example if you want that pin3(RB2) of PortB act as output so you should clear TRISB.2 using
Command in Basic Language:
LOW TRISB.2
Command in C Language:
TRISB2_bit = 0; or TRISB &= ~(1 << RB2)
Similarly for selecting a pin as input you should Set it's respective TRIS bit for example if you want that pin4(RB3) of PortB act as output so you should SET TRISB.3 using
Command in Basic Language:
HIGH TRISB.3
Command in C Language:
TRISB3_bit = 1; or TRISB |= (1 << RB3)
Software Downloads
- PROTON IDE For Programming in Basic Language
- MicroC Pro For PIC For Programming in C Language
Task
1) Get Data From Port C And Display on PortB
Schematic
No comments:
Post a Comment