Download LV 18FJ Manual - MikroElektronika
Transcript
SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD MikroElektronika Development tools - Books - Compilers LV18FJ User’s Manual 3 in 1 USB 2.0 Serial Ethernet IN-CIRCUIT SUPPORTED mikro PROGRAMMER ICD IN-CIRCUIT DEBUGGER With useful implemented peripherals, plentiful practical code examples and a broad set of add-on boards (Serial Ethernet, Compact Flash, MMC/SD, ADC, DAC, CAN, RTC, RS-485, etc.), MikroElektronika development boards make fast and reliable tools that can satisfy the needs of experienced engineers and beginners alike. Software and Hardware solutions for Embedded World LV18FJ KEY FEATURES 1. External power supply 8-16 V AC/DC. 2. Choose between external and USB power supply. 3. Very fast and flexible on-board USB pro grammer. The key feature is expandability. By downloading new software, you will be able to program new MCUs in coming years. 4. DS1820 temperature sensor allows to measure temperature with 0.5°C accuracy. 5. Two RS232 ports for communication with PC or another microcontroller. 6. 16-channels for MCU Analog-to-Digital Converter. 7. MMC/SD Multimedia card socket. 8. Jumpers to select default logic state of the appropriate pins. 9. LCD connector allows easy connection of LCD in 4-bit mode. 10. Graphic LCD connector allows easy connection of GLCD. 11. 70 buttons allow control of every pin on the microcontroller. 12. Buttons to select high/low state of the pins. 13. See all the signals -each pin has a LED. 14. On-board Ethernet socket. 15. Switches on the SW2 turns on/off the LEDs on ports. Select port to connect LEDs to. These switches are used to disconnect all LEDs from MCU pins. 16. Set LCD contrast according to display characteristics. 17. Set GLCD contrast according to display characteristics. 18. On-Board peripherals are connected to the microcontroller via switches. 19. Enabling/disabling ethernet connection to MCU. 20. Reset circuit - if the reset button is pressed MCU will start execut ing from the beginning of the program. 21. MikroElektronika’s MCU card. Development board dimensions Width 250 mm 9.84 Inches Height 210 mm 8.27 Inches CONTENTS LV18FJ User’s Manual MikroElektronika Development tools CONTENTS LV18FJ with USB 2.0 PROGRAMMER CONNECTING THE SYSTEM page 4 INTRODUCTION page 5 DESCRIPTION OF THE DEVELOPMENT SYSTEM page 6 Switches and their functions page 6 Jumpers page 7 MCU sockets page 8 Power Supply page 10 On-Board USB 2.0 programmer page 11 MikroICD debugger page 12 LEDs page 13 Pushbutton switches page 15 Graphic LCD page 18 LCD 2x16 in 4-bit mode page 19 RS-232 Communication Serial Ethernet page 20 page 22 Digital Thermometer page 24 MCU A/D Converter Support page 25 Direct port access page 26 MMC/SD Connector page 28 page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 3 CONNECTING THE SYSTEM LV18FJ User’s Manual MikroElektronika Development tools CONNECTING THE SYSTEM The development system box contains a development system, product CD, USB cable, RS232 cable and this manual. Step no.1 First of all, take the system out of the box. Unpack the USB cable and connect it to the PC. Do not connect it to LV18FJ yet. Step no.2 Install the PICFlash programmer. Start the installation from the product CD: CD_Drive:\zip\lv18picflash.zip Step no.3 Open the folder CD_Drive:\zip\drivers and run installation for the appropriate operating system. Do not connect LV18FJ until the installation is finished. Step no.4 Connect USB cable to LV18FJ. Run and use LV18PICFlash.exe as explained in the document ‘lv18PICFlash with mikroICD support’ CD_Drive:\pdf\lv18picflash_manual After these four steps your LV18FJ is installed and ready for use. You can now read a program from the chip or load an example from the product CD. page 4 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD LV18FJ with USB 2.0 PROGRAMMER LV18FJ DEVELOPMENT BOARD INTRODUCTION The LV18FJ development system is a full-featured development board for Microchip’s low voltage microcontrollers. It is designed to allow students and engineers to easily test and explore the capabilities of low-voltage microcontrollers. It also allows low-voltage microcontrollers to be interfaced with external circuits and a broad range of peripheral devices, making it possible for the user to concentrate on software development. Figure 1 illustrates the development board. There are identification marks beside each component on a silkscreen. These marks describe connections to the microcontroller, operation modes and provide additional information. Since all relevant information is provided on the board there is almost no need for additional schematics. Figure 1. LV18FJ with USB 2.0 PROGRAMMER LV18FJ development board page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 5 INTRODUCTION LV18FJ User’s Manual MikroElektronika Development tools SWITCHES LV18FJ User’s Manual MikroElektronika Development tools SWITCHES The LV18FJ development board features a number of peripherial devices. In order to enable them before programming, the appropriate jumpers or switches have to be properly set. Switches are devices that have two positions - ON and OFF, which having the role to establish or break connection between two contacts. The LV18FJ development board has three groups of switches. The first group, SW1, is used to enable SPI communication for interfacing with MMC/SD multimedia card. It is also used for RS-232 communication. Switches of the SW2 are used to enable LEDs connected to ports. For example, if the switch enabling PORTB is OFF, all PORTB LEDs will be turned off. Switches of the SW3, SW4 and SW5 are used for controlling output port pins by enabling/disabling them. Figure 2. ON 1 2 3 4 5 6 7 8 Group of 8 switches Switch 2 is ON, other switches are OFF Switch is ON Switch is OFF page 6 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD LV18FJ with USB 2.0 PROGRAMMER JUMPERS Jumpers, like switches, can break or establish connection between two points. Under the plastic cover of a jumper there is a conductive contact which establishes connection when the jumper is placed over two pins. For example, the jumpers J9 and J10 are used to connect or disconnect ethernet leds to the RA0 and RA1 pins, respectively. In order to establish a connection, the jumper should be placed over two contacts. Jumper is ON Jumper is OFF Figure 3. Jumper as a switch Jumpers are commonly used as selectors between two possible connections via three pin connector. As illustrated in Figure 4, the connector in the middle can be connected to the left or right pin, depending on the jumper’s position. Figure 4. All lines are disconnected Left line is selected Right line is selected Jumper as a multiplexer LV18FJ with USB 2.0 PROGRAMMER page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 7 JUMPERS LV18FJ User’s Manual MikroElektronika Development tools MCU SOCKETS LV18FJ User’s Manual MikroElektronika Development tools MCU SOCKETS LV18FJ is delivered with the PIC18F97J60 64-pin microcontroller. User can remove this chip and fit a different microcontroller into MCU socket. Figure 5. MCU’s socket There is a white line around MCU socket which outlines the proper position of the MikroElektronika Card. Be sure that the upper left corner of the card with label LV18FJ MCU CARD maches the upper left corner of the outlined image with the same label. Figure 6. MCU placed on socket Figure above illustrates MCU Socket before placing the MikroElektronika card. Figure 6 on the right illustrates MCU Socket with properly placed MikroElektronika card. page 8 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD LV18FJ with USB 2.0 PROGRAMMER Microcontroller’s pins are routed to various peripherals as illustrated in Figure7. All ports are directly connected to Direct Port Access connectors. Such connectors are normally used for connecting external peripherals to the board or for providing digital logic probes for testing and measuring. All ports are connected to LEDs, push-button switches and pull-up/down resistors, which allow easy monitoring and testing of digital pin state . Some pins are connected to other peripherials such as DS1820 temperature sensor, RS-232 communication, 7-segment displays, LCD etc. SW2 RC1 PORTE VCC VCC ON CN17 1 2 3 4 5 6 7 8 PORTE VCC J1 RE1 J19 PORTE RE1 RE2 RE3 RE4 RE5 RE6 RE7 RD0 Vdd Vss RD1 RD2 RD3 RD4 RD5 RD6 RD7 VCC Figure 7. LV18FJ C17 10K PIC18F6XJ11 PIC18F6XJ16 RB0 RB1 RB2 RB3 RB4 RB5 RB6 Vss OSC2/CLK0 OSC1/CLK1 Vdd RB7 RC5 RC4 RC3 RC2 RF1 ENVREG AVdd AVss RA3 RA2 RA1 RA0 Vss Vdd RA5 RA4 RC1 RC0 RC6 RC7 K88 100n Reset R30 VCC RE1 RE0 RG0 RG1 RG2 RG3 MCLR RG4 Vss Vddcore RF7 RF6 RF5 RF4 RF3 RF2 X1 10MHz C1 22pF C2 22pF System connection with USB 2.0 PROGRAMMER page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 9 MCU SOCKETS LV18FJ User’s Manual MikroElektronika Development tools POWER SUPPLY LV18FJ User’s Manual POWER SUPPLY SELECTABLE MikroElektronika Development tools POWER SUPPLY LV18FJ has two kinds of power supply- regulated supply from the USB cable (default) or external power supply. In case of the USB power supply, the system should be connected to PC using the USB programming cable, while the power supply selection switch should be set in the right-hand position. In case of the external power supply, the LV18FJ board produces +5V using an LM7805 voltage regulator. The external power supply can be AC or DC. Power supply voltage can be in the range of 8-16V and the power supply selection switch should be set in the lefthand position. Figure 8 illustrates USB and external power supply connectors. Figure 9. Power supply selection switch Figure 8. USB and power supply connectors USB connector External power supply connector CN11 1 8-16V (AC/DC) 2 1 Vin + DB1 8280C1500 C14 E17 470uF 100nF Vout GND 2 EXT 2 3 5V CN10 USB 5V FP1 3 C6 100nF C15 100nF VCC D- D+ GND 1 CON2 Power selection switch REG4 7805 USB 2.0 USB Programmer Connector E18 470uF Figure 10. Power supply schematic VCC page 10 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD LV18FJ with USB 2.0 PROGRAMMER USB 2.0 IN-CIRCUIT PROGRAMMER ON-BOARD USB 2.0 PROGRAMMER There is no need to use external equipment during programming, as the LV18FJ development system has its own on-board USB 2.0 programmer. All you need to do is to connect the system to PC using the USB cable. Then, load your program into the microcontroller via the PICFlash programming software supplied with the board. Figure 11. On-Board USB programmer Note: After programming, the programmer will reset MCU automatically. VCC 1K POWER TO PERIPHERALS ON DEVELOPMENT BOARD VCC VCC RE2 RE3 RE4 RE5 RE6 RE7 RD0 Vdd Vss RD1 RD2 RD3 RD4 RD5 RD6 RD7 RF1 ENVREG AVdd AVss RA3 RA2 RA1 RA0 Vss Vdd RA5 RA4 RC1 RC0 RC6 RC7 PIC18F6XJ11 PIC18F6XJ16 RB0 RB1 RB2 RB3 RB4 RB5 RB6 Vss OSC2/CLK0 OSC1/CLK1 Vdd RB7 RC5 RC4 RC3 RC2 10K C6 100nF FP1 F.BEAD CN8 R34 USBDN USBDP R35 X1 10MHz C1 22pF K88 VCC VCC D- D+ GND RE1 RE0 RG0 RG1 RG2 RG3 MCLR RG4 Vss Vddcore RF7 RF6 RF5 RF4 RF3 RF2 8051Flash On-Board USB programmer MULTIPLEXER Reset C17 RSTbut 100n 1K R30 USB LINK USB 2.0 USB Programmer Connector C2 22pF Programmer schematic Figure 12. LV18FJ with USB 2.0 PROGRAMMER page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 11 O N- B O A R D U S B P R O G R A M M E R LV18FJ User’s Manual MikroElektronika Development tools mikro IN-CIRCUIT-DEBUGGER LV18FJ User’s Manual ICD IN-CIRCUIT DEBUGGER MikroElektronika Development tools mikroICD (IN CIRCUIT DEBUGGER) mikroICD is a highly effective tool for Real-Time debugging on hardware level. The mikroICD debugger enables you to execute a program on the LvPIC microcontroller and view variable values, Special Function Registers (SFR) and EEPROM while the program is running. mikroICD can be used within any of MikroElektronika’s compilers for LvPIC (mikroC, mikroBasic or mikroPascal). You just have to select the appropriate build type (Release or ICD Debug), build the project, program the MCU, select the appropriate debugger (mikroICD Debugger) and that’s all. The mikroICD debugger uses the PICFlash programmer to communicate with the compiler and supports common debugger commands: Start Debugger Run/ Pause Debugger Toggle Breakpoint Run to cursor Step Into Step Over Flush RAM Stop Debugger [F9] [F6] [F5] [F4] [F7] [F8] [F2] [Ctrl+F2] Figure 13. On-Board USB programmer Note: For more information on how to use mikroICD debugger please refer to the mikroICD documentation “mikroICD User’s Manual”. You can also find it within the Help documentation inside any of the compilers mentioned above. page 12 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD LV18FJ with USB 2.0 PROGRAMMER LEDs Light Emitting Diodes (LEDs) are the most commonly used components, usually for displaying pin’s digital state. LV18FJ has 70 LEDs connected to the microcontroller’s PORTs. Figure 14. Light Emitting Diodes Each group of eight LEDs can be enabled or disabled using the SW2. Figure 14 illustrates the connection between LEDs and PORTB on the microcontroller. A resistor is used in series with the LED to limit the LED's current. In this case the resistor's value is 1K. LV18FJ with USB 2.0 PROGRAMMER page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 13 LEDs LV18FJ User’s Manual MikroElektronika Development tools LEDs LV18FJ User’s Manual MikroElektronika Development tools The LEDs are enabled when the corresponding switch on the SW2 is on. When enabled, LEDs will display the state of the corresponding microcontroller pin; otherwise the LEDs are always off, no matter what the port state is, as no current can flow through LED. Figure 15. LED schematic RN2 PORTD PORTE PORTF PORTG PORTH/J ON PORTB PORTC 1 2 3 4 5 6 7 8 PORTA LEDs ON RB0 1 2 3 4 5 6 7 8 9 RB1 RB2 RB3 RB4 RB5 8x1K RB6 RE2 RE3 RE4 RE5 RE6 RE7 RD0 Vdd Vss RD1 RD2 RD3 RD4 RD5 RD6 RD7 RB7 C17 10K RE1 RE0 RG0 RG1 RG2 RG3 MCLR RG4 Vss Vddcore RF7 RF6 RF5 RF4 RF3 RF2 PIC18F6XJ11 PIC18F6XJ16 RB0 RB1 RB2 RB3 RB4 RB5 RB6 Vss OSC2/CLK0 OSC1/CLK1 Vdd RB7 RC5 RC4 RC3 RC2 RF1 ENVREG AVdd AVss RA3 RA2 RA1 RA0 Vss Vdd RA5 RA4 RC1 RC0 RC6 RC7 K88 100n Reset R30 VCC On Board U programme MULTIPLEXER X1 10MHz 22pF 22pF page 14 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD LV18FJ with USB 2.0 PROGRAMMER PUSHBUTTON SWITCHES LV18FJ User’s Manual MikroElektronika Development tools PUSHBUTTON SWITCHES LV18FJ has 70 push buttons which can be used to change states of digital inputs on the microcontroller's ports. There is also one switch that acts as a RESET. Reset switch is shown in Figure 16. Figure 17. Reset switch Reset switch Figure 16. 10K RE1 RE0 RG0 RG1 RG2 RG3 MCLR RG4 Vss Vddcore RF7 RF6 RF5 RF4 RF3 RF2 PIC18F6XJ11 PIC18F6XJ16 RB0 RB1 RB2 RB3 RB4 RB5 RB6 Vss OSC2/CLK0 OSC1/CLK1 Vdd RB7 RC5 RC4 RC3 RC2 RF1 ENVREG AVdd AVss RA3 RA2 RA1 RA0 Vss Vdd RA5 RA4 RC1 RC0 RC6 RC7 8051Flash On-Board USB programmer C17 K88 100n Reset R30 RE2 RE3 RE4 RE5 RE6 RE7 RD0 Vdd Vss RD1 RD2 RD3 RD4 RD5 RD6 RD7 VCC 10MHz 22pF 22pF Figure 18. Pushbutton switches LV18FJ with USB 2.0 PROGRAMMER page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 15 MikroElektronika Development tools The connection between buttons and PORTA, PORTB, PORTC and PORTD is shown in Figure 19. Jumper J1 determines whether a button press will bring logic zero or logic one to the appropriate pin. When button is released, pin state is determined by the pull-up or pull-down port jumpers. In the example shown in Figure 19, J1 is connected to +5V, therefore a button press will bring logic one to the appropriate pins. PD0 PA1 PB1 PC1 PD1 PA2 PB2 PC2 PD2 PA3 PB3 PC3 PD3 PA4 PB4 PC4 PD4 PA5 PB5 PC5 PD5 PA6 PB6 PC6 PD6 PA7 PB7 PC7 PD7 RE2 RE3 RE4 RE5 RE6 RE7 RD0 Vdd Vss RD1 RD2 RD3 RD4 RD5 RD6 RD7 PORTD PC0 VCC 0V while button is pressed RE1 RE0 RG0 RG1 RG2 RG3 MCLR RG4 Vss Vddcore RF7 RF6 RF5 RF4 RF3 RF2 PIC18F6XJ11 PIC18F6XJ16 RB0 RB1 RB2 RB3 RB4 RB5 RB6 Vss OSC2/CLK0 OSC1/CLK1 Vdd RB7 RC5 RC4 RC3 RC2 RF1 ENVREG AVdd AVss RA3 RA2 RA1 RA0 Vss Vdd RA5 RA4 RC1 RC0 RC6 RC7 K88 C17 R30 VCC 8051Flash On-Board USB programmer PORTC PB0 10K PORTB PA0 100n PORTA Reset PUSHBUTTON SWITCHES LV18FJ User’s Manual +5V while button is pressed J1 Figure 19. Buttons schematic page 16 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD LV18FJ with USB 2.0 PROGRAMMER In Figure 20 the J16 jumper is set to pull-up, therefore when the button is released, pull-up resistor pulls the microcontroller’s PB5 pin to +5V. vcc J16 PORTB RE2 RE3 RE4 RE5 RE6 RE7 RD0 Vdd Vss RD1 RD2 RD3 RD4 RD5 RD6 RD7 pull-up Thus, only when the button is pressed the microcontroller will sense a logic zero; otherwise the pin state will always be logic one. RE1 RE0 RG0 RG1 RG2 RG3 MCLR RG4 Vss Vddcore RF7 RF6 RF5 RF4 RF3 RF2 PIC18F6XJ11 PIC18F6XJ16 RB0 RB1 RB2 RB3 RB4 RB5 RB6 Vss OSC2/CLK0 OSC1/CLK1 Vdd RB7 RC5 RC4 RC3 RC2 RF1 ENVREG AVdd AVss RA3 RA2 RA1 RA0 Vss Vdd RA5 RA4 RC1 RC0 RC6 RC7 By pressing the button, the port pin is connected to ground (J1 is in the GND position). RB5 vcc J1 0V while pressed Figure 20. Button with pull-up resistor In Figure 21 the J16 jumper is set to pull-down, therefore when the button is released, pull-down resistor pulls the microcontroller’s RB5 pin to 0V. vcc J16 PORTB RE2 RE3 RE4 RE5 RE6 RE7 RD0 Vdd Vss RD1 RD2 RD3 RD4 RD5 RD6 RD7 pull-down Thus, only when the button is pressed the microcontroller will sense a logic one; otherwise the pin state will always be logic zero. LV18FJ with USB 2.0 PROGRAMMER RE1 RE0 RG0 RG1 RG2 RG3 MCLR RG4 Vss Vddcore RF7 RF6 RF5 RF4 RF3 RF2 PIC18F6XJ11 PIC18F6XJ16 RB0 RB1 RB2 RB3 RB4 RB5 RB6 Vss OSC2/CLK0 OSC1/CLK1 Vdd RB7 RC5 RC4 RC3 RC2 RF1 ENVREG AVdd AVss RA3 RA2 RA1 RA0 Vss Vdd RA5 RA4 RC1 RC0 RC6 RC7 By pressing the button, the port pin is connected to +5V (J1 is in the VCC position). RB5 vcc J1 5V while pressed Figure 21. Button with pull-down resistor page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 17 PUSHBUTTON SWITCHES LV18FJ User’s Manual MikroElektronika Development tools GRAPHIC LCD CONNECTOR ON-BOARD MikroElektronika Development tools GRAPHIC LCD A graphic LCD (GLCD) allows advanced visual messages to be displayed. While a character LCD can display only alphanumeric characters, a GLCD can be used to display messages in the form of drawings and bitmaps. The most commonly used graphic LCD has the screen resolution of 128x64 pixels. The GLCD’s contrast can be adjusted using the potentiometer P6 placed to the right of the GLCD. Figure 22. GLCD Figure 23. GLCD schematic Vee Contrast Adjustment VCC R5 Vo VCC 20 10K RE1 RE0 RG0 RG1 RG2 RG3 MCLR RG4 Vss Vddcore RF7 RF6 RF5 RF4 RF3 RF2 PIC18F6XJ11 PIC18F6XJ16 RB0 RB1 RB2 RB3 RB4 RB5 RB6 Vss OSC2/CLK0 OSC1/CLK1 Vdd RB7 RC5 RC4 RC3 RC2 RF1 ENVREG AVdd AVss RA3 RA2 RA1 RA0 Vss Vdd RA5 RA4 RC1 RC0 RC6 RC7 T39 C8 Reset R6 VCC 100n 1 RE2 RE3 RE4 RE5 RE6 RE7 RD0 Vdd Vss RD1 RD2 RD3 RD4 RD5 RD6 RD7 P6 10K CS1 CS2 GND VCC Vo RS R/W E D0 D1 D2 D3 D4 D5 D6 D7 RST Vee LED+ LED- GRAPHIC LCD 128X64 LV18FJ User’s Manual 10MHz 22pF 22pF Note: Do not connect LCD and GLCD at the same time because they share the same data and control pins. page 18 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD LV18FJ with USB 2.0 PROGRAMMER CONNECTOR 2x16 LCD ON-BOARD LCD 2X16 IN 4-BIT MODE A standard character LCD is probably the most widely used data visualization component. Usually, it can display two lines of 16 alphanumeric characters, each made up of 5x8 pixels. The character LCD communicates with the microcontroller via a 4 bits. The connection to the microcontroller is shown in Figure 25. where there are only four data lines. It is important to know that the LCD should be placed or removed from LV18FJ board only after the power is turned off. Figure 24. LCD 2x16 in place Figure 25. RE2 RE3 RE4 RE5 RE6 RE7 RD0 Vdd Vss RD1 RD2 RD3 RD4 RD5 RD6 RD7 LCD 2x16 in 4-bit mode schematics T39 Contrast Adjustment RE1 RE0 RG0 RG1 RG2 RG3 MCLR RG4 Vss Vddcore RF7 RF6 RF5 RF4 RF3 RF2 PIC18F6XJ11 PIC18F6XJ16 RB0 RB1 RB2 RB3 RB4 RB5 RB6 Vss OSC2/CLK0 OSC1/CLK1 Vdd RB7 RC5 RC4 RC3 RC2 10MHz 22pF 22p RF1 ENVREG AVdd AVss RA3 RA2 RA1 RA0 Vss Vdd RA5 RA4 RC1 RC0 RC6 RC7 P2 10K C8 Reset VCC 10K VCC R6 VCC 100n R13 GND VCC VEE RS R/W E D0 D1 D2 D3 D4 D5 D6 D7 A K 1 mikroElektronika 2x16 LCD Display Note: Do not connect LCD and GLCD at the same time because they share same data and control pins. LV18FJ with USB 2.0 PROGRAMMER page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 19 LCD 2X16 LV18FJ User’s Manual MikroElektronika Development tools R S- 2 3 2 C O M M U N I C A T I O N LV18FJ User’s Manual MikroElektronika Development tools RS232 RS-232 COMMUNICATION ENABLED RS-232 communication enables point-to-point data transfer. It is commonly used in data acquisition applications, for the transfer of data between the microcontroller and PC. Since the voltage levels of the microcontroller and PC are not directly compatible with each other, a level transition buffer such as the MAX232 must be used. Figure 26. RS232 connectors In order to provide a more flexible system, the microcontroller is connected to the MAX232 through switches on the SW1. In order to use it, switches 1 and 2 or 3 and 4 on the SW1 must be enabled. Both RS232 modules can be used at the same time. page 20 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD LV18FJ with USB 2.0 PROGRAMMER LV18FJ User’s Manual MikroElektronika Development tools Figure 27. R S- 2 3 2 C O M M U N I C A T I O N Connection between microcontroller and PC PC 9 6 RS232 CON Receive data (Rx) 5 1 CONNECT MCU TO PC Send Data (Tx) SERIAL CABLE CONNECT PC TO MCU 6 RS232 CON 9 CN8 SUB-D 9p 5 1 6 2 7 3 8 4 9 5 1 Rx RE2 RE3 RE4 RE5 RE6 RE7 RD0 Vdd Vss RD1 RD2 RD3 RD4 RD5 RD6 RD7 Tx LV18FJ with USB 2.0 PROGRAMMER T2OUT R2IN GND T1OUT R1IN R1OUT T1IN T2IN R2OUT 16 15 14 13 12 11 10 9 K88 VCC SW1 TX RX ON E10 10uF C2+ C2VS- VCC 1 2 3 4 5 6 7 8 E11 10uF VS+ C1- MAX232 E9 10uF C1+ RC6 RC7 C17 10K RE1 RE0 RG0 RG1 RG2 RG3 MCLR RG4 Vss Vddcore RF7 RF6 RF5 RF4 RF3 RF2 PIC18F6XJ11 PIC18F6XJ16 RB0 RB1 RB2 RB3 RB4 RB5 RB6 Vss OSC2/CLK0 OSC1/CLK1 Vdd RB7 RC5 RC4 RC3 RC2 RF1 ENVREG AVdd AVss RA3 RA2 RA1 RA0 Vss Vdd RA5 RA4 RC1 RC0 RC6 RC7 U6 1 2 3 4 5 6 7 8 100n E12 10uF Reset R30 VCC 10MHz 22pF 2 page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 21 SERIAL ETHERNET ON BOARD LV18FJ User’s Manual MikroElektronika Development tools Serial SERIAL ETHERNET Ethernet SUPPORTED Ethernet is the most common Local Area Network (LAN) technology in use today.On the top of the physical layer, Ethernet stations mutually communicate by sending data packets to each other. Each Ethernet station is assigned a single 48-bit MAC address used to specify both the destination and the source of each data packet. Figure 28. Serial Ethernet Note: Make sure to select the proper voltage level depending on the MCU Card attached to the LV18FJ development board. Improper voltage level can damage development system or Serial Ethernet chip! Note: Both jumpers J9 and J10 must be connected. page 22 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD LV18FJ with USB 2.0 PROGRAMMER Figure 29. Serial Ethernet schematic VCC3.3 LD91 R41 R36 51 RE2 RE3 RE4 RE5 RD0 RD1 RD2 Vdd Vss VssPLL VDDPLL RBIAS VssTX TPOUT+ TPOUTVDDTX C17 PIC18F66J60 PIC18F67J60 10K VDDRX TPIN+ TPINVSSRX RB4 RB5 RB6 Vss OSC2/CLK0 OSC1/CLK1 Vdd RB7 RC5 RC4 RC3 RC2 RF1 ENVREG AVdd AVss RA3 RA2 RA1 RA0 Vss Vdd RA5 RA4 RC1 RC0 RC6 RC7 K88 100n Reset R30 VCC RE1 RE0 RB0 RB1 RB2 RB3 MCLR RG4 Vss Vddcore RF7 RF6 RF5 RF4 RF3 RF2 CN9 R37 51 1 3 2 7 10MHz 22pF 6 22pF 8 R38 51 R39 51 J10 10n 10n C7 C8 11 A2 TD+ 12 K2 CT TDRD+ CT RJ45 RD- A1 9 K1 10 J9 LD90 LV18FJ with USB 2.0 PROGRAMMER RA1 FP2 FERRITE BEAD RA0 R40 page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 23 SERIAL ETHERNET ON BOARD LV18FJ User’s Manual MikroElektronika Development tools MikroElektronika Development tools DS1820 DIGITAL THERMOMETER DS1820 digital thermometer is convenient for environmental temperature measurement, having the temperature in the range of -55°C to 125°C with +/-0.5°C accuracy. It must be properly placed in the 3-pin socket provided on LV18FJ, with its rounded side to the right edge of the board (see Fig. 30) otherwise the DS1820 could be permanently damaged. DS1820’s data pin can be connected to either RD0 or RD1 pin, which is determined by the jumper J2. DS1820 Figure 30. Figure 31. DS1820 schematic RE2 RE3 RE4 RE5 RE6 RE7 RD0 Vdd Vss RD1 RD2 RD3 RD4 RD5 RD6 RD7 There is a mark in the shape of a half-circle for proper orientation of DS1820 sensor. 125 C 20 K88 RE1 RE0 RG0 RG1 RG2 RG3 MCLR RG4 Vss Vddcore RF7 RF6 RF5 RF4 RF3 RF2 PIC18FXXXX RB0 RB1 RB2 RB3 RB4 RB5 RB6 Vss OSC2/CLK0 OSC1/CLK1 Vdd RB7 RC5 RC4 RC3 RC2 RF1 ENVREG AVdd AVss RA3 RA2 RA1 RA0 Vss Vdd RA5 RA4 RC1 RC0 RC6 RC7 -55 C C17 R30 18 100n DS 10K VCC Reset DS1820 DIGITAL THERMOMETER Easy8051A User’s Manual VCC3.3 10MHz 22pF 22pF VCC3.3 GND VCC R4 10K J2 DQ DQ line is connected to RD0 DQ line is connected to RD1 DQ line is disconnected page 24 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD LV18FJ with USB 2.0 PROGRAMMER MCU A/D CONVERTER SUPPORT LV18FJ microcontrollers have built-in A/D Converter. For the purpose of accessing the ADC there are 4 potentiometers available on the development board, each connected to four different A/D inputs. A detailed scheme is shown below. A/D Converter Figure 32. 4.096 reference voltage schematic Figure 33. VCC3.3 P3 RE2 RE3 RE4 RE5 RE6 RE7 RD0 Vdd Vss RD1 RD2 RD3 RD4 RD5 RD6 RD7 RF6 P1 RF5 RA1 RF4 RA0 RF3 K88 RH7 RF2 RF1 P2 P4 RH6 RF0 RH5 RA5 RH4 LV18FJ with USB 2.0 PROGRAMMER C17 VCC3.3 10K 100n Reset R30 VCC RE1 RE0 RG0 RG1 RG2 RG3 MCLR RG4 Vss Vddcore RF7 RF6 RF5 RF4 RF3 RF2 PIC18F6XJ11 PIC18F6XJ16 RB0 RB1 RB2 RB3 RB4 RB5 RB6 Vss OSC2/CLK0 OSC1/CLK1 Vdd RB7 RC5 RC4 RC3 RC2 RF1 ENVREG AVdd AVss RA3 RA2 RA1 RA0 Vss Vdd RA5 RA4 RC1 RC0 RC6 RC7 RA3 RA2 page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 25 MCU’S A/D CONVERTER SUPPORT LV18FJ User’s Manual MikroElektronika Development tools DIRECT PORT ACCESS LV18FJ User’s Manual MikroElektronika Development tools DIRECT PORT ACCESS All microcontroller input/output pins can be accessed via connectors placed along the right side of the board. For each PORT there is one 10-pin connector providing VCC, GND and eight port pins. Figure 34. Direct port access connectors These connectors can be used for system expansion with external boards such as Serial Ethernet, Compact Flash, MMC/SD, ADC, DAC, CAN, RTC, RS-485 etc. Ensure that onboard peripherals are disconnected from the microcontroller when an external peripheral is attached to the board. The appropriate jumpers and switches must be set for this purpose. The connectors can also be used for attaching logic probes or test equipment. Figure 35. Example of how to connect external peripheral with flat cable page 26 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD LV18FJ with USB 2.0 PROGRAMMER 1 VCC Pull-down line is connected Pull-up line is connected DIRECT PORT ACCESS LV18FJ User’s Manual MikroElektronika Development tools J16 2 3 All lines are disconnected RN16 1 2 3 4 5 RE2 RE3 RE4 RE5 RE6 RE7 RD0 Vdd Vss RD1 RD2 RD3 RD4 RD5 RD6 RD7 6 7 8 9 C17 10K RE1 RE0 RG0 RG1 RG2 RG3 MCLR RG4 Vss Vddcore RF7 RF6 RF5 RF4 RF3 RF2 PIC18F6XJ11 PIC18F6XJ16 RB0 RB1 RB2 RB3 RB4 RB5 RB6 Vss OSC2/CLK0 OSC1/CLK1 Vdd RB7 RC5 RC4 RC3 RC2 RF1 ENVREG AVdd AVss RA3 RA2 RA1 RA0 Vss Vdd RA5 RA4 RC1 RC0 RC6 RC7 K88 100n Reset R30 VCC RPACK8/9 8x10K PORTB 10MHz 22pF PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 22pF VCC CN16 HEADER 5x2 Figure 36. PORTB connection LV18FJ with USB 2.0 PROGRAMMER page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 27 MMC/SD (MULTIMEDIA CARD) LV18FJ User’s Manual MikroElektronika Development tools MMC/SD MMC/SD (Multimedia Card) MASS STORAGE 256MB SUPPORTED MMC/SD card is used as a storage media for a portable device, in a form that can be easily accessed by PC. For example, a digital camera uses MMC/CD card to store image files. Microcontroller on the LV18FJ development board comunicates with MMC/SD via SPI communication. The on-board connector enables users to easily access MMC/SD card from the microcontroller. Figure 37. MMC Card In order to enable MMC card, switches 5, 6, 7 and 8 on the SW1 must be turned on, as shown at figure 38. By doing that, SPI communication lines (SCK, MISO and MOSI) are connected to the microcontroller and CS line is turned on. page 28 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD LV18FJ with USB 2.0 PROGRAMMER RE2 RE3 RE4 RE5 RD0 RD1 RD2 Vdd Vss VssPLL VDDPLL RBIAS VssTX TPOUT+ TPOUTVDDTX Operating voltage of the MMC Card is 3.3V DC. 3.3V power supply voltage regulator (MC33269DT-3.3) are used for the adjusting MMC card voltage level. C17 K88 10K 100n Reset R30 VCC3.3 VCC3.3 PIC18F66J60 PIC18F67J60 VDDRX TPIN+ TPINVSSRX RB4 RB5 RB6 Vss OSC2/CLK0 OSC1/CLK1 Vdd RB7 RC5 RC4 RC3 RC2 VCC3.3 10MHz 22pF 22pF RF1 ENVREG AVdd AVss RA3 RA2 RA1 RA0 Vss Vdd RA5 RA4 RC1 RC0 RC6 RC7 VCC3.3 RE1 RE0 RB0 RB1 RB2 RB3 MCLR RG4 Vss Vddcore RF7 RF6 RF5 RF4 RF3 RF2 VCC3.3 VCC3.3 R10 10K R9 10K R11 SCK SDO SDI CS REG2 3 GND 2 RC3 RC4 RC3 RD2 CN6 VCC3.3 MC33269 DT-3.3 1 1 2 3 4 5 6 7 8 10K R12 ON 10K VCC VIN VOUT E7 10uF VCC3 C8 100nF 1 2 3 4 5 6 7 CS Din GND +3.3V SCK GND Dout MMC CARD Figure 38. MMC Card schematic LV18FJ with USB 2.0 PROGRAMMER page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 29 MMC/SD (MULTIMEDIA CARD) LV18FJ User’s Manual MikroElektronika Development tools LV18FJ User’s Manual MikroElektronika Development tools Second edition October 2007 NO PART OF THIS MANUAL, INCLUDING THE PRODUCT AND SOFTWARE DESCRIBED IN IT, MAY BE REPRODUCED, TRANSMITTED, TRANSCRIBED, STORED IN A RETRIEVAL SYSTEM, OR TRANSLATED INTO ANY LANGUAGE IN ANY FORM OR BY ANY MEANS, EXCEPTING THE DOCUMENTATION KEPT BY THE PURCHASER FOR BACKUP PURPOSES, WITHOUT EXPRESSED WRITTEN PERMISSION OF MIKROELEKTRONIKA COMPANY. PRODUCT WARRANTY OR SERVICE WILL NOT BE EXTENDED IF THE PRODUCT IS REPAIRED, MODIFIED OR ALTERED, UNLESS SUCH REPAIR, MODIFICATION OR ALTERATION IS AUTHORIZED IN WRITING BY MIKROELEKTRONIKA. MIKROELEKTRONIKA PROVIDES THIS MANUAL “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDED, BUT NOT LIMITED TO IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MIKROELEKTRONIKA, ITS DIRECTORS, OFFICERS, EMPLOYEES OR DISTRIBUTORS BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING DAMAGES FOR LOSS OF BUSINESS PROFITS AND BUSINESS INFORMATION, BUSINESS INTERRUPTION OR ANY OTHER PECUNIARY LOSS) ARISING FROM ANY DEFECT OR ERROR IN THIS MANUAL OR PRODUCT, EVEN IF MIKROELEKTRONIKA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SPECIFICATION AND INFORMATION CONTAINED IN THIS MANUAL ARE FURNISHED FOR INTERNATIONAL USE ONLY, AND ARE SUBJECT TO CHANGE AT ANY TIME WITHOUT NOTICE, AND SHOULD BE CONSTRUED AS A COMMITMENT BY MIKROELEKTRONIKA. MIKROELEKTRONIKA ASSUMES NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR INACCURACIES THAT MAY APPEAR IN THIS MANUAL, INCLUDING THE PRODUCT AND SOFTWARE DESCRIBED IN IT. PRODUCT AND CORPORATE NAMES APPEARING IN THIS MANUAL MAY OR MAY NOT BE REGISTERED TRADEMARKS OR COPYRIGHTS OF THEIR RESPECTIVE COMPANIES, AND ARE USED ONLY FOR IDENTIFICATION OR EXPLANATION AND TO THE OWNERS’ BENEFIT, WITH NO INTENT TO INFRINGE. page 30 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD LV18FJ with USB 2.0 PROGRAMMER BO with Serial Ethernet LV18FJ 68HC08 ng aki y Mit eas DEV .T AR M COM PI 8 C PI S OL 05 1 AVR oC PS O RS LE Buttons to select high/low state of the pins. Reset circuit Turns ON or OFF the LEDs on PORTA, PORTB, PORTC etc. LCD connector allows easy connection of LCD in 4-bit mode. MMC/SD multimedia card socket. Choose between external or USB power supply. www.mikroe.com LCD contrast GLCD connector Very fast and flexible USB 2.0 programmer. Socket for mikroElektronika MCU card GLCD contrast RS232 communication ports. Jumpers to select default logic state of the appropriate pins. DS1820 temperature sensor can be conneced to PC6 or PC7 pin. AD Inputs on pins Serial ethernet socket. Development tool for MICOCHIP PIC MCUs LV18FJ External power supply 8-16 V AC/DC. Buttons for simulating pins high state or low state MikroElektronika Tools-Compilers-Books KS O MikroElektronika SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD If you are experiencing problems with any of our products or you just want additional information, please let us know. We are committed to meeting every need of yours. Technical Support : [email protected] If you have any question, comment or business proposal, please contact us: E-mail: [email protected] Web: www.mikroe.com Forum: www.mikroe.com/forum/ Software and Hardware solutions for Embedded World