Saturday, 20 October 2012

Ports and Airports

So we've discovered (by reading the 16F690 data sheet) that file 7 is also known as PORTC and that it's one of the special function registers. Files and registers are pretty much the same thing.

Like sea ports or airports, PIC ports are gateways to the outside world. On the 16F690, PORTC is an 8-bit port. Each of the 8 bits is connected to a pin (those sharp metal spiky things) on the outside of the chip. And on the Low Pin Count Demo Board, four of the pins are connected to red LEDs mounted on the board.

Time to look at another data sheet. Download the data sheet for the Low Pin Count Demo Board User's Guide (dated 2005). Find the LPC Demo Board Overview (section 1.4 on my data sheet) and scroll down to Figure 1-1 LPC DEMO BOARD.

You can see from this image (click it to enlarge it) that RC0, RC1, RC2 and RC3 are connected via copper tracks to the four LEDs. The lower four bits of PORTC have LEDs connected to them and if certain conditions are met, setting one of these bits will light the LED.

It should be starting to make sense now why setting bit 0 of file 7 (PORTC) makes LED DS1 light up.

No comments:

Post a Comment