Home

18F4520 - rhydoLABZ

image

Contents

1. 29 2 18 PORT Eege EE 30 3 0 SOFTWARE DEVELOPMEN NEE 31 3 1 TOOLS AND SORIW JATIE 513i tunm eA e EER AA 31 3 2 AOW TOTE Faen E E A A E n 32 4 0 VO PIN DISTRIBU TION siesiitecisisane cactus jewatadcauieatitewudertvensiaweswenswanatieswiresniiedunsisiecadawaddanevesotuediaantaianns 43 PIC eae 18F4520 OVERVIEW The PIC18F4520 Development Board Mini from rhydoLABZ can be used to evaluate and demonstrate the capabilities of Microchip PIC18F4520 microcontroller The board is designed for general purpose applications and includes a variety of hardware to exercise microcontroller peripherals Ideally suitable for training and development purposes The board provides the basic environment for a PIC microcontroller to run All ports 5V GND 3V3 are available on 40 pin male berg strip and 44 pin female berg strip We can easily attach a mini bread board on this development board Now all the PORTs of microcontroller along with power pins are available at the four side of the mini bread board where as we can design the rest of our project s mudoLABZ PIC USER GODE 18F4520 1 1 CONTROLLER SPECIFICATION PIC microcontrollers are manufactured by Microchip Technology Inc The PIC microcontroller family is based on modified Harvard architecture Features of PIC18F4520 microcontrollers are GE E Co IM ct Only 35 single word instructions to learn High current sink source 25 mA 25 mA Three progr
2. C Library Files Memory Summary zd Other Files Program space used CE6h Data space used Configuration bits used EEPROM space used ID Location space used Loaded C Sample Sample cot Geesse Build successfull au PICi8F4520 OW novzdcc bank oO Tiny Bootloader This is a bootloader for Microchip PIC microcontroller By using Tiny Bootloader program can be upload to the flash memory of the controller The communication settings can be editable so we can write any COM and desired baud rate Works with PIC16F PIC18F and automatically detects HEX content Now the code can be flashed to the controller In the board make sure to do the following jumper connections 1 Select the power source as USB cable or DC source 2 Select USB or serial port for flashing the code Now power up the board The power LED on the board glows Note The controller can be programmed in two ways 1 By using Serial Port 2 By using USB Port The user has to choose the exact COM Port in order to program the controller either through Serial Port or through USB Port rhudoLABZ S F PIC bsp COMDE 18F4520 Step 18 Open Tiny Bootloader Load required hex file Tiny Bootloader CAS ample 5 ample hes Messages Terminal ptians term pt Interface to TinyBootLoader v1 3 8 CheckPIC contact claudiu chiculitacjugal ro http wi etc ugal ra cchicullta saftware picbootleader htm Warin
3. MAX 232 RFID USB Connector PIC18F4520 Mini Development Board CP2102 ISP ee usa LED LCD 5V 3V3 UART JTAG Temp sensor Potentiometer Pull up Keys Buzzer Servo PIC USER COME 18F4520 2 2 INTERFACE OVERVIEW J3 J4 UART Add ASIII I daa A J18 power ICSP d E SWA reset et RAA B Oe i elel sys RES LED power LEDs SWITCHES Illustration 1 Top view of the Development board Mini LCD SEE me e K14 CAN d We Bring the World if yn o oe r L desch 2 Zi Ww m P Z A R f Eug RPR Blob bois EA K1 6 SERVO el oy 5 popmso 68seesewoo 291669 10 K9 POWER JE9 s pem EEREN dt E J16 ADC i r Mee giess J19 BUZZER E J17 TEMP J20 J21 XBEE rey TEE ream dee J1 J2 J10 LED P le EG Meer bet ATE v1 01 Illustration 2 Bottom view of the Development board Mini w rhudoLABZ PIC tasr ID 18F4520 U1 POWER SUPPLY LD1117 3V3 U2 RS232 MAX232 U3 VOLTAGE REGULATOR LM7805 U4 CONTROLLER PIC18F4520 U5 USB Interface CP2102 U6 MCP2551 used only in PIC18F4580 dev board U7 TEMPERATURE SENSOR MCP9700 U8 Connector for ZIGBEE MODULE P1 LCD Contrast Control Knob P2 ADC Knob SW4 Reset switch SW1 SW2 SW3 Pull up key LED1 LED2 LED3 3 LEDs connected to the PORTB pins LCD 16X2 Monochrome LCD K11 RJ 11 Connector IC
4. _J F rhudoLABZ PIC 5p GUIDE 18F4520 Illustration 31 RFID Tags CTT CZ DZ CZ EI ET ET Es ET ED a ED AE a KT al Remove J3 amp J4 while using RFID module QUE ee E EIS RA GERPZEPRRBGEPRRGESRIGERRGSLRRZELRRGERRGERSRAZGSERRASPRAZSLRRGGRPRAGRRASPRASGER ASERPGEPRGEPRRGERIGDRRRGSRPGESLRRGERRGERRGGERRASPRASRRGSRRGESRRAGESR RASER ASGPRASRPISRPRRGERARGERARGERPGEPRGSLRGERGGERAZAGER SPAGRRRRZSERGEER F Illustration 32 RFID Interfacing Schematic _ AERE mudoLABZ PIC USER GODE 18F4520 2 15 ANALOG TO DIGITAL CONVERTER The Analog to Digital Converter module in PIC18F4520 has eight analog inputs The analog input charges a sample and hold capacitor The output of the sample and hold capacitor is the input into the converter The converter then generates a digital result of this analog level via successive approximation The A D conversion of the analog input signal results in a corresponding 10 bit digital number The A D module has four registers These registers are e A D Result High Register ADRESH e A D Result Low Register ADRESL e A D Control RegisterQ ADCONO e A D Control Register ADCON 1 Analog pin RAO connected to a potentiometer A potentiometer in an electrical device allows reducing the voltage level from the circuit maximum to ground or zero level The test input voltage for ADC is derived from a 10K potentiometer connected across the 5V power supply and is connected to RAO ANO p
5. P Send Numbers Send ASCII iF Bi SS Repeats I 24 Literal Strip Spaces Dump File to Port cMempwcaptuelt wd Send File x ml Error Mat In Pregress Repeats r Si Char Count 0000000 CPS 0 No USAT Overrun No Buffer Overflow No Other Errors EBS gt Display Part Capture Ping Misc An Clear Freeze Status Connected _ RSD 2 TsO 3 _ CTS 8 BCB 1 B 5R B Rina 3 _ BREAK Error Port 1 5760 rhudoLABZ PIC EE 18F4520 2 11 5V UART 5V UART can be used to interface 5V TTL modules to communicate with microcontroller Eg RFID Bluetooth etc 5V UART 5 GND Remove J3 amp J4 while using K15 as UART Illustration 14 5V UART Schematic Illustration15 5V UART pins 2 12 3V3 UART 3V3 UART can be used to interface 3V3 TTL modules to communicate with microcontroller Eg ZigBee BlueBee etc 3V3 UART UART 3V3 GND Remove J3 amp J4 while using K17 as UART Illustration 16 SV8 UART Schematic Illustration 17 3V3 UAHT pins y mudoLABZ PIC bp GODE 18F4520 2 13 ZIGBEE INTERFACING ZigBee is a wireless networking standard that is aimed at remote control and sensor applications which is suitable for operation in harsh radio environments and in isolated locations ZigBee technology builds on IEEE standard 802 15 4 rhydoLABZ PIC18F4520 development board mini have pin out compatib
6. PIC USER GODE 18F4520 2 9 BUZZER INTERFACING A buzzer or beeper is an audio signaling device which may be mechanical electromechanical or piezoelectric Typical uses of buzzers and beepers include alarm devices timers and confirmation of user input such as a mouse click or keystroke A buzzer or beeper is a signaling device usually electronic typically used in automobiles household appliances such as microwave oven or game shows It indicates a warning in the form of a continuous or intermittent buzzing or beeping sound Here we use a ceramic based piezoelectric sounder with a high pitched tone Illustration 12 Buzzer on board BUZER Remove jumper J19 when REO is used for other purpose Illustration 13 Buzzer Connection Schematic rhudoLABZ PIC USER COIDE 18F4520 2 10 UNIVERSAL SYNCHRONOUS AND ASYNCHRONOUS RECEIVER AND TRANSMITER Serial communication is the process of sending data one bit at a time sequentially over a communication channel The Universal Synchronous Asynchronous Receiver Transmitter USART module is one of the two serial I O modules USART is also known as a Serial Communication Interface The USART is highly flexible serial communication protocol The USART can be configured as a full duplex asynchronous system that can communicate with peripheral devices such as CRT terminals and personal computers or it can be configured as a half duplex synchronous system that can comm
7. Save Praject Save Project Gs Add Files to Project Add New File to Project Remove File From Project Select Language Toolsuite Set Language Tool Locations version Control novzdcc Step 4 Click Next to the poped up Project Wizard window ind ATA IFE TR AK M BS Project Wizard Welcome This wizard helps you create ar configure a new MPLAB IDE project To continue click Next Wl novzd cc Beld banko banka PIC USERS GUIDE 18F4520 Step 5 Select PIC18F4520 from the drop down list appears in the window opens E S p 1 E M n HR ER E s BE B Project Wizard Step Une Select a device Device PICI SF4520 FIC18F4523 FIC18F4525 FIC18F4538 FIC 18F 455 FIC18F4553 FIC18F458 PICTSF4580 FIC18F4585 FIC18FA4511 0 PIC18F 45 111 PICTSF45 50 FIC1S8FA5K 20 PICTSF4610 PICTSF4620 PICTSF4680 PICTSF4662 PICTSF4685 PICTSF46I11 PICISF46 13 PICT DOE AG E Files px e Step 6 Select HI TECH UNIVERSAL TOOL suite as compiler among the list of toolsuite given and then click Next Sarat BPs BENE es aF dch Project Wizard Step Two Select a language toolsuite LI Active Toolsuite HI TECH Universal T oolS uite se Toolsuite Contents B Knudsen Data CCT E Knudsen Data CCSE alas CIE Bute Craft assembler amp C Compiler CCS C Compiler for PICT 071 2714716718724 dsFICS0 dsPIC33 HI TECH Univers
8. PIC EE 18F4520 SOFTWARE DEVELOPMENT 3 1 TOOLS AND SOFTWARE To get started with PIC microcontrollers we will need some tools and software e APC desktop or laptop with a spare USB port running Windows 7 or XP e Microchips MPLAB Integrated Development Environment e A C compiler e A PIC programmer to load your programs onto the microcontroller without bootloader e A prototyping environment such as rhydoLABZ PIC18F4520 Microcontroller Development Boards The MPLAB development system consists of a system of programs that run on a PC This software package is designed to help develop edit test and debug PIC code Installing the MPLAB package is straightforward and simple Familiarization of MPLAB LITE Development Suite e Creating a Project file e Select Microcontroller from Device Database e Copy and Add the CPU Startup Code e Create New Source Files e Add Source Files to Project e Set Tool Options for Target s mudoLABZ PIC bsp GUIDE 18F4520 3 2 HOW TO TEST Mini USB and Serial Cable are used for programming the Development board Mini When USB cable is connected to the Development board Mm PWR LED Red on the top of Development board Mini module glows which shows the power indication Step 1 Launch MPLAB IDE Administrator y n Internet a My Documents Internet Explorer 5 3 My Recent Documents Ra aj E mail Fe Outlook Express Qj Set Program Access and Defa
9. bank ini Colt PIC YES 18 4520 Step 13 Save the file with c extension in the project folder in sample File Edit View Project Peri ies Sas Tools Een Window Help oe m 5 BEEN Save As K 7 al a E sample Savei Dim 2977 e ToU Fienane Save as type All Source Files ch asm asine s E se Jump to D SPIDABasics 3 usart vi Encoding ANSI we C Add File Ta Project Le PICIBF4520 L Who noze o bank Lni Col INS Step 14 Saved file can be added to source file by right click on source file and select Add Files Sample MPLAB IDE v8 36 Sample mcw File Edit View Project Debugger Programmer Tools Configure Window Help E ubtalder n Filter PIC18F4520 _ WD movzdec rhudoLABZ PIC sp CODE 18F4520 Step 15 Select sample c from the new window opened and click Open Sample MPLAB IDE v8 36 Sample mcw File Edit View Project Debugger Programmer Tools Configure Window Help eee I D up b 5m m Add Files to Project Ii Sample mcw E Sample mcp ES Source Files EZ Header Files Flo name Files of tope Source c as Ka Canca Jump to 5 ample 53 Files Remember this setting Auto Let MPLAB DE guess CO User File s were created especially for this project use relative path System File s are extemal to proj
10. 20 RD1 PSP1 I O LCD 21 RD2 PSP2 I O LCD 22 RD3 PSP3 I O LCD 23 RC4 SDI SDA I O N C 24 RC5 SDO I O N C 25 RC6 TX CK I O TXD XBEE RFID rhudoLABZ PIC 5 GODE EC 26 RC7 RX DT VO RXD XBEE RFID 27 RD4 PSP4 VO LCD 28 RD5 PSP5 P1B lO LCD 29 RD6 PSP6 P1C VO LCD 30 RD7 PSP7 P1D VO LCD 31 vss GND 32 VDD BV Vcc 33 RBO INTO AN10 FLTO VO N C 34 RB1 INTt AN10 VO LED 35 RB2 INT2 AN8 Te LED 36 RB3 AN9 CCP2 VO LED 37 RBA KBIO AN1 1 VO N C 38 RB5 KBI1 PGM VO Pull Up Key 39 RB6 KBI2 PGC VO ICSP 40 RB7 KBI3 PGD VO ICSP rhudoLABZ TECHNICAL SUPPORT If you are experiencing a problem that is not described in this manual please contact us Our phone lines are open from 9 00 AM 5 00 PM Indian Standard Time Monday through Saturday excluding holidays Email can be sent to supportarhydolabz com DISCLAIMER Copyright Rhydo Technologies P Ltd All rights are reserved Reproduction in whole or in part is prohibited without the prior written consent of the copyright owner The information presented in this document does not form part of any quotation or contract is believed to be accurate and reliable and may be changed without notice Contact Us Rhydo Technologies P Ltd An ISO 9001 2008 Certified R amp D Company Golden Plaza Chittoor Road Cochin 682018 Kerala India Tel 0091 484 2370 444 2371 666 Cell 0091 99466
11. 70444 Fax 0091 484 237 0579 Email info rhydolabz com sales rhydolabz com For more information please visit www rhydolabz com rhudoLABZ
12. Settingssuser BiHrDDASDeskrop sample ssarmi A new workspace willbe created and the new project added to that workspace A Sample MPLAB IDE v8 36 Sample mcw File Edit View Project Debugger Programmer Tools Configure window Help E PS Sample mcp ili Source Files Header Files Object Files ia E Library Files i Other Files PIC18F4520 Wid novzdcc banku PIC USERS GUIDE 16F4520 Step 11 Create a new file either by clicking the New File icon or by selecting File gt New or using keyboard shortcut CTRL N Sample MPLAB IDE v8 36 Sele File Edit View Project Debugger Programmer Tools Configure Window Help Dci mm Sawa Debu vti ak ll Bead m s Checksum 0x835a E Untitled DE EI EE Sample mcw nj rj E Sample mcp C Source Files C Header Files E object Files 2 Library Files D Other Files PICi8F4520 Step 12 Created file was saved by selecting File Save as Sample MPLAB IDE v8 36 SS Edit View Project Debugger Programmer Tools Configure Window Help Add Mew File to Project Debug vti m RH Ber rs m Checksum 0x835a E T CErd o P Untit led E fm X Ose ctrl E Ge A BR d Save Chrl 5 Save All CEri4 ShifE4 5 Open Workspace Save Workspace Save Workspace Ae Close Workspace Import Export Print Recent Files Recent Workspaces Exit PICIBF4520 SP w novzdcc
13. contrast to get a better view in every angle Note Jumpers J11 J12 J13 amp J14 will be shorted in PCB by default If RDO RD1 RD2 amp RD3 needs to relieved from LCD connection user needs to manually disconnect the track lying underneath these jumpers Trimmer Pot E WM Illustration 7 LCD s male port on board Illustration 8 16x2 alohanumeric LCD placed on board PIC USER GORE 18F4520 LCDI LCD INTERFACE ax RD7 C23 RD6 0 luf RDS Jil RD3 17 RD 113 RDI E _J14 RDO RCI RCO R23 T mum 59 ung IK 4K7 Remove J11 J12 J13 amp J14 while using Ab LCD Illustration 9 LCD connection schematic _ Eg mudoLABZ PIC USER COME 18F4520 2 8 PULL UP KEY INTERFACING The simplest input to a microcontroller is a switch or push button This can operate with just one additional support component a pull up resistor The resistors R15 R14 and R34 are pull up resistors The input pins RC3 RC2 and RB5 reads high value when the keys are not pressed When the key is pressed it connect the input pin to the ground via a small value resistor Thus input pin get logic low value There are 3 pull up switches in the board connected to RC2 RC3 and RB5 lllustration 10 Pull Up Key on board PULLUP KEY INTERFACE Remove J8 J9 amp J15 when RC3 RC2 RB5 are used for other purpose Illustration 11 Pull up key connection schematic w rhydoL ABZ
14. ind BIER 22 0uf 25 V Illustration 4 Power supply source connection schematic EE mudoLABZ PIC DEER UI 18F4520 2 4 CLOCK SOURCE PIC microcontrollers normally use a quartz crystal for the purpose of providing clock frequency Clock source for PIC18F4520 Development board Mini 20 MHz Crystal as the MCU clock source 2 5 MICROCONTROLLER PINOUT CONTROLLER 35 iban E72 kaa deer 4 e e ji Z d de dick ES PICIGERXX PICISEAS XX PICISFAS550 RNA RR ROU R R5 4H70R R Cli nt ET NA Not appli cable Illustration 4 Microcontroller pinout schematic rhudoLABZ PIC USER COME 18F4520 2 6 LED INTERFACE LED s are semiconductor diodes electronic devices that permit current to flow in only one direction The diode is formed by bringing two slightly different materials together to form a PN junction In a PN junction the P side contains excess positive charge holes while the N side contains excess negative charge electrons When a forward voltage is applied to the semiconducting element forming the PN junction electrons move from N area toward P area and holes move from P area toward N area Near the junction the electrons and holes combine As this occurs energy is released in the form of light that is emitted by the LED The material used in the semi conducting element of an LED determines its color LE
15. D s are the simplest devices to test port functioning There are 3 LED available in our development board General Purpose Input Output RB1 RB2 and RB3 are interfaced with LEDs via jumpers J1 J2 and J10 respectively LED INTERFACE GND GND GND Remove J1 J2 amp J10 when RB1 RB2 RB3 are used for other purpose Illustration 6 LED connection schematic rhudoLABZ PIC E 18F4520 2 LCD INTERFACE The display is a standard 16x2 LCD which displays 2 lines of 16 characters Each character is 40 pixels making it 1280 pixels overall The display receives ASCII codes for each character at the data inputs DO D7 The data is presented to the display inputs by MCU and latched in by triggering the E Enable input The RW Read Write line can be tied low write mode as the LCD is receiving data only The RS Register Select inputs allows commands to be send to the display RS select command data register The display itself contains a microcontroller the standard chip in this type of display is Hitachi HD44780U It must be initialized according to the data and display options required The module can be used in 4 bit or 8 bit mode In our development board we could use either 4 bit or 8 bit interfaces Shorting jumpers J11 J12 J13 J14 selects 8 bit interface amp if removed selects 4 bit interface PORTD pins are used as data command pins while PORTC pins as RS A E pin A trimmer potentiometer is interfaced to adjust the LCD
16. MIN DEVELOPMENT BOARD I lt gt USERS GUIDE 18F45920 make your own ME intelligent embedded world a 5 dem rhudoLABZ PIC E 18F4520 TABLE OF CONTENTS 1 0 OVER VIEU e P 2 1 1 CONTROLLER SPECIFICA IQN retenue reno rane onn nnn narrare 2 1 2 oC GN 000 ic E 3 2 0 HARDWARE INTHODUCTIODL sica cusuecuuxsacs sini aeavnesevaworercenneneseetaanversvossasinenemceentviwtcenovaust 9 2 1 BLOCK DIA GRAM m 5 2 2 INTERFACE OVERVIEW E 6 2 3 FOWE RE EE 9 2 4 OO G GSO 0 0 eee 10 2 5 MICROCONTROLLER PIN OUT 10 2 6 LED INTERFACING siseses P H 11 2 7 Bengel LE cteceveccessecteecadehe tne seuendnctducdnccesaecbadiesttivesductdestacsiadsatalenrurseactescevades 12 2 8 PULL UP KEYS INTERFACING c ccccccesseecsssceecceeeeecceseeccceneeccoeeeesseeeeescesers 14 2 9 BUZZER INTERFACING cessere nar EKES EEE AAE EERS 15 2 10 UNIVERSAL SYNCHRONOUS ASYNCHRONOUS RECIEVER TRANSMITTER 16 2 11 SN KEE 22 2 12 E UAR RE 22 2 13 ZG IE ENING ESR AGIIN Gy saatestecssteae cape cst os cccecicsiadicocviensetesnpaceovetnctevewcouesnecee EO EET 23 2 14 Pe INTE AGIN O E 24 2 15 ANALOG TO DIGITAL CONVERTER MODUUE esee 26 2 16 ICSP CONNECTOR AND RJ 11 PINOUT eere 28 2 17 SERVO MOFI vT
17. PIC into programming mode this line must be in a specified range that varies from PIC to PIC For 5V PICs this is always some amount above Vdd and can be as high as 13 5V The 3 3V only PICs like the 18F 24H and 33F series use a special signature to enter programming mode and Vpp is a digital signal that is either at ground or Vdd There is no one Vpp voltage that is within the valid Vpp range of all PICs In fact the minimum required Vpp level for some PICs can damage other PICs Vdd This is the positive power input to the PIC Some programmers require this to be provided by the circuit circuit must be at least partially powered up some programmers expect to drive this line themselves and require the circuit to be off while others can be configured either way like the Microchip ICD2 The Embed Inc programmers expect to drive the Vdd line themselves and require the target circuit to be off during programming 9 Vss Negative power input to the PIC and the zero volts reference for the remaining signals Voltages of the other signals are implicitly with respect to Vss ICSPCLK Clock line of the serial data interface This line swings from GND to Vdd and is always driven by the programmer Data is transferred on the falling edge ICSPDAT Serial data line The serial interface is bi directional so this line can be driven by either the programmer or the PIC depending on the current operation In either case this line swings fro
18. SP K3 USB Socket K9 2 Pin RMC connector Male K5 DB9 Female Connector K10 ICSP Connector K1 K2 K7 K8 K12 K13 Controller Port pins K14 CAN Interface used only in PIC18F4580 dev board K15 amp K17 5V UART amp 3V3 UART K16 Connector for servomotor rhudoLABZ PIC USER CODE 18F4520 Power Supply 1 2 Select USB power J18 Options 2 3 Select external DC power J11 J12 J13 J14 LCD Short access Enables LCD for 8 bit mode J16 Potentiometer Short access Enables ADC connection via POT J17 Temperature Sensor Short access Enables temp sensor connection J1 J2 J10 LED Short access Enables LED connection J8 J9 J15 Pull Up Key Short access Enables Pull Up Key connection J19 Buzzer Short access Enables buzzer connection J20 J21 ZigBee Short access Establish ZigBee connection 1 2 RS232 Connection J3 J4 DUI 2 3 USB Connection w rhudoLABZ PIC DEER UE 18F4520 2 3 POWER SUPPLY PIC18F4520 Board has three power supply options as follows Through the on board USB port 5V Through RMC Connector 7V 12V External DC Power Supply Through Barrel Jack Connector 7V 12V External DC Power Supply Note For power selection jumper J18 must be in position 1 Barrel Jack Connector 2 USB port 3 2 Pin RMC Connector Male POWER SUPPLAY 2C iU 47uf 16V POWER SUPPLY SELECTION i CIS C2
19. al ToolS uite 4A PIC18 S Lob Systems Midrange j Location Microchip C18 T oolsuite C Program Files sHUMicrochip MPASM T oolsuite Store tool locations inc project H elp Mu 5 uite ent Listed ES Files J PICIBF4580 WD novzdcc PIC USERS GUIDE 16F4520 Step 7 Create a project file at desired name in a suitable location with appropriate name m MPLAB IDE y8 36 Project Wizard Step Three Create a new project or reconfigure the active project Bl Untitled Wor 85 Create New Project File 5 ample 5 ample Reconfigure Active Project Make charges without saving L Save changes to existing praject fie Save changes to another project Hle i Step 8 In next window open add any files you desire to add to your new project if required else just skip this step by clicking Next MPLAB IDE v8 36 File Edt View NOS KT ET Step Four Add existing files to your project MS Untitled Wor ze E BL Documents and Settings E HTSOFT e Remove a Program Files m L Sample mp CH WINDOWS E AUTOEXEC BAT Cancel PIC EZ 18 4520 Step 9 Click Finish to the following window open Nh SS Project Wizard 1 Summary Click Finish to creates configure the project with these parameters o Project Parameters Device PIC1SF 4520 Tooleuite HI TECH Universal ToolSuite File C Documents and
20. ammable external interrupts Four input change interrupts Up to 2 Capture Compare PWM CCP modules one with Auto Shutdown 28 pin devices Enhanced Capture Compare PWM ECCP module 40 44 pin devices only One two or four PWM outputs Selectable polarity Programmable dead time Auto Shutdown and Auto Restart Master Synchronous Serial Port MSSP module supporting 3 wire SPI all 4 modes and l2C Master and Slave Modes Enhanced Addressable USART module Supports RS 485 RS 232 and LIN 1 2 RS 232 operation using internal oscillator block no external crystal required Auto Wake up on Start bit Auto Baud Detect 10 bit up to 13 channel Analog to Digital Converter module A D Auto acquisition capability Conversion available during Sleep Dual analog comparators with input multiplexing Four Crystal modes up to 40 MHz 4X Phase Lock Loop available for crystal and internal oscillators Two External RC modes up to 4 MHz Two External Clock modes up to 40 MHz Internal oscillator block 8 user selectable frequencies from 31 kHz to 8 MHz Provides a complete range of clock speeds from 31 kHz to 32 MHz when used with PLL User tunable to compensate for frequency drift Secondary oscillator using Timer1 32 kHz Fail Safe Clock Monitor Allows for safe shutdown if peripheral clock stops C compiler optimized architecture Optional extended instruction set designed to optimi
21. ctor for Debugging Programming On board ICSP connector for Debugging Programming On board 20 MHz crystal oscillator On board DBY female connector On board mini USB connector On board 5V UART pins On board 3V3 UART pins There is a provision to interface ZigBee module There is a provision to interface RFID module There is a provision to interface servomotor There is a provision to attach mini bread board Male and Female berg strips to access port pins LAYOUT OF PIC18F4520 DEVELOPMENT BOARD MINI on gt gt WEEK K15 E 33258 ePPRPReRPRPR SP LER K2 GELI TI _ m LCD ES CIC J4 e amm mim BIN mm mm mim Hills mu TE m b z Wa Sum BIR PIC YE 18F4520 PACKAGE CONTENTS Fully Assembled and Tested PIC18F4520 Development board mini RS232 Serial Cable USB cable A to B software CDROM with User Manual Schematic Programming Software Sample Hex Code Example Codes for Led Blinking LCD Display Led Control with Timer UART Communication PWM Generation Buzzer Interfacing ADC Interfacing SYSTEM SPECIFICATION Power Supply via 1 USB cable 5V 2 DC barrel jack connector 7 12V 3 RMC connector 7 12V 50mA in idle state when On board modules are inactive Dimension is 82 34mm x 96 08mm 9 Weight is 92g w rhudoLABZ PIC EXE 18 4520 HARDWARE INTRODUCTION 2 1 BLOCK DIAGRAM DB9 female KDS 20 MHz
22. ect use absolute path PICIBF4520 0 wn nouzdr Step 16 Type the code Sample MPLAB IDE v8 36 Sample mcw Secs File Edit View Project Debugger Programmer Tools Configure Window Help D Li iM SAW AB Dema vie ae lal Eb um O RR Checksum one WD vGamplekampnle malk Wisampleemcw E EX f amp includeczpicl8 h fdefine RS RC EN define EN RCI define SWI RC3 LY Object Files define SWZ RCZ E Library Files define SW3 RBS 1 Other Files define LEDI RB1 Lies define LED RBZ define LED RB3 fdefine Buzzer REO define Servo REI define ON A define OFF 0 void LCD Init void PICIBF4520 aUi wn novzdcc PIC USERS GUIDE 16F4520 Step 17 Code can be compile by clicking the Build All icon Build the project Errors if any get listed in the Build output window Correct them and build again On successful building the hex file will be generated in the project folder fe s Sample MPLAB IDE v8 36 File Edit View Project Debugger Programmer Tools Configure Window Help D a d me Shs ae 9 Debu vl ue Bead BR Checksum 0x79e2 CENE C a Eli Sample mcw O C Sample Sample c B Gg Sample mcp C Source Files E Sample c Warning 1385 C Sample Sample c 402 J Header Files arning Noample Sample c e TK C3 Header Fil V 1090 C Sample Sampl 47 3 object Files Warning 765 C Sample Sample c 239
23. g piccodes ini not found 115200 Search COM Step 19 Click Write Flash and simultaneously press Reset button on development on development board After successfully flashing the code into the controller it can be used for the desired purpose ir RhydoBootloader Sample hex 1 5 ample 5 ample hes j Messages Terminal Options tera pt Connecting Ahydo Bootloader v1 3 8 CheckPIC Email infoc amp rhyda com MM http ie rho corn Warning piccades ini rot Found emm Connected to SM SEDIT at 115200 HE aa 506 days old IHH 2232 18F code taotal 3342 bytes 1 1 52D Searching for PIC Faund 18F 258 458 SE e WRITE DK at 18 09 time 0 094 sec com COM24 Bela Browse rhudoLABZ PIC Tae 18F4520 UO DISTRIBUTION 4 1 THE PIN DISTRIBUTION OF PIC18F4520 DEVELOPMENT BOARD 1 MCLR VPP RES3 Reset Key 2 RAO ANO I O ADC Input potentiometer 3 RA1 AN1 I O ADC Input Tempe Sensor 4 RA2 AN2 VREF CVREF I O N C 5 RA3 AN3 VREF I O N C 6 RAA TOCKI C1OUT N C 7 RA5 AN4 SS LVDIN C2OUT I O N C 8 REO RD AN5 I O BUZZER 9 RE1 WR AN6 I O SERVOMOTOR 10 RE2 CS AN7 I O N C 11 VDD DV Vcc 12 VSS GND 13 OSC1 CLKIN RA7 14 OSC2 CLKOUT RA6 15 RC0 T1OSO T13CKI I O LCD 16 RC1 T1OSI CCP2 UC LCD 17 RC2 CCP1 P1A UC Pull Up Key 18 RC3 SCK SCL UC Pull Up Key 19 RDO PSPO I O LCD
24. gbee amp RFID module Remove J3 amp J4 while RC6 amp RC7 are used for other purpose Illustration 15 RS232 Module Schematic s mudoLABZ PIC 5p GUIDE 18F4520 CP2102 USB Interfacing The CP2102 is a highly integrated USB to UART Bridge Controller providing a simple solution for updating RS 232 designs to USB using a minimum of components and PCB space The CP2102 includes a USB 2 0 full speed function controller USB transceiver oscillator EEPROM and asynchronous serial data bus UART with full modem control signals in a compact 5 x 5 mm MLP 28 package No other external USB components are required Illustration 12 CP2102 Module USB INTERFACE 3V AN 5 ee fox y QI Ke 29 em C30 TAL CP TXD 4 7uf 0 1uf BSS138 IK 3V 5 4 VUSB GND D Ve y Q2 Ke 131 C32 ATL CP RXD BSS138 5 lOuf16V O luf C47 CP2102 R18 0 1uf GND 48 T 7uf D GND 10K C33 0 1uf 4 Q Z Use proper jumper J3 amp J4 selection while using USB Illustration 13 CP2102 Module schematic e mudoLABZ PIC USER GORE 18F4520 USING REALTERM IN PC Real term is a testing analyzing and simulation tool for serial communication protocols It allows us to monitor communication between two serial devices or to test the serial communication of a single devices Realterm can be download by download Steps for creating RealTerm in PC The serial data transmitted thro
25. hange _ RSD 2 pace E ER OF TxD 3 Hex Ascii Hm Data Frames EH AND ET5 8 is Bytes 2 suncis DCD 1 intl E Singe Gulp f Mone ASCI Number E DSA 5 wink E Ring 3 Hoas M _ BREAK Sey Terminal Fort i Ej Error E EEN Char Count 0000000 CPS 0 Mo USAT Dverrun No Buffer Overflow No Other Errors Port 1 5760 Char Count 000000 LPS 0 Ho USAT Overrun Wo Buffer Overflow Mo Other Errors Port 1 5760 Step 3 Port Tab To test the connection make sure the Open button is pressed Select required baud rate and the Port dropdown here select the number of your COM port and then press the Change button x Reallerm Serial Capture Program 1 99 0 34 yt L gt An Clear Freeze Status 1 RD 2 Parity Data Bits gt Stop Bits Software Flow Control _ TesD 3 Mane GG Obits Ze 1 bit 2 bits Receive on Char 17 CTS II Odd e Even bits Hardware Flow ControF Transmit Set Char 13 BED 1 Mak Bbis e None RTS CTE _ DSA 6 Space C Bbits C DTR DSH RS485 Ring 9 BREAK SE trer Char Count 0000000 No USAT Overrun Mo Buffer Overflow Mo Other Errors Port 1 5760 PIC bsp COMDE 18 4520 Step 4 Send Tab Insert the desired data to be transmitted and press Send ASCII button RealTerm Serial Capture Program 1 99 0 34 lt Ee com ze Send Numbers
26. ility for ZigBee interfacing Communication with the ZigBee module uses a standard UART interface compatible with 3V3 Short J20 and J21 while using ZigBee XBEE R35 R36 Ir O4 y I 3V3 J20 Ss RC7 d IPL RXLV Kees cn XBTX B5513 Q 1uf 1 20 5 Me 3 19 3 18 C45 4 17 DN RST R37 R38 5 16 Ir o 4 K 6 15 Q luf J 1 7 14 RC6 i JL TX LV 8 13 z 9 12 XBRX BSS138 i0 m T ZIGBEE MODULE GND Remove J3 amp J4 while using Xbee Illustration 23 ZigBee Module Schematic e mudoLABZ PIC USERS GUIDE 18F4520 2 14 RFID INTERFACING Radio frequency identification RFID is the wireless use of electromagnetic fields to transfer data for the purposes of automatically identifying and tracking tags attached to objects The tags contain electronically stored information The RFID device serves the same purpose as a bar code or a magnetic strip on the back of a credit card or ATM card it provides a unique identifier for that object Unlike a barcode the tag does not necessarily need to be within line of sight of the reader and may be embedded in the tracked object RFID is one method for Automatic Identification and Data Capture AIDC RFID is a method of identifying unique items using radio waves Typical RFID systems are made up of three components readers interrogators antennas and tags transponders that carry the data on a microchip SM Illustration 30 RFID Reader on board
27. in of PIC18F4520 Therefore the 10 bit ADC will convert any analog voltage between 0 5V to a digital number ranging from 0 1023 The number will be displayed on the LCD The device that performs either conversion is called an A D or analog to digital converter Illustration 18 Potentiometer for ADC Remove jumper J16 when RAO is used for other purpose Illustration 19 Potentiometer for ADC Schematic w rhydoL ABZ PIC E 18F4520 Analog pin RA1 interfaced to a Temperature sensor MCP9700 temperature sensor can be used to measure ambient temperature in the range of 55C to 150C TEMPERATURE SENSOR GND GND GND Illustration 20 Temperature Sensor on board Remove jumper J17 when RAI is used for other purpose Illustration 21 Temperature Sensor Schematic rhudoLABZ PIC USER COIDE 18F4520 2 16 ICSP CONNECTOR AND RJ 11 PINOUT In Circuit Serial Programming is the ability of some programmable devices microcontrollers and other embedded devices to be programmed while installed in a complete system This is a Six PIN male connector used to upload debug programs to microcontroller Pinout of RJ 11 is same as that of ICSP so it can be used for debugging programming the controller Signals and pinout Vpp Programming mode voltage This must be connected to the MCLR pin or the Vpp pin of the optional ICSP port available on some large pin count PICs To put the
28. m GND to Vdd A bit is transferred on the falling edge of PGC Illustration 24 ICSP Port and RJ 11 Port Schematic w rhydoL ABZ PIC sp GUIDE 18F4520 Illustration 24 ICSP Port on Development Board mini Illustration 25 Rj 11 Pinout 2 17 SERVO MOTOR INTERFACING A servomotor is a rotary actuator that allows for precise control of angular position velocity and acceleration It consists of a suitable motor coupled to a sensor for position feedback Servomotors are controlled by sending an electrical pulse of variable width or pulse width modulation PWM through the control wire There is a minimum pulse a maximum pulse and a repetition rate Here the control line is connected to the RE1 pin of the microcontroller The control signal can be created by using by timers with required duty cycle SERVO MOTOR Illustration 26 Servo motor Illustration 27 Servo motor connector Schematic sa mudoeLABZ PIC Uo eR COIDE 18F4520 2 18 PORT EXPANDER ADDITIONAL INPUT OUTPUT PORTS The PIC18F4520 development board has all port pins available at direct port access connectors male amp female The connections are as given below GPIO Pins Near Bread Board GPIO Pins Near Controller Illustration 33 GPIO near breadboard Schematic Illustration 34 GPIO near controller Schematic Illustration 35 GPIO near breadboard Illustration 36 GPIO near controller A uge ABZ
29. ugh USART can be viewed on a PC using a Windows tool for Serial Port Communication called Realterm Step 1 All program RealTerm realterm Set Program Access and Defaults Windows Catalog gt Windows Update ign Accessories an Avira lE CPUID KU PS Foxit Reader 5 1 d e Games d I HI TECH Software irn Microchip E OpenOffice 4 1 1 Internet Mozilla FireFox E mail each Outlook Express Calculator AVR Studio 4 Keil u isiond Pw Ul ang RealTerm realterm irm Startup FT WinRAR Em reaterm comi 57K Bn realterm COM1 115K Shortcut En arduir 1 Internet Explorer Keil uvision4 e Mozilla Firefox a Outlook Express Cha realterm register server Motepad Foxit Reader 5 1 HyperTerminal Remote Assistance e Windows Media Player Paint A Windows Messenger GC Windows Movie Maker eu ss SI Shortcut to LPCzZ10x f i Atmel AVR Tools i Wy Keil uvision3 en Philips Semiconductors MPLAB IDE All Programs w rhudoLABZ Step 2 Display Tab Here the output text format selected is ANSI and Half Duplex mode is enabled to view the data sent by the user E Reallerm Serial Capture Program 1 99 0 34 t A Misc An Clear Freeze Display As Half Duplex Binary Sunc Chars status EF ie Henr ine gp x Connected Te ind 3 iret Dale w C
30. ults ed Windows Catalog to Windows Update di e Accessories ed Games EH Startup I MEUSE F Maestro amp Internet Explorer F1 Documentation A ze MsN A MPASIMWIM Outlook Express MPLAB IDE s B IDE v8 38 Re Remote Assistance EA MPLAB IDE Help P Windows Media Player DP Setup MPLAB Tools SS Windows Messenger m Visual Procmd n D Tour Windows xP Wizard All Programs Sk Windows Movie Maker EJ Lag OFF 2 Disconnect C1 w rhudoLABZ B C USERS GUIDE 18F 4520 Step 2 The MPLAB IDE window opens as shown below M MPLAB IDE VB 36 MN DER File Edit View Project Debugger Programmer Tools Configure Window Help ng B imm s Checksum Ii Untitled Wor PICLEF File Edit View Project Debugger Programmer Tools Configure Window Help DsH mm AGAR gard he Checksum x fcf Untitled Wor EIER LITT Build Version Control Find in Files PICIBFR77 WO dec banko PIC 5p GODE 16F4520 Step 3 To create a new project select Project Project Wizard from menu bar MPLAB IDE v8 36 File Edit View TEI Debugger Programmer Tools Configure Window Help ef a Em Checksum 0 a DEK C Files Project Wizard ew Open tput close Version Contral Find in Files Seb Active Project Quickbuild no asm File Package in zip Clean Build Configuration Build Options
31. unicate with peripheral devices such as A D or D A integrated circuits serial EEPROMS etc Note The baud rate range for the PIC microcontroller is 300 to 115200 The main features are e Full duplex operations e Asynchronous or synchronous operation e Master or slave clocked synchronous operation e High resolution Baud Rate generator e Odd or even parity check supported by hardware e Data Over Run detection e Framing Error Detection e Noise filtering includes false start bit detection and digital low pass filter e Multiprocessor communication mode e Double speed asynchronous communication mode w rhydoL ABZ PIC 5p GUIDE 18F4520 RS 232 Interfacing RS 232 is a standard communication protocol for linking computer and its peripheral devices to allow serial data exchange Since RS 232 communication voltage levels are different than microcontroller logic levels it is necessary to use a RS 232 Transceiver circuit Here we use serial driver IC MAX232 for interfacing RS 232 with microcontroller UART module A DB9 female connector is provided to make direct connection with the serial port of a device or PC Illustration 14 RS232 Module on board RS232 un C9 18 C6 0 luf 0 1uf 0 luf 2 3 6 CP TXD 4 C8 gc 9 C7 0 luf 5 0 1uf 9 5 4 8 R3 9 8 3 pps a H R2 1K 7 J4 l RC6 TVA CP RXD Use proper jumper J3 amp J4 while using RS232 amp USB Remove J3 amp J4 while using Zi
32. ze re entrant code 100 000 erase write cycle Enhanced Flash program memory typical 1 000 000 erase write cycle Data EEPROM memory typical Flash Data EEPROM Retention 100 years typical Self programmable under software control Priority levels for interrupts 8x 8 Single Cycle Hardware Multiplier Extended Watchdog Timer WDT Programmable period from 4 ms to 131s Single supply 5V In Circuit Serial Programming ICSP via two pins In Circuit Debug ICD via two pins Wide operating voltage range 2 0V to 5 5V Programmable 16 level High Low Voltage Detection HLVD module Supports interrupt on High Low Voltage Detection Programmable Brown out Reset w rhudoLABZ PIC USER GODE 18F4520 1 2 KEY FEATURES OF PIC18F4520 DEVELOPMENT BOARD MINI pe POI Ue uc Compact and Ready to use Professional EMI RFI Complaint PCB Layout for Noise Reduction High Quality Two layer PTH PCB The board is moderate in size Board supports 40 pin PIC microcontrollers No separate power adapter required USB power source RMC Connector and barrel jack connector for external power supply with jumper select option HS232 and CP2102 Interface for direct connection to PC s serial USB port On board two line LCD display 2x16 On board Reset button Built in potentiometer interface for ADC On board Temperature Sensor Interface On board Buzzer Interface On board JTAG conne

Download Pdf Manuals

image

Related Search

Related Contents

April 2007 Number 45  Display - Service, Support  Philips 39PFL3850 39" Full HD Black  96M5771o User's Manual  第89回定時株主総会招集ご通知(PDF)  TK6305取説  Phonix NL625CAM mobile phone case  MANUAL DEL USUARIO - Icon Heath & Fitness  Philips Linea 31091/31/66  Samsung 320MX-3 Kasutusjuhend  

Copyright © All rights reserved.
Failed to retrieve file