Professional Documents
Culture Documents
الحلقة الثالثة
الحلقة الثالثة
. /
ahmad_s_f@hotmail.com
PIC
) RAM ( ROM
) ( UART EEPROM - PWM USB
..
. PORTA
. A0,A1,,A7 ,
:
PIC16F628A
. PIC16F84A
) ( :
-1 OSCILLATOR
.
-2 PWM
DC
.
-3 PIC16F84A RAM . ROM
-4 UART RS232
.
, !!.
PIC16F84a
PIC
PIC16f84a
PIC16f628a PIC16f84a ,
.... ,
, PIC16f628a
PIC16f84a
PIC16f84a !!.. .
PIC16F628a :
)(void main
;{trisb=0
)while(1
;){ portb=0; delay_ms(500
;)Portb=0xff; delay_ms(500
}
}
ISIS PROTEUS !!
portb .
!! yeees yes
!! ) ( !!.. ) !! ( ) !!..
( ) ( !! ..
12 ,
.. !!. LEDs
A0,A1,A2,A3 :
PIC
)(void main
;{trisb=0; trisa=0
)while(1
;){ portb=0; porta=0; delay_ms(500
;)Portb=0xff; porta=0xff; delay_ms(500
}
}
portb porta
) , ( !!..
, , .
, )
( .
; CMCON=0x07
porta .PIC16f84a
PIC
pic16f628a
; . CMCON=0x07 porta
digital
.
:
PIC16f628a
PIC , PIC16f84a
) .
!!.. ( ..
: .
,
,
PIC16877a
.. PIC16f628a
5
PIC
PIC16f628a
pin diagram
PIC16f627a,PIC16f628a,PIC16f648
.
16 15 . OSC1 , OSC2
PIC16f84a
PIC
PIC16f628a A6,A7 .
PIC
. TRISA
PIC16f84a A6,A7 porta
. A0,A1,A2,A3,A4
PIC16f628a .
:
!!.. !!..
.
PIC16f628a
Default HS_OSC
INTOSC_OSC_NOCLKOUT :
PIC
:
Pic16f628a
:
4Mhz
:
INTOSC_OSC_NOCLKOUT
Default
Project Edit project .
INTOSC_OSC
) ( .
MikroC 8.2
MikroC MikroC Pro v3.8
:
PIC
INTOSC:I/O on RA6 .. , I/o on RA7.
PIC
MCLRE_OFF
MikroC 8.2
Disable Master Clear
MikroC PRO
10
PIC
) : (1 pic16f628a
.
) ( .... 14
15
!! .. (.
. PIC16f877a
..
.
,
.
,, .
.
,,
11
PIC
:
,
,
embedded system ,
pic16f84a
pic16f877a
PIC
ANALOG TO DIGITAL CONVERTER ,
33
).(33 I/O pins
pic16f877a
VDD
VSS :
32 31 11 12
, VDD VSS ,
, portb
12
PIC
) PIC ( 3132
, , 31
32 12 , 11 .
VDD ) ( 32
VSS ) ( 12 .....
.
...
PCB
.
VSS ) (31 VDD
) (11 , .. ,
PIC !!..
, ... ..
... .. !! ... , !!.. PIC PIC
) 30 25 = 6-5 ( .
" "
: .. !!.
: ..
:
.
: " "
13
PIC
: ,
.. ..
: ..
PIC , .. ,
5+ VSS VDD
VDD VSS
PIC ..
, ,
..
30 ,
..
: 10
) ... !! (
: .
: 50 ..
PIC16f877a
; adcon1=0x07 ; adcon1=0x06
analog
,
porta,porte I/O . PIC16f84a
14
PIC
: PIC
Pic16f877a ,
:
, "
"
" " / , .
. Pic16f628a
, ,
; cmcon=0x07
PIC16f628a . ,
.
.
... LEDs A0 . A4
LEDs B0 . B7
:
15
PIC
{ )(void main
;trisa=0; trisb=0
)while(1
;{ porta=0; portb=0
;)Delay_ms(100
;Porta=0xff; Portb=0xff
;)Delay_ms(100
}
}
LEDs A0-A4
. LEDs A0-A3
LED . A4
LEDs
A4
.
16
PIC
; CMCON=0x07
. datasheet
Bidirectional
. I/O A4 open drain +
A4 ,
:
17
PIC
:
{ )(void main
;trisa.f4=0
;porta.f4=1
}
LED A4 .
. LED .
The difference between successful and unsuccessful is that the successful have failed many
times more than non-successful
" "
) ( A4=1
.
LED
LED A4
.
18
PIC
LED .
.
A4 .
, LED 5mm
) ( LEDs
LEDs 20 .
, ,
Led 3mm
.
,
,
/ .
, open drain Open drain
: A4
vdd .
. open drain
) king5star (
, .. .. ..
A4 , ... .
, :
19
PIC
LED ,
LED , 10
LED , . LED
A4 ..
.
; CMCON=0x07
...
=======================================
... ..
: LEDs
. carlieplexing .. ..
.... !!.. , .
20