Sponsored Links .......................................................................................................................................................
................................................................................................................................................................................................
Experiment 2. Input & Output on Port A
The Experiment 2 we will test Port A is both Input and Output . Assemble circuit as figure 2.1 and Download Program to PIC16F628
 

 
Figure 2.1 schematic for Experiment 2 Input & Output on Port A
Assemble circuit as figure 2.1 and Down load Programming to PIC16F628
 
Source Code For Experiment 2
list p=16f628 ; list directive to define processor
#include <p16f628.inc> ; processor specific variable definitions
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON & _XT_OSC & _MCLRE_ON & _LVP_OFF
org 0x000
clrf PORTA ; Initial POR TA
; output data latches
movlw 0x07 ; Turn Comparator off and
movwf CMCON ; Enable pins for I/O
bsf STATUS,RP0 ; Select Bank 1
movlw b'11111111' ; All PORTA = Input
movwf PORTA ;
bcf STATUS,RP0 ; Return to Bank 0
btfsc PORTA,0 ; Test Switch Press ?
goto $-1 ; If Not Press Loop
bsf STATUS,RP0 ; If Press Set RA0 = Output
bcf PORTA,0 ; TRISA
bcf STATUS,RP0 ; Return To Bank 0
bcf PORTA,0 ; RA0 = 0 LED "ON"
goto $
END ; end of program'
From The Source Code we can be explain by flowchart as figure 2.2
Figure 2.2 Flowchart of Experiment 2
Tools & Components
 
Name List
Quantity
MPLAB
-
PIC16F628
1
4 MHz Crystal
1
LED
1
Push Button Switch 1 PC
2
33 pF Capacitors
2
4.7K Resistors
1
1K Resistors
1
Resources ,Tools & Related
 
Download Source Code Ex2
Download Source Code of Experiment 2. Input & Output on Port A
Download Hardware of PIC16F628
FLASH-Based 8-Bit CMOS Microcontroller
Download MPLAB IDE Version 6.61

Simulation Program of PIC Microchip

 
ICProg Version 1.05F

This software package allows you to program all types of serial programmable Integrated Circuits using Windows 95/98/NT/2000/ME/XP

www.ic-prog.com
Microcontroller Tools
................................................................................................................................................................................................

Copyright 2008 www.electronics-microcontroller.com