WT51F104 EVB Operation Manual WT51F104 EVB Operation Manual REV. 1.0 April 26, 2012 This document is Weltrend confidential information.Do not copy. WT51F104 EVB Operation Manual Ver. 1.0 Date 2012/04/26 Applicant Louis 1st version Description This document is Weltrend confidential information, do not copy. 2 WT51F104 EVB Operation Manual Table of Contents CHAPTER 1 WT51F104 EVB H/W DESCRIPTION................................................................................................4 1.1 SYSTEM BLOCK DIAGRAM ......................................................................................................................................4 1.2 EVB COMPONENT LOCATION .................................................................................................................................5 CHAPTER 2 WT51F104 EVB INPUT PORT DESCRIPTION .................................................................................6 2.1 DC INPUT CONNECTOR (J2)...................................................................................................................................6 2.2 BATTERY INPUT PORT (BTA1) ...............................................................................................................................6 2.3 VDD VOLTAGE SELECTOR (JP1)............................................................................................................................7 2.4 SWUT (SINGLE WIRE UART) INTERFACE PROGRAMMING PORT (P3)......................................................................7 2.5 I2C INTERFACE PORT..............................................................................................................................................8 2.6 MICROCHIP PIC16F6XX PROGRAMMING PORT (P1) .............................................................................................8 2.7 UART INTERFACE PORT (P2) ................................................................................................................................9 2.8 BUZ / LED FUNCTION SELECTION (JP6) ................................................................................................................9 2.9 EXTERNAL PWM INPUT PORT (JP5).....................................................................................................................10 2.10 RW (LCM) / LED FUNCTION SELECTION (JP10) ................................................................................................10 2.11 SWUT EARPHONE JACK INTERFACE PORT .........................................................................................................11 2.12 TESTING PIN AND DAUGHTER BOARD INTERFACE (JP2) ......................................................................................11 CHAPTER 3 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 MAIN POWER SYSTEM .........................................................................................................................................13 VDD POWER OPTION ..........................................................................................................................................13 POWER CIRCUIT ..................................................................................................................................................14 RESET CIRCUIT .................................................................................................................................................14 SINGLE WIRE EARPHONE JACK INTERFACE CIRCUIT ..............................................................................................15 OSCILLATOR CIRCUIT...........................................................................................................................................15 BUTTON FUNCTION ..............................................................................................................................................16 BUZZER CIRCUIT ...............................................................................................................................................16 CHAPTER 4 4.1 4.2 4.3 4.4 4.5 4.6 4.7 WT51F104 EVB OPERATION DESCRIPTION............................................................................... 17 WT51F104 TESTING AND DEMONSTRATION PLATFORM ........................................................................................17 LCM DISPLAY (PROGRAM MODULE DESCRIPTION) .................................................................................................18 ADC MEASUREMENT (PROGRAM MODULE DESCRIPTION) .......................................................................................18 TIMER (PROGRAM MODULE DESCRIPTION)............................................................................................................19 BUZZER (PROGRAM MODULE DESCRIPTION)...........................................................................................................19 PWM (PROGRAM MODULE DESCRIPTION)..............................................................................................................20 UART (PROGRAM MODULE DESCRIPTION).............................................................................................................20 CHAPTER 5 5.1 5.2 5.3 5.4 5.5 5.6 5.7 WT51F104 EVB CIRCUIT DESCRIPTION ....................................................................................... 13 PROGRAM MODULE......................................................................................................................... 21 PROGRAM MODULE DESCRIPTION ........................................................................................................................21 LCM DRIVER MODULE <LCD.C>.........................................................................................................................22 ADC DRIVER MODULE <DRV_ADC.C>...............................................................................................................22 RTC DRIVER MODULE <DRV_WTMR.C> ...........................................................................................................23 PWM DRIVER MODULE <DRV_PWM.C> ..........................................................................................................23 BUZZER DRIVER MODULE <API_MUSIC.C> ..........................................................................................................24 UART DRIVER MODULE <API_UARTDEBUG.C> ...................................................................................................24 CHAPTER 6 APPENDIX.......................................................................................................................................... 25 6.1 CIRCUIT ..............................................................................................................................................................25 6.2 BOM ..................................................................................................................................................................27 6.3 ORDERING INFORMATION .....................................................................................................................................28 This document is Weltrend confidential information, do not copy. 3 WT51F104 EVB Operation Manual Chapter 1 1.1 WT51F104 EVB H/W Description System Block Diagram WT51F104 is an enhanced 8052 Microcontroller with a variety of peripheral functions, the EVB is designed for SSOP 20 pin PKG type. The system structure as the figure below is demonstrating its functions. WELTREND LCM Module VDD GPIOB3 GPIOC 0~5 SCL VDD 47uF I2C SDA 0.1uF 10pF RX TX OSCI 32.768KHz UART OSCO 10pF VDD WT51F104 VDD BUZ 10K RST / SWUT 4.7uF GPIOB0 LED SWUT 5V VDD KEY 1 AD_KEY ADC 1 AD_ADJ ADC 0 KEY 2 KEY 3 KEY 4 KEY 5 This document is Weltrend confidential information, do not copy. 4 5V VR WT51F104 EVB Operation Manual 1.2 EVB Component Location J6 SWB1 LCM Port WT51F104 Reset Key JP2 / JP3 WT51F104 Test Pin U3 WT51F104 VR2 LCM Contrast Adjust P4 WT51F104 I2C P3 SWUT Burning Port J7 Single-wire programming Earphone socket interface port P1 PIC ISP / ICE P2 UART Interface JP5 Frequency In / PWM Out Port JP10 LED / BUZ Option Jump JP1 VDD Voltage Option Jump (5V / 3.3V) BZ1 Buzzer J2 DC 12 V Power SWB2 UP BTA1 9V Battery IN SWB3 Left SWB4 Mode/Enter SWB6 Down This document is Weltrend confidential information, do not copy. 5 SWB5 Right VR1 Adjust AD Voltage VR WT51F104 EVB Operation Manual Chapter 2 2.1 WT51F104 EVB Input Port Description DC Input Connector (J2) This is EVB DC input port (supporting voltage DC 7V ~ 18V). 2.2 Pad Number Description 1 Positive pin input 2 -- 3 Negative pin input Battery Input Port (BTA1) External battery port (battery voltage input range 7V ~ 18V) pitch (2.54 mm) Pad Number Description 1 Positive battery input 2 Negative battery input This document is Weltrend confidential information, do not copy. 6 WT51F104 EVB Operation Manual 2.3 VDD Voltage Selector (JP1) The VDD Voltage selector is for WT51F104,voltage can support 2.2V ~ 5.5V, the selector input is 3.3V or 5V voltage or use the external power to support (external power should be under 5.5V, according to the spec definition) pitch (2.54 mm) Jump (2.54 mm) 2.4 Pad Number Description 1 5V (Jump 1-2 short) 2 VDD (external power input pin) 3 3.3V (Jump 2-3 short) SWUT (Single Wire UART) Interface Programming Port (P3) WT51F104 single wire programming port pitch (1.25 mm) Pad Number Description 1 VDD 2 SWUT 3 GND This document is Weltrend confidential information, do not copy. 7 WT51F104 EVB Operation Manual 2.5 I2C interface port Component Location (JP4) SLAVE I2C Interface Port pitch (1.25 mm) 2.6 Pad Number Description 1 VDD 2 Slave_SCL 3 Slave_SDA 4 GND Microchip PIC16F6XX Programming Port (P1) WT51F104 pin to pin with Microchip PIC16F6XX s, the programming port support PIC16F6XX serials. pitch (2.54 mm) Pad Number Description Pad Number Description 1 5V 4 GND 2 SCL 5 NRST 3 SDA - - This document is Weltrend confidential information, do not copy. 8 WT51F104 EVB Operation Manual 2.7 UART Interface Port (P2) UART serial transmission interface port pitch (1.25 mm) 2.8 Pad Number Description 1 5V 2 TXD 3 RXD 4 GND BUZ / LED Function Selection (JP6) BUZ / LED function selection Pitch (2.54 mm) Pad Number Description 1 BUZZER (Jump 1-2 short) 2 BUZ / LED (GPIOB0) 3 LED (Jump 2-3 short) This document is Weltrend confidential information, do not copy. 9 Jump (2.54 mm) WT51F104 EVB Operation Manual 2.9 External PWM Input Port (JP5) PWM Input Port Pitch (2.54 mm) Pad Number Description 1 External PWM Input 2 GND 2.10 RW (LCM) / LED Function Selection (JP10) LCM RW Controller / LED function selection interface pitch (2.54 mm) Pad Number Description 1 LED (Jump1-2 short) 2 RW / LED (GPIOB3) 3 RW (LCM Controller, Jump 2-3 short) This document is Weltrend confidential information, do not copy. 10 Jump (2.54 mm) WT51F104 EVB Operation Manual 2.11 SWUT Earphone Jack Interface Port Component (J6) SWUT Earphone Jack interface Port Pad Number Description Pad Number Description 1 GND 5 SWUT 2 VDD 6 NC 3 NC 7 NC 4 RESET 8 NC 2.12 Testing Pin and Daughter Board Interface (JP2) This interface for signal pin and daughter board measurement (WT51F104 other PKG type). pitch (2.54 mm) This document is Weltrend confidential information, do not copy. 11 WT51F104 EVB Operation Manual Pad Number Description Pad Number Description 1 VDD 11 GPIOC2 2 GPIOA5 / ADC15 / OSCI / PWM1B 12 GPIOC1 / ADC7 3 GPIOA4 / ADC14 / OSCO / PWM0B 13 GPIOC0 / ADC6 4 GPIOA3 / ADC13 / NRST / SWUT 14 GPIOB2 / ADC5 / STB / PWM0D 5 GPIOB5 / ADC12 / RXA / PWM1A 15 GPIOB1 / ADC4 / MOSI / SCK 6 GPIOB4 / ADC11 / TXA / PWM1D 16 GPIOB0 / ADC3 7 GPIOB3 / ADC10 / PWM0A 17 GPIOA2 / ADC2 / PWM1C 8 GPIOC5 / ADC9 18 9 GPIOC4 / ADC8 19 10 GPIOC3 20 GPIOA1 / ADC1 / RXB / SCL GPIOA0 / ADC0 / TXB / SDA / PWM0C VSS This document is Weltrend confidential information, do not copy. 12 WT51F104 EVB Operation Manual Chapter 3 WT51F104 EVB Circuit Description 3.1 Main Power System There are three options for WT51F104 EVB main power to choose : 1. External DC-12 V (J2) input: Through regulator and produce DC power 5V and 3.3V. 2. Battery (BTA1) input: Through regulator and produce DC power 5V and 3.3V. 3. VDD input: There are no inputs for main power, please see below “VDD Power Option” description. WT51F104 EVB main power circuit: 3.2 VDD Power Option There are four options for WT51F104 VDD power, the operation voltage is 5V,3.3V or external input. (External input power must not exceed Max. 5.5V as spec. definition). 1. Pad JP1 1-2 connect: means WT51F104VDD operation voltage is 5 V. 2. Pad JP1 2-3 connect: means WT51F104 VDD operation voltage is 3.3V. 3. WLINK-SWUT VDD: Using WLINK-SWUT VDD for WT51F104 VDD power. 4. External VDD: It can input from J5 (positive), J4 (negative), external input VDD must not exceed Max. 5.5V as spec definition. If power is in normal operation, then DB1, DB2, DB3 LED will light. This document is Weltrend confidential information, do not copy. 13 WT51F104 EVB Operation Manual 3.3 Power Circuit VDD power input needs filter capacitor, its placement close the pin is better. 3.4 RESET Circuit WT51F104 RESET circuit and SWUT single wire programming use the same pin, the related circuit as the figure below. When SWUT is on programming the JP9 JUMP should be power down, and the external RC RESET should disconnect from it. When programming is finished, if the REST function had been used, the JP9 JUMP, needs plug again. This document is Weltrend confidential information, do not copy. 14 WT51F104 EVB Operation Manual 3.5 Single Wire Earphone Jack Interface Circuit Since WT51F104 RESET circuit and SWUT single wire programming both use the same pin, for update easily when mass production, design the below circuit, when plug earphone programming cable, the RESET / SWUT (4-5) will break, and start to program, after programming finished, remove earphone programming cable, the springs of earphone jack let RESET / SWUT (4-5) short and RC will go back to REST state. 3.6 Oscillator Circuit WT51F104 oscillator circuit as the figure below. This document is Weltrend confidential information, do not copy. 15 WT51F104 EVB Operation Manual 3.7 Button Function WT51F104 EVB reserves five function key (AD_KEY). 1. UP (UP / SWB2) 2. Left (LEFT / SWB3) 3. Mode/Ok (Enter / SWB4) mode (3~4 seconds long press)/ ok (short press) 4. Right (RIGHT / SWB5) 5. Down (Down / SWB6) 3.8 BUZZER Circuit BUZZER circuit as the figure below. This document is Weltrend confidential information, do not copy. 16 WT51F104 EVB Operation Manual Chapter 4 4.1 WT51F104 EVB Operation Description WT51F104 Testing and Demonstration Platform There are six function modes in WT51F104 EVB, for user application. Mode : Button operation : 1. LCD display 1. Up option (KEY1) 2. ADC measurement 2. Left option (KEY2) 3. Timer 3. Mode/Ok (KEY3) 4. Trigger Counter Mode (3~4 seconds long press) / Ok(short press) 5. Buzzer 4. Right option (KEY4) 6. UART 5. Down option (KEY5) This document is Weltrend confidential information, do not copy. 17 WT51F104 EVB Operation Manual 4.2 LCM Display (program module description) After power on, LCM display【Weltrend / Mode-0】screen, press “Mode/ok”, can execute mode 《Mode-0 ~ Mode-5》function change. 4.3 ADC Measurement (program module description) In “Mode-0 ADC” main screen, press “Down” button, then the program will execute AD detection function, now LCM will show 4- bit number, now adjust AD voltage button, voltage will be during 0V ~ 3.3V, LCM will transfer the voltage to 10 bit (0000 ~ 1023), long press “Down” can go back to main menu. This document is Weltrend confidential information, do not copy. 18 WT51F104 EVB Operation Manual 4.4 Timer (Program Module Description) In main screen press “mode/ok”, on LCM will show “Mode-1 RTC”, then press “Down”, program will execute RTC function, now on LCM will show hour-minute-second, long press “Down” button, you can go back to the main figure. 4.5 Buzzer (program module description) In main screen press “mode/ok”, on LCM will show “Mode-3 Music” then press “Down”, the program will execute, then Buzzer will be issued by the seven scales automatically. Long press ”Down” you can go back to main screen. This document is Weltrend confidential information, do not copy. 19 WT51F104 EVB Operation Manual 4.6 PWM (program module description) In main screen press “Mode/OK”, LCM will show ”Mode-3 PWM”, then press ”Down”, program will execute PWM output function, now adjust AD voltage button, the voltage will produce 0V ~ 3.3V change, and PWM output will have different frequency. Output (12K ~ 2.4 MHz), long press “Down” you can go back to the main screen. PWM Output Main Screen Adjust AD Voltage VR 4.7 UART (program module description) In main screen press “Mode/ok”, LCM will show 【Mode-5 UART】, then press “Down”, program will execute, now will show 4-bit number, then connect WT51F104 EVB and PC through UART cable, now at PC Key IN 8-bit data (by Terminal tool and program), and LCM will show the decimal value which after converted. Long press “Down” you can go back to the main menu. Main Screen Execution Screen This document is Weltrend confidential information, do not copy. 20 WT51F104 EVB Operation Manual Chapter 5 5.1 Program Module Program Module Description Please refer to the following program module. This document is Weltrend confidential information, do not copy. 21 WT51F104 EVB Operation Manual 5.2 LCM Driver Module <LCD.C> Function 5.3 Description void lcm_clear(void) Clear LCM void lcm_goto(BYTE pos, BYTE line) The cursor jump to the specified location void lcm_init( void) Initialize the LCD display void lcm_print_itemName(u8 itemNo) print item name of demonstration void lcm_print_itemResult(u8 itemNo) print the execution result of demonstration void lcm_putch(BYTE c) print a letter void lcm_puts(const BYTE * s) print a string void lcm_write(BYTE c) write command/data to LCM controller chip void LcmDelayMs(BYTE cnt) delay ADC Driver Module <DRV_ADC.C> Function Description word API_AverageADCData(BYTE ADC_Channel) Take many times values of analog to digital for an average Void DRV_AnalogKeyInitial(void) Initialize ADC word DRV_ReadAnalogChannel( BYTE AD_Channel) Analog to digital converaion on the specified channel This document is Weltrend confidential information, do not copy. 22 WT51F104 EVB Operation Manual 5.4 RTC Driver Module <DRV_WTMR.C> Function 5.5 Description void DRV_InitialWTMR(void) Initialize “Timer” void ISR_WTMR(void) Timer interrupt solution void UpdateWatchData(void) Update Timer PWM Driver Module <DRV_PWM.C> Function void API_XhgPWMduty(void) Description Change PWM duty on/off percentage (duty cycle) void DRV_DisablePWM(void) Disable PWM void DRV_InitialPWM(void) Initialize PWM This document is Weltrend confidential information, do not copy. 23 WT51F104 EVB Operation Manual 5.6 Buzzer Driver Module <API_Music.C> Function 5.7 Description void Init_OS_Timer1(void) Initialize “Timer 1” void KeyMusic_Play(void) Key sound void LoadMusicTable(BYTE MusicIndex) Take out musical corresponding to count value void Music_Play(void) Play music void Timer1 (void) interrupt 5 “Timer 1” interrupt solution UART Driver Module <API_UartDebug.C> Function Description void DRV_Uart0Inital(void) Initialize “serial port 0” (driver level) void API_UartDebugInitial(void) Initialize “serial port 0” (application level) void API_UartDebugDisable(void) Disable “serial port 0” (application level) void DRV_Uart0Disable(void) Disable “serial port0” (driver level) void DRV_PutChar(char u8Char) From “serial port 0” print a letter void UART0_interrupt (void) interrupt 4 “serial port 0” receive/send interrupt solution This document is Weltrend confidential information, do not copy. 24 WT51F104 EVB Operation Manual Chapter 6 6.1 Appendix Circuit 1. Power This document is Weltrend confidential information, do not copy. 25 WT51F104 EVB Operation Manual 2. WT51F104 (MCU) This document is Weltrend confidential information, do not copy. 26 WT51F104 EVB Operation Manual 6.2 BOM This document is Weltrend confidential information, do not copy. 27 WT51F104 EVB Operation Manual 6.3 Ordering Information 1. WT51F104 Development Kit Kit WT51F104 Development Kit Product Name Number WLINK-SWUT x 1 WA000 Development and demo board ( WT51F104 EVB With LCM Module) x 1 WB001 SWUT Programming cable x 1 2. WT51F104 Starter Kit Kit WT51F104 Starter Kit Product Name Number WLINK-SWUT x 1 WA000 WT51F104 Starter Kit Board x 1 WB006 SWUT Programming cable x 1 3. WT51F104 development and demo board Kit WT51F104 Development and Demo board Product Name Number Development and Demo board (WT51F104 EVB With LCM Module) WB001 EVB Operation Manual DOC13 4. WT51F104 Starter Kit Board (simple version) Kit WT51F104 Simple version Product Name Number Simple Version (WT51F104 Starter Kit Board) WB006 EVB Operation Manual DOC24 This document is Weltrend confidential information, do not copy. 28 WT51F104 EVB Operation Manual 5. Single Wire Programming Board (WLINK-SWUT) Kit Single Wire Programming Board WLINK-SWUT Product Name Single Wire Programming Board PL-2303 (WLINK-SWUT) Number WA000 Single Wire Programming Board CP-2102 (WLINK-SWUT) WLINK-SWUT Operation Manual This document is Weltrend confidential information, do not copy. 29 DOC2