PIC16F684 Registers: Difference between revisions

From Mech
Jump to navigationJump to search
Content deleted Content added
Line 54: Line 54:
T2CON sets up Timer2, which is used for PWM timing.
T2CON sets up Timer2, which is used for PWM timing.
[[image:PIC register T2CON.png|center]]
[[image:PIC register T2CON.png|center]]

===A/D Configuration and Usage===

When configuring and using the ADC the following functions must be considered:
* Port configuration (ANSEL)
* Channel selection (ADCON0)
* ADC voltage reference selection (ADCON0)
* ADC conversion clock source (ADCON1)
* Interrupt control
* Results formatting (ADCON0)

====ADCON1====
[[image:PIC register ADCON0.png|center]]

====ADCON0====
[[image:PIC register ADCON1.png|center]]


====ADRESH====
ADRESH contains the highest significant digits of the A/D conversion. The values contained in this register depend on whether you select "Right Justified" (ADFM=1) or "Left Justified" (ADFM=0) results.

:'''Right Justified (ADFM=1):'''
[[image:PIC register ADRESHR.png|center]]

:'''Left Justified (ADMF=0):'''
[[image:PIC register ADRESHL.png|center]]

====ADRESL====
ADRESL contains the lowest significant digits of the A/D conversion. The values contained in this register depend on whether you select "Right Justified" (ADFM=1) or "Left Justified" (ADFM=0) results.

:'''Right Justified (ADFM=1):'''
[[image:PIC register ADRESLR.png|center]]

:'''Left Justified (ADMF=0):'''
[[image:PIC register ADRESLL.png|center]]

Revision as of 17:50, 10 July 2006

This page is a more detailed overview of the registers. It includes the most commonly used registers. All remaining information can be found on the Microchip website.

Memory Map

These images show the memory map of the PIC16F684. Use these for a quick reference for register addresses and initial values.

Registers in Memory Bank 0

Registers in Memory Bank 1

Register Descriptions

Configuration

STATUS

OPTION

INTCON

PIE1

The PIE1 is used to enable/disable interrupts.

I/O

PORTA

TRISA

ANSEL

The ANSEL register determines whether a pin, AN<7:0>, is an analog input or not.

IOCA

The IOCA register determines whether or not an interrupt is generated when a digital pin on PORTA, RA<5:0>, experiences a change in value.

PORTC

TRISC

Timers

T2CON

T2CON sets up Timer2, which is used for PWM timing.

A/D Configuration and Usage

When configuring and using the ADC the following functions must be considered:

  • Port configuration (ANSEL)
  • Channel selection (ADCON0)
  • ADC voltage reference selection (ADCON0)
  • ADC conversion clock source (ADCON1)
  • Interrupt control
  • Results formatting (ADCON0)

ADCON1

ADCON0


ADRESH

ADRESH contains the highest significant digits of the A/D conversion. The values contained in this register depend on whether you select "Right Justified" (ADFM=1) or "Left Justified" (ADFM=0) results.

Right Justified (ADFM=1):
Left Justified (ADMF=0):

ADRESL

ADRESL contains the lowest significant digits of the A/D conversion. The values contained in this register depend on whether you select "Right Justified" (ADFM=1) or "Left Justified" (ADFM=0) results.

Right Justified (ADFM=1):
Left Justified (ADMF=0):