 |
| Experiment 1. Test Port A Bit 0 ON LED |
|
|
|
|
|
|
| First Experiment we will test Port RA by on RA0 that connect to LED the schematic for Experiment 1is shown below in Figure 1 |
|
|
|
|
|
|
Figure 1.1 schematic for Experiment 1Test ON LED ON Port A Bit 0 |
Assemble circuit as figure 1.1 and load Programming to PIC16F628 after that on power supply you will see result it |
|
 |
| Source Code For Experiment 1 |
|
|
|
|
|
|
| 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 PORT A |
|
|
; output data latches |
| movlw |
0x07 |
; Turn Comparator off and |
| movwf |
CMCON |
; Enable pins for I/O |
| bsf |
STATUS,RP0 |
; Select Bank 1 |
| movlw |
b'11111110' |
; All PORTA = Input |
| movwf |
PORTA |
; RA0 = Output |
| bcf |
STATUS,RP0 |
; Return to Bank 0 |
| bcf |
PORTA,0 |
; RA0 = 0 LED "ON" |
| goto |
$ |
|
|
|
|
| END |
|
; end of program' |
|
|
|
|
|
|
|
| Name List |
Quantity |
MPLAB |
- |
PIC16F628 |
1 |
4 MHz Crystal |
1 |
LED |
1 |
33 pF Capacitors |
2 |
1K Resistors |
1 |
4.7K Resistors |
1 |
Push Button Switch |
1 |
|
|
|
|
|
|
|
|
|
|
| Resources ,Tools & Related |
|
|
|
|
|
|
|
|
|
|