PIC

USART

Firmware - Programmer

Hardware

PIN Descrtiption
1 RA2 Second pin on port A. Has no additional function
2 RA3 Third pin on port A. Has no additional function.
3 RA4 Fourth pin on port A. TOCK1 which functions as a timer is also found on this pin
4 MCLR Reset input and Vpp programming voltage of a microcontroller
5 Vss Ground of power supply.
6 RB0 Zero pin on port B. Interrupt input is an additional function.
7 RB1 First pin on port B. No additional function.
8 RB2 Second pin on port B. No additional function.
9 RB3 Third pin on port B. No additional function.
10 RB4 Fourth pin on port B. No additional function.
11 RB5 Fifth pin on port B. No additional function.
12 RB6 Sixth pin on port B. 'Clock' line in program mode.
13 RB7 Seventh pin on port B. 'Data' line in program mode.
14 Vdd Positive power supply pole.
15 OSC2 Pin assigned for connecting with an oscillator
16 OSC1 Pin assigned for connecting with an oscillator
17 RA2 Second pin on port A. No additional function
18 RA1 First pin on port A. No additional function.

Ports & Registers

Term “port” refers to a group of pins on a microcontroller which can be accessed simultaneously.

If the appropriate bit of TRIS register contains logical “1”, then that pin is an input pin, and if the opposite is true, it's an output pin. Every port has its proper TRIS register. Thus, port A has TRISA, and port B has TRISB.

Each PORTB pin has a weak internal pull-up resistor (resistor which defines a line to logic one) which can be activated by resetting the seventh bit RBPU in OPTION register.

Four pins PORTB, RB7:RB4 can cause an interrupt which occurs when their status changes from logical one into logical zero and opposite. Only pins configured as input can cause this interrupt to occur.

PIC internal Bus and Memory Architecture

PIC Assembly Language

Code Snipplets

// Update the CRC for transmitted and received data using
// the CCITT 16bit algorithm (X^16 + X^12 + X^5 + 1).
unsigned char ser_data;
static unsigned int crc;
crc = (unsigned char)(crc >> 8) | (crc << 8);
crc ^= ser_data;
crc ^= (unsigned char)(crc & 0xff) >> 4;
crc ^= (crc << 8) << 4;
crc ^= ((crc & 0xff) << 4) << 1;
 
wiki/pic/start.txt · Last modified: 26.02.2012 04:37 by rgareus