Upload
others
View
20
Download
1
Embed Size (px)
Citation preview
AVR & PIC DEM 2 User’s Guide
© 2004-2009 Sure Electronics Inc. DB-DP115 & DB-DP113_Ver2.0
AVR & PIC DEM 2 USER’S GUIDE
© 2004-2009 Sure Electronics Inc. DB-DP115 & DB-DP113_Ver2.0_Page i
Table of Contents Chapter 1. Overview and Main Features .......................................................................1
1.1 Product Gallery ................................................................................................... 1 1.2 Main Features ...................................................................................................... 4
Chapter 2. Getting Started.................................................................................................5 2.1 Install the Driver of CP2102 Single-chip USB to UART Bridge ....................... 5 2.2 Application Notes................................................................................................ 5
2.2.1 LCD Module .................................................................................................................. 5 2.2.2 LED Display .................................................................................................................. 5
2.3 How to Communicate between PC and Demo Board ...................................... 6 2.3.1 How to Find the Right Communication Port ........................................................ 6 2.3.2 Communication via Hyper Terminal ....................................................................... 7
Chapter 3. Hardware Detail .............................................................................................10 3.1 Electric Characteristics .................................................................................... 10 3.2 Electric Characteristics .................................................................................... 10
3.2.1 Power Supply Port .................................................................................................... 10 3.2.2 Speaker Port ............................................................................................................... 10
3.3 USB Port ............................................................................................................ 12 3.4 Program/Debug Port ......................................................................................... 13 3.5 LCD Module ....................................................................................................... 15 3.6 Processor I/O Port............................................................................................. 15 3.7 Push Button....................................................................................................... 15 3.8 PWM Module...................................................................................................... 16 3.9 LED Segment ..................................................................................................... 18 3.10 LED Indication Light ......................................................................................... 19 3.11 IIC Bus Components ......................................................................................... 20
Chapter 4. Sample Code..................................................................................................22 4.1 Sample Code for AVRDEM 2 PLUS .................................................................. 22 4.2 Sample Code for PICDEM 2 PLUS ................................................................... 22
Chapter 5. Mechanical Drawing......................................................................................235.1 Schematic .......................................................................................................... 23 5.2 Physical Dimensions ........................................................................................ 27
Chapter 6. Contact Us .....................................................................................................28
AVR & PIC DEM 2
© 2004-2009 Sure Electronics Inc DB-DP115 & DB-DP113_Ver2.0_Page ii
NOTES: AVRDEM Product Version : Ver 2.0 PICDEM Product Version : Ver 3.0 Document Version : Ver 2.0
AVR & PIC DEM 2 USER’S GUIDE
© 2004-2009 Sure Electronics Inc.
Chapter 1. Overview and Main Features 1.1 Product Gallery
FIGURE 1-1 AVRDEM TOP VIEW WITH LCD MODULE
FIGURE 1-2 PICDEM TOP VIEW WITH LCD MODULE
DB-DP115 & DB-DP113_Ver2.0_Page 1
AVR & PIC DEM 2 FIGURE 1-3 AVRDEM TOP VIEW WITHOUT LCD MODULE
FIGURE 1-4 PICDEM TOP VIEW WITHOUT LCD MODULE
© 2004-2009 Sure Electronics Inc DB-DP115 & DB-DP113_Ver2.0_Page 2
Overview and Main Features FIGURE 1-5 AVRDEM PARTS LAYOUT
FIGURE 1-6 PICDEM PARTS LAYOUT
© 2004-2009 Sure Electronics Inc. DB-DP115 & DB-DP113_Ver2.0_Page 3
AVR & PIC DEM 2
© 2004-2009 Sure Electronics Inc DB-DP115 & DB-DP113_Ver2.0_Page 4
1.2 Main Features
1. Mini USB power supply.
2. ATMEGA16 microcontroller on AVRDEM board. PIC18F4520-I/PT microchip on
PICDEM board. It can be replaced by PIC18LF4520 or 16F877A microchip. All the I/O
ports are extended for convenient access.
3. 12MHz Active crystal oscillator on AVRDEM board & 20MHz high-speed crystal
oscillator on PICDEM board.
4. 10 pin ISP socket on AVRDEM board. 6 pin ICD/ICSP socket on PICDEM board.
5. 24C02N IIC EEPROM on board.
6. LM75 IIC digital temperature sensor.
7. There is a 20*2 character LCD module on AVRDEM board and a 20*2character LCD
module on PICDEM board. Pre-installed 4-digit 7-segment LEDs is beneath the LCD
module. They could function well after removing LCD module
8. ULN2003 Darlington transistors array are used to drive LED segments and speaker.
9. LCD module contrast can be adjusted by LM358 dual OP-Amps or Potentiometers
R28.
10. There are 3 function keys SW1, SW2 and SW3 connected to RESET, PC7 and PC6
pins of ATMEGA16 microcontroller on AVRDEM board, but RA4, RB0 and
RE3/MCLR pins of PIC18F4520 microcontroller on PICDEM board.
11. One power indicator (Green) and four red port indicators are connected to PA0-3
ports of ATMEGA16 microcontroller on AVRDEM board, but RB0-3 ports of
PIC18F4520 microcontroller on PICDEM board.
AVR & PIC DEM 2 USER’S GUIDE
© 2004-2009 Sure Electronics Inc.
Chapter 2. Getting Started 2.1 Install the Driver of CP2102 Single-chip USB to UART Bridge
All related software/drivers, installation guide and instructions on how to build a project with the program software can be found on our website under the General Software menu.
2.2 Application Notes
2.2.1 LCD Module This USB-powered module will start running when the power is on. 1. “Sure Electronics” and “V300” (AVRDEM)/”V200” (PICDEM) will be displayed first
upon the powering of this module. 2. “Sure Electronics” will always be displayed on row 1 of LCD. The displaying
information on row 2 of LCD is supposed to be changed as SW1 (AVRDEM)/SW2 (PICDEM) is pressed down. Current temperature in centigrade, current temperature in Fahrenheit and contrast ratio should be displayed in turn.
3. When contrast ratio is being displayed, its value can be increased by 10% as SW2 (AVRDEM)/SW1 (PICDEM) is pressed down at every time.
4. You may send temperature information to PC every 10 seconds, if the board is connected to the personal computer, and then you could see information in Hyper Terminal like shown in the following. Current Temperature
11.6Centigrade 24.0Fahrenheit Note: 11.6 and 24.0 is only a reference value.
2.2.2 LED Display To use LED display, remove the LCD module from the board first. This USB-powered module will start running upon the powering. 1. “Sure Electronics” and “Ver1.1” will be displayed first upon the powering. 2. The displaying information on LEDs should be changed as SW1 (AVRDEM)/SW2
(PICDEM) is pressed down each time. The displaying information includes “SurE”, “V200”, temperature readouts in centigrade and Fahrenheit.
3. When SW2 (AVRDEM)/SW1 (PICDEM) is pressed down, all the information, which includes “SurE”, “V300”, temperature in centigrade and Fahrenheit, should be displayed in turn.
4. You may send temperature information to PC every 10 seconds. If the board is connected to the personal computer, and then you could see information in Hyper Terminal like shown in the following:
5. Current Temperature 6. 11.6Centigrade 7. 24.0Fahrenheit
DB-DP115 & DB-DP113_Ver2.0_Page 5
AVR & PIC DEM 2 Note:
1. 11.6 and 24.0 are only for reference only. 2. If ATMEGA16 microchip on AVRDEM board is going to be programmed by
AVRSTK500 programmer, demo board should be powered on before the 10-pin ISP socket is plugged into program interface. Otherwise programming may fail.
2.3 How to Communicate between PC and Demo Board
This demo board can send temperature to PC every 10 seconds. It is desirable to install CP2102 driver first. The next step would be to check which port that demo board is connected. The following steps show how to find the port (COM &LPT). 2.3.1 How to Find the Right Communication Port Right click “My Computer” icon and choose “Properties” or press Windows + Break shortcut key to open “System Properties” screen as shown below:
Click “Hardware” tab
© 2004-2009 Sure Electronics Inc DB-DP115 & DB-DP113_Ver2.0_Page 6
Getting Started Click “Device Manager” to display “Device Manager” page. Find a port like “Silicon Labs CP210x USB to UART Bridge (COM6)”. Here “COM6” is just an example. Different PC may have different COM port.
2.3.2 Communication via Hyper Terminal After the connection with personal computer is made, you could see the following information in Hyper Terminal (Start Menu All Programs Accessories Communications Hyper Terminal).
© 2004-2009 Sure Electronics Inc. DB-DP115 & DB-DP113_Ver2.0_Page 7
AVR & PIC DEM 2 Name the new connection in the dialog box. Click “OK” to display setting dialog box as
© 2004-2009 Sure Electronics Inc DB-DP115 & DB-DP113_Ver2.0_Page 8
shown below.
Choose the right port and click “OK” to go into the next page. In related communication port properties dialogue box, choose appropriate Baud Rate. Default Baud Rate is 57600bps (AVRDEM) or 9600bps (PICDEM). Click “OK” button to connect demo board and PC. Then information will be shown in the Hyper Terminal window.
Getting Started In related communication port properties dialogue box, choose appropriate Baud Rate.
© 2004-2009 Sure Electronics Inc. DB-DP115 & DB-DP113_Ver2.0_Page 9
AVR & PIC DEM 2 USER’S GUIDE
© 2004-2009 Sure Electronics Inc.
3.1 Electric Characteristics
Power Supply: Mini USB DC Current per I/O Pin: 20.0mA sink and draw Maximum Tested Baud Rate on Mini USB Port: 115k bps
Chapter 3. Hardware Detail
Operating Temperature: -10°C to +55°C Storage Temperature: -20°C to +75°C
3.2 Electric Characteristics 3.2.1 Power Supply Port FIGURE 3-1 J1 IS THE MINI USB POWER SUPPLY ADAPTER SOCKET
D2
LED/green
12
D1
P6KE6v 8
+5V
R10
470R
100~500mAJ1 MINIUSB
1234
6
5
789
VBUSD-D+NC
GN
D
GND
GN
D
GN
D
GN
D
F1 FUSE
3.2.2 Speaker Port
DB-DP115 & DB-DP113_Ver2.0_Page 10
AVR & PIC DEM 2 FIGURE 3-2 SPEAKER DRIVING CIRCUIT ON AVRDEM BOARD
© 2004-2009 Sure Electronics Inc. DB-DP115 & DB-DP113_Ver2.0_Page 11
PA4
J2Speaker1
2
OP0OP1
USBTXD
+5V
PA7
PD0(RXD)
U7 ULN2003
9
45
14
1
13
6
32
8
71112
10
15
16
COM
4B5B
3C
1B
4C
6B
3B2B
E
7B6C5C
7C
2C
1C
OP2
R11
47R
+5V
PD7(OC2)
PA6
R19 472
OP3PA5
+5V
R18 472
R12 470R
FIGURE 3-3 SPEAKER DRIVING CIRCUIT ON PICDEM BOARD
s shown in Figure21/22, J2 is the speaker on this demo board. PWM output of the ers
Amicrocontroller is connected to the ULN2003 of a NPN transistor-based amplifier. Uscould adjust PWM wave to change the frequency of the buzzer and could adjust the sound volume by tuning the duty of PWM wave.
U7 ULN2003
9
45
14
1
13
6
32
8
71112
10
15
16
COM
4B5B
3C
1B
4C
6B
3B2B
E
7B6C5C
7C
2C
1C
OP0
+5V
J2Speaker1
2
USBTXD
+5V
R12 470R
R19 472
R11
47R
OP2RB7/PGD
RB4
RB6/PGCRB5
+5V
R18 472
RC2
OP1
RC7/RX
OP3
Hardware Detail
© 2004-2009 Sure Electronics Inc DB-DP115 & DB-DP113_Ver2.0_Page 12
3.3 USB PortURE 3-4 USB CIRCUIT ON AVRDEM BOARD
FIG
USBTXD
C9
104
12
F1 FUSEJ1 MINIUSB
1234
6
5
789
VBUSD-D+NC
GN
D
GND
GN
D
GN
D
GN
D
U4 CP2102
12
3
45
6
7
252423
12
11
9
8 26
2728DCD
RI
GND
D+D-
VDD
REGIN
RXDRTSCTS
SUSPEND
SUSPEND
RST
VBUS TXD
DSRDTR
+C8
10uF/10V tan
12
D2
LED/green1
2
D1
P6KE6v 8
R10
470R
USBRXD
U5 PRTR5V0U2X
1 2
34
GND I/O1
I/O2VCC
R9
4.7k
C10
104
12
+C7
10uF/10V tan
12
+5V
he USB Port on AVRDEM board is connected to PD1/ TXD and PD0/RXD of
TATMEGA16 microchip through CP2102, resistor and UNL2003.
PA4
J2Speaker1
2
OP0
R17 472USBRXD
OP1
USBTXD
+5V
PD1(TXD)
PA7
PD0(RXD)
U7 ULN2003
9
45
14
1
13
6
32
8
71112
10
15
16
COM
4B5B
3C
1B
4C
6B
3B2B
E
7B6C5C
7C
2C
1C
OP2
R11
47R
+5V
PD7(OC2)
PA6
R19 472
OP3PA5
+5V
R18 472
R12 470R
AVR & PIC DEM 2
© 2004-2009 Sure Electronics Inc. DB-DP115 & DB-DP113_Ver2.0_Page 13
IGURE 3-5 USB CIRCUIT ON PICDEM BOARD F
+C6
10uF/10V tan
12
D1
P6KE6v 8
+5V
U4 CP2102
12
3
45
6
7
252423
12
11
9
8 26
2728DCD
RI
GND
D+D-
VDD
REGIN
RXDRTSCTS
SUSPEND
SUSPEND
RST
VBUS TXD
DSRDTR
D2
LED/green1
2
J1USB1234
6
5
789
VBUSD-D+NC
GN
D
GND
GN
D
GN
D
GN
D
USBRXD
U5 PRTR5V0U2X
1 2
34
GND I/O1
I/O2VCC
F1 FUSE
+C7
10uF/10V tan
12
C9
104
12
R10
470R
USBTXD
R9
4.7k
C8
104
12
3.4 Program/Debug Port
The USB Port on PICDEM board is connected to RC6/ TX and RC7/RX of PIC18F4520 microchip through CP2102, resistor and UNL2003.
RB7/PGD
R11
47R
R18 472
RC7/RX
+5V
+5V
USBTXD
+5V
RB5RB4
J2Speaker1R12 470R
2
R19 472
U7 ULN2003
RC6/TX
9
45
14
1
13
6
32
8
71112
10
15
16
COM
4B5B
3C
1B
4C
6B
3B2B
E
7B6C5C
7C
2C
1C
R17 472
OP0
USBRXD
OP2OP3
RC2
OP1RB6/PDC
Hardware Detail
© 2004-2009 Sure Electronics Inc DB-DP115 & DB-DP113_Ver2.0_Page 14
IGURE 3-6 PROGRAM/DEBUG PORT ON AVRDEM BOARD
T ON PICDEM BOARD
7 is a 10-pin program/debug port for AVR microchip as shown in figure 25. 8 is a 6-pin 100mil pitch program/debug interface for PIC microchip as shown in figure
in4 is for program data and Pin5 is for program clock. It is very easy (convenient) to connect it to a Pickit2 or MPLAB ICD2 of Sure Electronics.
F FIGURE 3-7 PROGRAM/DEBUG POR JJ26. Pin1 is MCLR of PIC18F4520, Pin2 is +5V, Pin3 is GND, P
PB6(MISO)
RESET
PB5(MOSI)
+5VJ7 ISP
PB7(SCK)
1 23 45 67 89 10
+5VJ8 ICD Connector
RE3/MCLR 12345RB6/PGC
RB7/PGD
6
AVR & PIC DEM 2
© 2004-2009 Sure Electronics Inc. DB-DP115 & DB-DP113_Ver2.0_Page 15
3.5 LCD ModIGURE 3-8 LCD MODULE
d le IGURE 3-8 LCD MODULE
uule FF
RD7 RD1
U6 DE-LM013
46 57810 911121314 1231516
RS
E R/W
DB0
DB1
DB2
VSS
VDD
VEE
AK DB3
DB4
DB5
DB6
DB7
RD2RD6 RD3 RA2
+5V
RA1 VEERD4 RA3RD5 RD0
3.6 ProcessoFIGURE 3-9 ATME A16 I/O PORTS ON AVRDEM BOARD
A 20*2 character LCD module (no backlight) is installed on the AVRDEM board. A 20*2 character LCD module (no backlight) is installed on the PICDEM board. r I/O Port G
J5 PORTC
12345678
PA0
PD5(OC1A)PA6
PD0(RXD)
PC5(TDI)
PC3(TMS)PA3
PD7(OC2)
PB2
PA5PA4
J6 PORTD
12345678
PD3
PB5(MOSI)PB6(MISO) PD6
PC1(SDA)
PB4
PB1
PC7
J3 PORTA J4 PORTB
PB0 PC0(SCL)
PA7
PC4(TDO)
PA1
PC6
PD1(TXD)PC2(TCK)PA2
PD4
PB7(SCK)
12345678
123 PD245678
PB3
FIGURE 3-10 PIC18F4520 I/O PORTS ON PICDEM BOARD
RD5
RC2RA2 RB2
RB4
RB0
J4 PORTB
12345678
RE1RC0
RA1
RE3/MCLR
J5 PORTC
12345678RB6/PGC
RD1
RC3/SCLRA3RD4
J6 PORTD
12345678
RD0
RD3RC4/SDA
RD6RB7/PGD RC7/RX
RC6/TXRD7
RC5
RD2
RA6/OSC2
RA4
RC1RE2
RA0
RA5 RB5
RA7/OSC1
RB1
J3 PORTA
12345678
RB3
RE0
J7 PORTE
1234
All 4 I/O ports of ATMEGA16 control microchip are protruded, as shown in figure28. All 5 I/O ports of PIC18F4520 control microchip are protruded, as shown in figure29.
3.7 Push Button
Hardware Detail
© 2004-2009 Sure Electronics Inc DB-DP115 & DB-DP113_Ver2.0_Page 16
FIGURE 3-11 PUSH BUTTONS ON AVRDEM BOARD
PC6PC7
R3 10k
RESET
R2
10k
R1
10k
C2
104
12
R4 100R
C1
104
12
+5V
SW21
2
3
4
C5
104
12
+5V
R7
10KSW1
12
34 R8 10k
+5V
SW34
1 3
2
FIGURE 3-12 PUSH BUTTONS ON PICDEM BOARD
C1
104
12
+5V
R4 100RRB0
R8 10k
+5V
R3 10k
RE3/MCLR
C5
104
12
+5V
SW21
2
3
4
R1
10k
R2
10k
C2
104
12
SW31
2
3
4
R7
10KSW14
RA4 1 3
2
Three push buttons SW1, SW2 and SW3 are installed on the demo board to fulfill some functions.
.8 PWM Module
3
AVR & PIC DEM 2
© 2004-2009 Sure Electronics Inc. DB-DP115 & DB-DP113_Ver2.0_Page 17
FIGURE 3-13 PWM CIRCUIT ON AVRDEM BOARD
PA4
J2Speaker1
2
C21 104
1 2
OP0
R17 472USBRXD
R31 10k
OP1
R29 10k+
-
U9A
LM358A/SO
3
21
84
USBTXD
+5V
PD1(TXD)
PA7
C24
104
12
PD0(RXD)
+
-
U9B
LM358A/SO
5
67
84
U7 ULN2003
9
45
14
1
13
6
32
8
71112
10
15
16
COM
4B5B
1B
4C
6B
2B
E
7B6C5C
7C
2C
1C
3C3B
OP2
+5V
C22
104
12
R11
47R
+5V
+5V
PD7(OC2)
PA6
R19 472
R30 47R
OP3
VO
PA5
PD5(OC1A)
+5V
+5V
R18 472
R28
103
13
2
C23
104
12
R12 470R
R32 10k
IGURE 3-14 PWM CIRCUIT ON PICDEM BOARD
F
R30 47R+
-
U9A
LM358A/SO
3
21
84
R31 10k
+5V
RB4
VEE
C20
104
12
RC7/RX
OP3
R11
47R
RB7/PGD
+5V
R18 472
C18 104
1 2
R32 10k+
-
U9B
LM358A/SO
5
67
84
J2Speaker1
2
RB6/PDC
R29 10k
+5V
R19 472
C19
104
12
USBTXD
OP2RB5
RC2
RC1
C21
104
12
R28
103
13
2
OP0
U7 ULN2003
9
45
14
1
13
6
32
8
71112
10
15
16
4B5B
3C
1B
4C
6B
3B2B
7B6C5C
7C
2C
1C
COME
OP1
+5V
R12 470R
+5V +5V
Hardware Detail
© 2004-2009 Sure Electronics Inc DB-DP115 & DB-DP113_Ver2.0_Page 18
PD7 (OC2) on AVRDEM board will be regulated to PWM for speaker port. RC2/CCP2 on PICDEM board will be regulated to PWM for speaker port. PWM width from PD5 (OC1A) (on AVRDEM board) or RC2/CCP2 (on PICDEM board) is to control the LCD contrast. It can be regulated into a DC voltage because of the low pass filter built with U9-LM358 op-amp. Contrast of the LCD module could also be adjusted by screwing R28 adjustable resistance.
3.9 LED Segment FIGURE 3-15 LED SEGMENT DRIVING CIRCUIT ON EM BOARD AVRD
+5V
PA4
J2Speaker1
2
OP0
R11
47R
OP1
USBTXD
PA7
PD0(RXD)
R12 470RU7 ULN2003
9
45
14
1
13
6
32
8
71112
10
15
16
4B5B
1B
4C
6B 6C5C
1C
COM
3C3B2B
E
7B 7C
2C
OP2
+5V
PD7(OC2)
PA6
R19 472
OP3PA5
+5V
R18 472
AVR & PIC DEM 2 FIGURE 3-16 LED SEGMENT DRIVING CIRCUIT ON PICDEM BOARD
+5V
© 2004-2009 Sure Electronics Inc. DB-DP115 & DB-DP113_Ver2.0_Page 19
RB4
RC7/RX
OP3
R11
47R
RB7/PGD
R18 472
J2Speaker1
2
RB6/PDC
+5V
R19 472USBTXD
OP2RB5
RC2
R12 470RU7 ULN2003
OP0
9
45
14
1
13
6
32
8
71112
10
15
16
COM
4B5B
3C
4C
6B
3B2B
E
7B6C5C
7C
2C
1B 1C
OP1
+5V
PA7 (A EM)/RB4 (PICDEM) control the rightmost digit of -digits LED segments. PA6 (A EM)/RB5 (PICDEM) control the adjacent digit of rightmost digit of the 4-digits LED se nts. PA5 (AVRDEM)/RB6 (PICDEM) control the adjacent digit of leftmost digit of the 4-digits LE nts. PA4 (AVRDEM)/RB7 (PICDEM) control the leftmost digit of the 4-digits LED segments.
3.10 LED Indication Light
FIGURE 3-17 LED INDICATION LIGHT ON AVRDEM BOARD
VRD the 4VRDgme
D segme
D3 RED1 2
R15 1k PA2
PA0
D5 RED1 2
R14 1k PA1
PA3
+5V
R13 1k
D6 RED1 2 R16 1k
D4 RED1 2
Hardware Detail FIGURE 3-18 LED INDICATION LIGHT ON PICDEM BOARD
© 2004-2009 Sure Electronics Inc DB-DP115 & DB-DP113_Ver2.0_Page 20
As s figure 36, D3-6 on AVRDEM board could be lit up by setting PA0-3 to low level. As shown in figure 37, D3-6 on PICDEM board could be lit up by setting RB0-3 to low level.
3.11 IIC Bus C
+5V
D3 RED
hown in
omponents FIGURE 3-19 IIC BUS COMPONENTS ON AVRDEM BOARD
PC0(SCL)
+5V
PC0(SCL)
U3 24C041
32
457
6
8PRE
E2E1
VSSSDAMODE/WC
SCL
VCC
PC1(SDA)
PC1(SDA)
+5V
R5
10K
+5V
U1 LM751
4
23
5678
SDA
D
SCLO.S.
A2A1A0
+VS
GN+5V
R6
10K
1 2 RB0
R16 1k
D5 RED1 2
R14 1kD4 RED1 2 RB1
D6 RED1 2
RB2
RB3
R15 1k
R13 1k
AVR & PIC DEM 2
© 2004-2009 Sure Electronics Inc. DB-DP115 & DB-DP113_Ver2.0_Page 21
GURE 3-20 IIC BUS COMPONENTS ON PICDEM BOARD FI
RC4/SDA
+5V
RC3/SCL
RC3/SCL
+5V
R6
10KU3 24C04
1
32
457
6
8 PRE
E2E1
VSSSDAMODE/WC
SCL
VCC
+5V
+5VR5
10K
RC4/SDA
U2 LM751
4
23
5678SDA
GND
SCLO.S.
A2A1A0
+VS
24LC02 or Atmel 24C02 EEPROM chip and a LM75A temperature sensor are built in e demo board. Their addresses are 0xA0 and 0x90. Connection is shown in figure
8/39.
Ath3
AVR & PIC DEM 2 USER’S GUIDE
© 2004-2009 Sure Electronics Inc. DB-DP115 & DB-DP113_Ver2.0_Page 22
4.1 Sample Code for AVRDEM 2 PLUS
All the codes were tested and are proved as workable on the demo board. But please note that all those codes are only for test and research use, we can not guarantee any consequences of inappropriate use of those demo codes. All those demo codes are based on WinAVR (GCC). Sample 1. Light LEDs Associated With PORTA Sample 2. Make the Buzzer Beep Sample 3. Read Temperature from Built-in IIC Temperature Sensor Sample 4. Transmitter Data through the USART of ATMEGA16 S to Display Information with 7-segment LEDs S to Display Information on HD44780 LCD Module Sample 7. LED Mode Code Sample 8. Display data on the LCD Module
4.2 Sample Code for PICDEM 2 PLUS ll those demo codes are based on MPLAB IDE and MCC18 C compiler. ample 1. Light up LEDs Associated with PORTB ample 2. Make the Buzzer Beep
nsor Sample 4. How to Read and Write to the Data EEPROM Memory Sample 5. Transmit Data through the USART of 18F4520 Sample 6. How to Display Information with 7-segment LEDs Sample 7. How to Display Information on HD44780 LCD Module Sample 8. LED Mode Code Sample 9. Display data on the Note: You can find all sample codes in our website
ample 5. Howample 6. How
LCD Module
ASSSample 3. Read Temperature from Built-in IIC Temperature Se
Chapter 4. Sample Code
AVR & PIC DEM 2 USER’S GUIDE
© 2004-2009 Sure Electronics Inc. DB-DP115 & DB-DP113_Ver2.0_Page 23
5.1 Schematic
IGURE 5-1 SCHEMATIC OF MAIN CONTROLLER, POWER AND KEYPAD OF AVRDEM
Chapter 5. Mechanical Drawing
F
PA6
U324
C04
1 32 457 68
PRE E2E1 VSS
SDA
MODE
/WC
SCL
VCC
R5 10K
PB4
+C1
2
10V,
1OOu
F
1 2
PC0(S
CL)
+5V
PA5
PA1
PB0
+5V
PC7
C2 104
1 2
TP5
PAD
C17 104
1 2
C10
104
1 2
+5V
+5V
PB6(M
ISO)
SW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CK
)
RESE
T
VCC
GND
XTAL
2
PD6
+C1
4
10V,
1OOu
F
1 2
+5V
+5V
PC7
SW1
1
2
3
4
100~
500m
A
+5V
TP8
PAD
+C8
10uF
/10V
tan
1 2
PA3
PD2 C6 10
4
1 2
D1
P6KE
6v8
R1 10k
+C1
3
10V,
1OOu
F1 2
+5V
C15 104
1 2
C9 104
1 2
F1FU
SE
+5V
PB2
U4CP
2102
12
3 4567
25 24 2312119
8262728
DCDRI
GND
D+D-VDD
REGI
N
RXD
RTS
CTS
SUSP
END
SUSP
END
RST
VBUS
TXD
DSR
DTR
RESE
T
USBT
XD
C20 104
1 2
PC0(S
CL)
U1LM
751 42 3
5678SD
A
GND
SCL
O.S.
A2A1A0+VS
D2 LED/
green
1 2
PB7(S
CK)
XTAL
1
C18 104
1 2
R2 10k
+5V
AVR & PIC DEM 2
© 2004-2009 Sure Electronics Inc DB-DP115 & DB-DP113_Ver2.0_Page 24
FIGURE 5-2 SCHEMATIC OF LED AND LCD MODULE OF AVRDEMO
SEG
7
SEG
0
SEG
5
+5V
PA4
PC6
SEG
7
J2Sp
eake
r1 2
SEG
6
C21
104
12
OP1
OP0
PB7(
SCK)
J6R
TDPO 1 2 3 4 5 6 7 8
R17
472
USB
RXD
PD0(
RXD
)
PB6(
MIS
O)
R31
10k
PD2
J7IS
P
12
34
56
78
910
OP1
R29
10k
+ -LM
358A
/SO
U9A
3 21
8 4
PC1(
SDA)
PD5(
OC
1A)
SEG
5
SEG
1
USB
TXD
PB6(
MIS
O)
D3
RED
12
PD4
PC2(
TCK)
SEG
3
R20
1k
+5V
PB5(
MO
SI)
PB5(
MO
SI)
SEG
4
PB5(MOSI)
OP3
U6
DE-
LD00
7
4
6
5
7
8
10
9
11
12
13
14
1
2
3
15
16
RS
E
R/W
DB0
DB1
DB3
DB2
DB4
DB5
DB6
DB7
VSS
VDD
VEE
A
K
PD1(
TXD
)
PA7
R15
1k
SEG
4
PC3(
TMS)
PB4
PB7(SCK)
PA2
C2
1044
1 2
PB5(
MO
SI)
PA5
PD3
PB1
PB6(
MIS
O)
PD0(
RXD
)
PC0(
SCL)
PA0
PB2
+ -
U9
LM
B 358A
/SO
5 67
8 4
PD6
PB2
R23
1k
U7
ULN
2003
9
4 5
14
1
13
6 32 871112 10 1516
1B1C
CO
M3C4C 6C5C 7C 2C
4B 5B 6B 3B2B E7B
OP2
D5
RED
12
J3PO
RTA
1 2 3 4 5 6 7 8
PA2
RES
ET
PA0
C22
104
1 2
OP2
R14
1kPA
1
PB3
PB2
PB1
PA4
R11
47R
R21
1k
PB1
PC5(
TDI)
VO
PB7(
SCK)
PC7
SEG
2
SEG
6
PB6(MISO)
PA7
+5V
PA6
+5V
+5V
PB4
PD7(
OC
2)
PA3
PA6
+5V
R19
472
R30
47R
R13
1k
OP3
PB3
PD7(
OC
2)
PB0
VO
PA5
PA3
PD3
PD5(
OC
1A)
D6
RED
12
PB3
R24
1k
J5PO
RTC
1 2 3 4 5 6 7 8
+5V
+5V
PD4
PA1
R27
1kR16
1k
PD1(
TXD
)
R18
472
R28
103
13
2
PB0
PC4(
TDO
)
SEG
0
SEG
3
PB0
R26
1k
C23
104
1 2
PB7(
SCK)
R70
R12
4
+5V
8888
U8
S028
41
10 5 3
12
9
11 1247
8
6
F G DP
DIG1
DIG2
A EDCB
DIG3
DIG4
OP0
PB4
SEG
1
D4
RED
12
PD2
R25
1k
J4PO
RTB
1 2 3 4 5 6 7 8
R22
1k
R32
10k
SEG
2
Mechanical Drawing
© 2004-2009 Sure Electronics Inc. DB-DP115 & DB-DP113_Ver2.0_Page 25
FIGURE 5-3 SCHEMATIC OF MAIN CONTROLLER, POWER AND KEYPAD OF PICDEM BOARD
+5V
RE2
+5V
TP1
PAD
+C6
10uF
/10V
tan
1 2
+5V
RB7/
PGD
RC4/
SDA
C13 104
1 2
+5V
RB4
R410
0R
RD5
TP3
PAD
+5V
RC2
RC6/
TX
U4CP
2102
12
3 4567
25 24 2312119
8262728
DCDRI
GND
D+D-VDD
REGI
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SC1
/CLK
I/RA7
OSC2
/CLK
O/RA
6
RC0/
T1OS
O/T1
3CKI
RC2/
CCP1
/P1A
RC1/
T1OS
I/CCP
2(2)
RA0/
AN0
RB5/
KBI1
/PGM
RB6/
KBI2
/PGC
RB7/
KBI3
/PGD
VSS1
VSS2
NC1NC2
NC3NC4
+5V
RE3/
MCLR
C14 104
1 2
TP4
PAD
+5V
R6 10K
+5V
RB5
U324
C04
1 32 457 68
PRE E2E1 VSS
SDA
MODE
/WC
SCL
VCC
RA2
RC3/
SCL
TP5
PAD
D2 LED/
gree
n
1 2
TP8
PAD
R310
k
R7 10K
R2 10k
RA7/
OSC1
RC3/
SCL
C1 104
1 2
+5V
RB2
C4 22p
1 2
RD1
R1 10k
RD2
RD4
USBR
XD
+5V
RC7/
RX
RB3
C2 104
1 2
+5V
+C2
3
10V,
1OOu
F
1 2
R810
k
C9 104
1 2
RD0
D1
P6KE
6v8
RE1
AVR & PIC DEM 2
© 2004-2009 Sure Electronics Inc DB-DP115 & DB-DP113_Ver2.0_Page 26
FIGURE 5-4 SCHEMATIC OF LED AND LCD MODULE OF PICDEM BOARD
OP2
R22
1k
RC
3/SC
L
SEG
2
RB7
/PG
D
J2Sp
eake
r1 2
RD
5
RB7
/PG
D
R21
1k
R32
10k
+5V
RB0
RC
1
RB4
J7P
OR
TE
1 2 3 4
D3
RE
D1
2
R29
10k
RA
17/
OSC
RB4
C19
104
1 2
R30
47R
+5V
+5V
+5V
RB7
/PG
D
RD
0
RD
0
OP3
SEG
3
RC
1
SEG
5
R14
1k
RC
4/SD
A
RC
7/R
X
RD
7
J8IC
D C
onne
ctor
1 2 3 4 5 6
+5V
R27
1k
SEG
1
R24
1k
RD
1
U7
ULN
2003
9
4 5
14
1
13
6 32 871112 10 1516
CO
M
4B 5B
3C
1B
4C
6B 3B2B E7B6C5C 7C 2C1C
R26
1k
RC
7/R
X
OP0
RD
7R
B6/P
DC
SEG
2
R18
472
+5V
USB
RXD
R25
1kR15
1k
RB5
RB3
C20
104
1 2
RC
2
D6
RE
D1
2
SEG
4
RE3
/MC
LR
D4
RE
D1
2
U6
DE-
LD00
7
4
6
5
7
8
10
9
11
12
13
14
1
2
3
15
16
RS
E
R/W
DB0
DB1
DB3
DB2
DB4
DB5
DB6
DB7
VSS
VDD
VEE
A
K
OP1
R12
470R
RD
4
RD
4
RA4
RE3
/MC
LR
RD
2
RC
0
+5V
RB5
VEE
SEG
4
RD
5
RB0
RD
1
RB6
/PD
C
R28
103
13
2
SEG
7
RD
2
C21
104
1 2
SEG
0
R20
1k
R31
10k
RA3
USB
TXD
SEG
5
D5
RE
D1
2
OP3
RC
5
OP1
RA3
RB2
RA1
RD
0
SEG
3
RB3
RD
3
R17
472
VEE
SEG
6
RD
6
RB1
RD
3R
D6
R13
1k
88
88
U8
S02
841
10 5 3
12
911 1247
8
6
F G DP
DIG1
DIG2A EDCB
DIG3
DIG4
RA0
RA
26/
OSC
RC
6/TX
RD
6
C18
104
12
RE2
+5V
+5V
RD
3
OP2
SEG
6
SEG
0
RA1
RA
SEG
7
5
R16
1k
+ -
U9A
LM35
8A/S
O
3 21
8 4
RD
7
RE0
RD
4
+ -
U9B
LM35
8A/S
O
5 67
8 4
J4P
OR
TB
1 2 3 4 5 6 7 8
R11
47R
RD
5
RC
2
RD
2
1SE
G
RB1
OP0
J3PO
RTA
1 2 3 4 5 6 7 8
RD
1
R23
1k
RA2
J5PO
RTC
1 2 3 4 5 6 7 8R
C6/
TX
R19
472
RE1
RA2
RB6
/PD
C
RB2
J6PO
RTD
1 2 3 4 5 6 7 8
Mechanical Drawing
© 2004-2009 Sure Electronics Inc. DB-DP115 & DB-DP113_Ver2.0_Page 27
.2 Physical Dimensions 5FIGURE 5-5 PHYSICAL DIMENSIONS OF AVRDEM 2 PLUS
Synbol L L1 W W1 W2 Inch 4.7 4.15 3.16 2.83 1.14 mm 119.38 105.51 80.14 71.78 28.91
FIGURE 5-6 PHYSICAL DIMENSIONS OF PICDEM 2 PLUS
Synbol L L1 W W1 W2 Inch 4.7 4.15 3.01 2.68 1.14 mm 119.38 105.51 76.53 67.95 28.91
AVR & PIC DEM 2 USER’S GUIDE
© 2004-2009 Sure Electronics Inc.
DB-DP115 & DB-DP113_Ver2.0_Page 28
Sure Electronics Co., Ltd. 5F, Zone A, Qinhuai Technology Innovation Center 105-2 DaMing Rd (ZIP:210022) Nanjing P.R.China Tel: +86 chnical questions only)
nglish service, from GMT1-10AM) Fax: +86-25- 66606341-866 Website: www.sure-electronics.com
www.sure-electronics.net
Chapter 6. Contact Us
-13601408832 (For te+86-25-66606340 (E