Beruflich Dokumente
Kultur Dokumente
Prajin Palangsantikul
presentation v0.01
Date 2015/09/23
PIC24HJ256GP210
USB
9/23/2015
PIC24 Programming
Include Head file (.h)
#include <p24Hxxxx.h>
Configuration Bits
C:\Program Files(x86)\Microchip\xc16\v1.24\
docs\ config_docs\24HJ256GP210.htm
9/23/2015
9/23/2015
9/23/2015
Open-Drain Configuration
This is controlled by the Open-Drain Control
register, ODCx, associated with each port.
The open-drain feature allows the generation of
outputs higher than VDD(e.g., 5V) on any desired
digital only pins by using external pull-up resistors
9/23/2015
9/23/2015
10
9/23/2015
11
9/23/2015
12
9/23/2015
13
14
PIC24H
9/23/2015
15
Output
Input
CNx
External Interrupt
LAB_04_INT3.C
9/23/2015
INTx
16
LAB_04_CN5_6
(RB3/CN5, RB4/CN6)
9/23/2015
17
LAB_04_INT3
(RA14/INT3)
9/23/2015
18
2.Timers
Type A timer
Timer1
Type B timer
Timer2, Timer4, Timer6 and Timer8
Type C timer
Timer3, Timer5, Timer7 and Timer9
9/23/2015
19
PRx
16-bit Timer Period register associated with the
timer
TxCON
16-bit Timer Control register associated with the
timer
9/23/2015
20
9/23/2015
21
9/23/2015
22
9/23/2015
23
9/23/2015
24
9/23/2015
25
9/23/2015
26
2.Timers: Tick
T =
1/f
=
1/(FOSC/2)/prescale value
=
1/(40MHz/2)/256
=
0.013 ms
1ms?
0.013ms =
1 Tick
1ms
=
1/0.013
=
76
9/23/2015
27
9/23/2015
28
Counter Mode
LAB_05_Counter.c
9/23/2015
29
9/23/2015
30
9/23/2015
31
9/23/2015
32
Counter Mode
LAB_05_Counter32.c
9/23/2015
33
9/23/2015
34
9/23/2015
35
9/23/2015
36
9/23/2015
37
9/23/2015
38
9/23/2015
39
LAB_07_ADC_AN2.c
9/23/2015
40
4.Input Capture
9/23/2015
41
9/23/2015
42
9/23/2015
43
9/23/2015
44
9/23/2015
(See: Figure12-5)
45
5.Output Compare
9/23/2015
46
9/23/2015
47
5.Output Compare:
9/23/2015
48
OCxR
Output Compare register
OCxRS
Secondary Output Compare register
9/23/2015
49
9/23/2015
50
9/23/2015
51
9/23/2015
52
9/23/2015
53
9/23/2015
54
Control lines:
SCLK Serial Clock
/SS Slave Select (no addressing)
9/23/2015
55
9/23/2015
56
LAB_10_74HC595.c
PIC24H
74HC595
------------------------------SDO1/RF8 -> DS pin
SCK1/RF6 -> SH_CP pin
RF5
-> ST_CP pin
9/23/2015
57
LAB_10_74HC595.c
PIC24H
SDO1/RF8
RF5
SCK1/RF6
9/23/2015
58
9/23/2015
59
9/23/2015
60
9/23/2015
61
PCF8574
PCF
8574A
A I/O expander
PCF8591
PCF
8591 8
8bit
bit A/D and D/A
DS
DS1307
1307 RealReal-Time Clock
9/23/2015
62
LAB_11_PCF8574A.c
PIC24 PCF8574A
-------------------------xx ->
SDA
xx ->
SCL
P0-P7 LED 8
9/23/2015
63
LAB_11_PCF8574A.c
PIC24H
xx
xx
9/23/2015
64
SD card/FAT32 ()
9/23/2015
65
9/23/2015
66
Ref.
www.microchip.com
PIC24HJXXXGP-X06-X08-X10 datasheet
ETT manPIC32-START-KIT manual
9/23/2015
67