- •Л.А. Фролов
- •Л.А. Фролов
- •Введение
- •1. Основные понятия и определения
- •2. Общие методические указания к выполнению курсового проекта
- •3. Device Overview
- •4. Memory organization
- •4.1. Program memory organization
- •4.2. Data memory organization
- •4.2.1. General purpose register file
- •4.2.2. Special function registers
- •4.2.2.1. Status register
- •4.2.2.2. Option_reg register
- •4.2.2.3. Intcon register
- •4.3. Pcl and pclath
- •4.3.1. Computed goto
- •4.3.2. Stack
- •4.4. Program memory paging
- •5. I/o ports
- •5.1. Porta and the trisa register
- •5.2. Portb and the trisb register
- •5.3. Portc and the trisc register
- •6. Timer0 module
- •6.1. Timer0 interrupt
- •6.2. Using timer0 with an External Clock
- •6.3. Prescaler
- •7. Analog-to-digital converter (a/d) module
- •7.1. A/d Acquisition Requirements
- •7.2. Selecting the a/d Conversion Clock
- •7.3. Configuring Analog Port Pins
- •7.4. A/d Conversions
- •7.5. A/d result registers
- •7.6. A/d Operation During sleep
- •7.7. Effects of a reset
- •8. Interrupts
- •8.1. Int interrupt
- •8.2. Tmr0 interrupt
- •9. Instruction set
- •9.1. Instruction set summary
- •9.2. Instruction Descriptions
- •Список использованной литературы
- •Приложение a
- •620034, Екатеринбург, ул. Колмогорова, 66, УрГупс
5.3. Portc and the trisc register
PORTC is an 8-bit wide, bi-directional port. The corresponding data direction register is TRISC. Setting a TRISC bit (= 1) will make the corresponding PORTC pin an input (i.e., put the corresponding output driver in a Hi-Impedance mode). Clearing a TRISC bit (= 0) will make the corresponding PORTC pin an output (i.e., put the contents of the output latch on the selected pin).
PORTC is multiplexed with several peripheral functions (Table 5.5.). PORTC pins have Schmitt Trigger input buffers.
When the I2C module is enabled, the PORTC<4:3> pins can be configured with normal I2C levels, or with SMBus levels by using the CKE bit (SSPSTAT<6>).
When enabling peripheral functions, care should be taken in defining TRIS bits for each PORTC pin. Some peripherals override the TRIS bit to make a pin an output, while other peripherals override the TRIS bit to make a pin an input. Since the TRIS bit override is in effect while the peripheral is enabled, read-modifywrite instructions (BSF, BCF, XORWF) with TRISC as destination, should be avoided. The user should refer to the corresponding peripheral section for the correct TRIS bit settings.
Figure 5.5. PORTC block diagram (peripheral output override) RC<2:0>, RC<7:5>
Figure 5.6. PORTC block diagram (peripheral output) RC<4:3>
Table 5.5:
PORTC functions
Name |
Bit# |
Buffer Type |
Function |
RC0/T1OSO/T1CKI |
bit0 |
ST |
Input/output port pin or Timer1 oscillator output/Timer1 clock input. |
RC1/T1OSI/CCP2 |
bit1 |
ST |
Input/output port pin or Timer1 oscillator input or Capture2 input/ Compare2 output/PWM2 output. |
RC2/CCP1 |
bit2 |
ST |
Input/output port pin or Capture1 input/Compare1 output/ PWM1 output. |
RC3/SCK/SCL |
bit3 |
ST |
RC3 can also be the synchronous serial clock for both SPI and I2C modes. |
RC4/SDI/SDA |
bit4 |
ST |
RC4 can also be the SPI Data In (SPI mode) or data I/O (I2C mode). |
RC5/SDO |
bit5 |
ST |
Input/output port pin or Synchronous Serial Port data output. |
RC6/TX/CK |
bit6 |
ST |
Input/output port pin or USART Asynchronous Transmit or Synchronous Clock. |
RC7/RX/DT |
bit7 |
ST |
Input/output port pin or USART Asynchronous Receive or Synchronous Data. |
Legend: ST = Schmitt Trigger input
Table 5.6.
Summary of registers associated with PORTC
Address |
Name |
Bit 7 |
Bit 6 |
Bit 5 |
Bit 4 |
Bit 3 |
Bit 2 |
Bit 1 |
Bit 0 |
Value on: POR, BOR |
Value on all other RESETS |
07h |
PORTC |
RC7 |
RC6 |
RC5 |
RC4 |
RC3 |
RC2 |
RC1 |
RC0 |
xxxx xxxx |
uuuu uuuu |
87h |
TRISC |
PORTC Data Direction Register |
1111 1111 |
1111 1111 |
|||||||
Legend: x = unknown, u = unchanged
