ejemplos pic16f877 + proteus

6

Click here to load reader

Upload: hord72

Post on 19-Jan-2016

14 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Ejemplos PIC16F877 + Proteus

Ejemplos PIC16F877 +

Proteus Demo

Manuel Moreno Eguílaz

Marzo 2011

Page 2: Ejemplos PIC16F877 + Proteus

D[0

..1

5]

D0

D15D14

D13D12D11D10

D9D8

D7D6D5

D4D3D2D1

RA0/AN02

RA1/AN13

RA2/AN2/VREF-4

RA4/T0CKI6

RA5/AN4/SS7

RE0/AN5/RD8

RE1/AN6/WR9

RE2/AN7/CS10

OSC1/CLKIN13

OSC2/CLKOUT14

RC1/T1OSI/CCP216

RC2/CCP117

RC3/SCK/SCL18

RD0/PSP019

RD1/PSP120

RB7/PGD40

RB6/PGC39

RB538

RB437

RB3/PGM36

RB235

RB134

RB0/INT33

RD7/PSP730

RD6/PSP629

RD5/PSP528

RD4/PSP427

RD3/PSP322

RD2/PSP221

RC7/RX/DT26

RC6/TX/CK25

RC5/SDO24

RC4/SDI/SDA23

RA3/AN3/VREF+5

RC0/T1OSO/T1CKI15

MCLR/Vpp/THV1

U1

PIC16877

VDD

D03

Q02

D14

Q15

D27

Q26

D38

Q39

D413

Q412

D514

Q515

D617

Q616

D718

Q719

OE1

LE11

U2

74LS373

D03

Q02

D14

Q15

D27

Q26

D38

Q39

D413

Q412

D514

Q515

D617

Q616

D718

Q719

OE1

LE11

U3

74LS373

D[0..15]

+5V

VSS

Volts

+88.8

Volts

+88.8

mA

+88.8

This sample shows the functioning of the a single ADC channel of the PIC16877

microcontroller.

A potential divider is used to splot a 10V reference with the voltage being applied

to the ADC channel 0. The PIC continually samples the voltage and displays the

value on the 7-segment displays. Values are displayed are in hexadecimal and,

as the PIC's ADC is 10-bit, range from 0x0000 to 0x03FF (1023 decimal).

To experiment with the design, press the "Play" button to run the simulation

and then click on the up/down controls next to the potentiometer to adjust

its value.

E l e c t r o n i c s

Labcenter Electronics, 53-55 Main Street, Grassington, North Yorkshire, BD23 5AA

Fax: +44 (0)1756 752857 Tel: +44 (0)1756 753440

Email: [email protected] http://www.labcenter.co.uk/WWW:

PIC16877 ADC Sample

PIC16877 ADC Sample

50%

RV1

1k

PIC ADC Sample / DEMOProcesador: PIC16F877

Page 3: Ejemplos PIC16F877 + Proteus

Metodología

• Crear un proyecto, seleccionando PIC correspondiente (PIC16F877).

• Añadir archivo fuente (*.C).

• Compilar.

• Activar Proteus desde el MPLAB-> Debugger->Select Tool->Proteus VSM.

• Cargar arhivo (*.DSN) con el esquemático.

• Doble Click sobre el procesador PIC y escoger el archivo ejecutable (*.HEX)

• Activar simulación y simular.

Page 4: Ejemplos PIC16F877 + Proteus

Ejemplo 4a (main_4a.c)Utilización del conversor A/D

Función para configurar Conversor A/D

Función de Lectura del conversor A/D

Salida por Displays 7 segmentos

Inicializar conversor A/D

Lectura Conversor -> 10 bits

Configuración de puertos!!!

Page 5: Ejemplos PIC16F877 + Proteus

Ejemplo 4b (main_4b.c)Utilización del conversor A/D

Lectura Conversor -> 10 bits

Conversión a mV y utilización

de la función sprintf para obtener

los dígitos decimales que deben aparecer

por los displays.

Page 6: Ejemplos PIC16F877 + Proteus

Ejemplo 4c (main_4c.c)Utilización del conversor A/D

Lectura Conversor -> 10 bits

Otra alternativa para calcular

los dígitos decimales de la conversión a mV.