The following document contains information on Cypress products. AN07-00161-2E FR Family FR80 MB91660series Method of Controlling VFD Module with External Bus Access AN07-00161-2E All Rights Reserved. The contents of this document are subject to change without notice. Customers are advised to consult with FUJITSU sales representatives before ordering. The information, such as descriptions of function and application circuit examples, in this document are presented solely for the purpose of reference to show examples of operations and uses of Fujitsu semiconductor device; Fujitsu does not warrant proper operation of the device with respect to use based on such information. When you develop equipment incorporating the device based on such information, you must assume any responsibility arising out of such use of the information. Fujitsu assumes no liability for any damages whatsoever arising out of the use of the information. Any information in this document, including descriptions of function and schematic diagrams, shall not be construed as license of the use or exercise of any intellectual property right, such as patent right or copyright, or any other right of Fujitsu or any third party or does Fujitsu warrant non-infringement of any third-party’s intellectual property right or other right by using such information. Fujitsu assumes no liability for any infringement of the intellectual property rights or other rights of third parties which would result from the use of information contained herein. The products described in this document are designed, developed and manufactured as contemplated for general use, including without limitation, ordinary industrial use, general office use, personal use, and household use, but are not designed, developed and manufactured as contemplated (1) for use accompanying fatal risks or dangers that, unless extremely high safety is secured, could have a serious effect to the public, and could lead directly to death, personal injury, severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic control, mass transport control, medical life support system, missile launch control in weapon system), or (2) for use requiring extremely high reliability (i.e., submersible repeater and artificial satellite). Please note that Fujitsu will not be liable against you and/or any third party for any claims or damages arising in connection with above-mentioned uses of the products. Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such failures by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and prevention of over-current levels and other abnormal operating conditions. If any products described in this document represent goods or technologies subject to certain restrictions on export under the Foreign Exchange and Foreign Trade Law of Japan, the prior authorization by Japanese government will be required for export of those products from Japan. The company names and brand names herein are the trademarks or registered trademarks of their respective owners. Copyright© 2009 FUJITSU MICRELECTRONICS LIMITED all rights reserved 1 AN07-00161-2E Revision History Revision Date Description 1.0 June 16, 2008 Initial release 2.0 April 13, 2009 Cahnge the document name 2 AN07-00161-2E Subject Revision History.................................................................................................................... 2 Subject.................................................................................................................................. 3 1 Introduction..................................................................................................................... 4 2 Manual............................................................................................................................ 5 2.1 3 Hardware Configuration ................................................................................................... 6 3.1 4 Manual used by this application.................................................................................. 5 Recommended circuit diagram ................................................................................... 6 Software.......................................................................................................................... 7 4.1 Operation ................................................................................................................. 7 4.2 Sample software ....................................................................................................... 7 3 AN07-00161-2E 1 Introduction This application note explains the method of controlling the fluorescent display tube module (Graphic display module: GP1118A01B) (Futaba Corporation) by external bus of Fujitsu 32-bit MCU FR80 family. MB91F662 of FR80 family is used in the explanation of control methods. 4 AN07-00161-2E 2 Manual 2.1 Manual used by this application - See the following URL for the application note of the fluorescent display tube module (Graphic display module: GP1118A01B) (Futaba Corporation). The user's registration is required. http://www.futaba.co.jp/display/module/full_dot_md/mdl_dotmatrix.html - The hardware manuals concerning and Data sheets concerning the Fujitsu microcontroller can be downloaded from the following URLs. http://jp.fujitsu.com/microelectronics/brochures/(Japanese) http://www.fujitsu.com/global/services/microelectronics/documents/(English) - The above-mentioned URLs are subject to change without a previous notice. 5 AN07-00161-2E 3 Hardware Configuration 3.1 Recommended circuit diagram 3.3V 3.3V Microcontroller FR80 MB91660 series P10/D08 P11/D09 P12/D10 P13/D11 P14/D12 P15/D13 P16/D14 P17/D15 P67/INT23_2 P56/WR0X P55/RDX P53/CS3X P20/A00 Level shifter Fluorescent display tube 5.0V GP1118A01B D0 D1 D2 D3 D4 D5 D6 D7 INT WR RD CS C/D Figure 1. MB91660series and example of connecting fluorescent display tube module Because the fluorescent display tube drive circuit is built into GP1118A01, the display can be easily controlled according to the external 8-bit data bus access of MB91660 series. The connection example is shown in Figure 1. Because microcontroller FR80 family MB91660series is 3V product and fluorescent display tube GP1118A01B is 5V product, be sure to use the level shifter to connect the microcontroller FR80 family and fluorescent display tube. So, pins (INT23_2, WR0X, RDX, and CS3X) of the control system shall be equipped with the pull-up resistor to 3.3V power supply to prevent a malfunction. Connect the pin A00 of MB91660series with the pin C/D of GP1118A01B, to set data with A00=1 (odd number address) access and set a command with A00=0 (even number address) access. Because the pulse is output from the INT pin of GP1118A01B every frame, the character and the picture can be displayed on the fluorescent display tube by setting the display data with an external interrupt processing of MB91660series. 6 AN07-00161-2E 4 Software 4.1 Operation Because various font data such as kanji character, hiragana, figure, and sign is stored in GP1118A01B, the characters can be easily displayed. This section explains the sample software blinking the displayed characters every 128 frames by using the command displaying the font data to display “Fujitsu FR80 MB91F662” in Figure 2 here. Figure 2. Display of fluorescent display tube 4.2 Sample software The relationship among functions in the sample software is shown below. main() Reading (1) clock() (2) external_bus() (3) (4) external_interrupt() Interrupt ext_int_23() display1() font_data_set() Figure 3 Relationship among functions 7 VFD_control() AN07-00161-2E Function name Argument Return value Content of processing void clock(void) void void This function sets the operation clock and the FLASH wait of the microcontroller as follows. CPU/peripheral function operation clock 32MHz (at original frequency of 4MHz) External bus operation clock 4MHz and FLASH wait one cycle void clock(void) { /****** ROM access wait setting ******/ IO_FCTLR.bit.FWC = 1; /* FLASH wait 1 */ /****** Clock Set ******/ IO_CLK.IO_DIVR0.byte = 0x00; IO_CLK.IO_DIVR1.byte = 0x70; IO_CLK.IO_DIVR2.byte = 0x00; IO_UCCR.byte = 0x00; IO_UCCR.byte = 0x06; IO_UCCR.byte = 0x07; IO_CLKG.IO_PLLCR.hword = 0x27F0; IO_PORT3.IO_EPFR19.bit.XAE = 1; IO_CLKG.IO_CSELR.bit.SCEN = 1; IO_CLKG.IO_CSTBR.bit.SOSW = 6; /* BCLK:1divid */ /* TCLK:8dvide */ /* PCLK:1divid */ /* USBCLK:disable */ /* USBCLK:PLL-1divid */ /* USBCLK:enable */ /* CLK:8_PLL, USB:24_PLL */ /* enable X0A,X1A */ /* enable SBCLK */ /* set SBCLK oscillation stabilization wait time */ IO_CLKG.IO_CSELR.bit.PCEN = 1; /* enable PLL */ while( 1 != IO_CLKG.IO_CMONR.bit.PCRDY ){ ; } IO_CLKG.IO_CSELR.bit.CKS = 2; /* Clock Select(MCLK => PLL) */ while( 2 != IO_CLKG.IO_CMONR.bit.CKM ){ ; } } 8 AN07-00161-2E Function name Argument Return value Content of processing void external_bus (void) void void This function sets the external bus access of the microcontroller as follows. void external_bus(void) { unsigned int check; /****** setting of external bus access ******/ IO_PORT2.IO_PFR2.bit.PFR20 = 1; /* A00 output */ IO_PORT2.IO_PFR5.bit.PFR53 = 1; /* CS3 output */ IO_PORT2.IO_PFR5.bit.PFR55 = 1; /* RDX output */ IO_PORT2.IO_PFR5.bit.PFR56 = 1; /* WR0X output*/ IO_PORT2.IO_PFR1.byte = 0xFF; /* D08-D15 output */ IO_EBUS.IO_ASR0 = 0x00000000; IO_EBUS.IO_ACR3 = 0x00000008; IO_EBUS.IO_AWR3 = 0x0000FFF0; IO_EBUS.IO_ASR3 = 0x00240007; /* CS0 setting invalidity */ /* Separate bus, Data 8bit */ /* CS wait setting */ /* 0x0024_0000- 64KB External bus area */ /* Little endian, WRX/CS enable */ /* write data check */ check = IO_EBUS.IO_ASR3; if(check != 0x00240007) { IO_EBUS.IO_ASR3 = 0x00240007; } } 9 /* rewrite */ AN07-00161-2E Function name Argument Return value Content of processing void external_interrupt (void) void void This function sets an external interrupt of the microcontroller as follows. Enables input of INT23_2and rising edge detection interrupt. unsigned char pattern; void external_interrupt(void) { pattern=0x00; IO_ICR[2].byte = 0x10; IO_PORT2.IO_PFR6.bit.PFR67 = 1; IO_PORT3.IO_EPFR31.bit.INT23E0 = 0; IO_PORT3.IO_EPFR31.bit.INT23E1 = 1; IO_ELVR2.bit.LBLA23= 0x02; IO_EIRR2.byte= 0x00; IO_ENIR2.byte= 0x80; /* INT23 interrupt level setting */ /* INT23_2 input enable */ /* INT23_2 input enable */ /* INT23_2 input enable */ /* Riging edge */ /* Interrput flag clear */ /* INT23 enable */ } 10 AN07-00161-2E Function name Argument Return value Content of processing void VFD_control (void) void void This function initializes the fluorescent display tube. #define VFD_Data_Access #define VFD_Comand_Access (volatile unsigned char *)(0x240000) (volatile unsigned char *)(0x240001) void VFD_control(void) { unsigned int i,j,k; unsigned char check_data; *VFD_Comand_Access = 0x14; *VFD_Data_Access = 0x20; *VFD_Comand_Access = 0x04; *VFD_Comand_Access = 0x0E; *VFD_Data_Access = 0x00; *VFD_Comand_Access = 0x0F; *VFD_Data_Access = 0x00; *VFD_Comand_Access = 0x08; for(i=0;i<0x90F;i++) { *VFD_Data_Access = 0x00; } *VFD_Comand_Access = 0x0E; *VFD_Data_Access = 0x00; *VFD_Comand_Access = 0x0F; *VFD_Data_Access = 0x00; *VFD_Comand_Access = 0x09; for(j=0;j<0x90F;j++) { check_data = *VFD_Data_Access; if(check_data != 0x00) { *VFD_Comand_Access = 0x0E; *VFD_Data_Access = 0x00; //0x00 *VFD_Comand_Access = 0x0F; *VFD_Data_Access = 0x00; //0x00 *VFD_Comand_Access = 0x08; for(k=0;k<0x90F;k++) { *VFD_Data_Access = 0x00; } } } *VFD_Comand_Access = 0x03; } 11 /* internal function command */ /* R/W address auto increment */ /* lower address setting of write command */ /* 0x00 */ /* upper address setting of write command */ /* 0x00 */ /* Display data write command */ /* RAM clear (blank display) */ /* lower address setting of read command */ /* 0x00 */ /* upper address setting of read command */ /* 0x00 */ /* Display data read command */ /* RAM data check */ /* lower address setting of write command */ /* 0x00 */ /* upper address setting of write command */ /* 0x00 */ /* Display data write command */ /* RAM clear (blank display) */ /* Display 1,2 ON */ AN07-00161-2E Function name Argument Return value Content of processing __interrupt void ext_int_23(void) void void This function updates the display data at the frame frequency from the fluorescent display tube module input at an external interrupt. Blink the display characters every 128 frames. __interrupt void ext_int_23(void) { IO_EIRR2.byte = 0x00; switch(pattern) { case(0x00): display1(0x00); break; /* Brightness display of 100% */ case(0x80): display1(0xFF); break; /* Brightness display of 0% */ default: break; } pattern = pattern +1; } 12 AN07-00161-2E Function name Argument Return value Content of processing void display1(char set) Char set: Brightness data void This function specifies the brightness data for an argument, and displays the characters in the fluorescent display tube. Moreover, set the display position, the display letter type, and the font size of the characters. void display1(char set) { unsigned int i; //--------------brightness adjustment ------------------*VFD_Comand_Access = 0x13; /* brightness adjustment command */ *VFD_Data_Access = set; /* brightness setting */ for(i=0;i<100;i++); //--------------Character data of the first line------------------*VFD_Comand_Access = 0x0E; /* lower address setting of write command */ *VFD_Data_Access = 0x00; /* lower address setting (Display start address) */ *VFD_Comand_Access = 0x0F; /* upper address setting of write command */ *VFD_Data_Access = 0x00; /* upper address setting (Display start address) */ for(i=0;i<250;i++); font_data_set(0x59,0x19,0x00); /* "Wealth" 24*24 Font size */ font_data_set(0x4E,0x0B,0x00); /* "Person" 24*24 Font size */ font_data_set(0x4C,0x14,0x00); /* "Expert" 24*24 Font size */ font_data_set(0x00,0x00,0xC8); /*"Blank" 8*16 font */ font_data_set(0x06,0x01,0x80); /* "F" 12*24 font size */ font_data_set(0x12,0x01,0x80); /* "R" 12*24 font size */ font_data_set(0x18,0x00,0x80); /* "8" 12*24 font size */ font_data_set(0x10,0x00,0x80); /* "0" 12*24 font size */ //--------------Character data of the second line------------------*VFD_Comand_Access = 0x0E; /* lower address setting of write command */ *VFD_Data_Access = 0x04; /* lower address setting (Display start address) */ *VFD_Comand_Access = 0x0F; /* upper address setting of write command */ *VFD_Data_Access = 0x00; /* upper address setting (Display start address) */ for(i=0;i<250;i++); font_data_set(0x0D,0x01,0x80); /* "M" 12*24 font size */ font_data_set(0x02,0x01,0x80); /* "B" 12*24 font size */ font_data_set(0x19,0x00,0x80); /* "9" 12*24 font size */ font_data_set(0x11,0x00,0x80); /* "1" 12*24 font size */ font_data_set(0x06,0x01,0x80); /* "F" 12*24 font size */ font_data_set(0x16,0x00,0x80); /* "6" 12*24 font size */ font_data_set(0x16,0x00,0x80); /* "6" 12*24 font size */ font_data_set(0x12,0x00,0x80); /* "2" 12*24 font size */ } 13 AN07-00161-2E Function name Argument Return value Content of processing void font_data_set(char font1, char font2, char size) char 1 character-code lower data char font2 character-code upper data char size font size void This function displays the characters that uses font ROM of the fluorescent display tube module. Specify the font type and the font size for an argument. void font_data_set(char font1,char font2,char size) { unsigned int i; *VFD_Comand_Access = 0x07; *VFD_Data_Access = font1; *VFD_Data_Access = font2; *VFD_Data_Access = size; for(i=0;i<250;i++); } /* font ROM data display command */ /* font data */ /* font data */ /* font size */ /* waiting time of font data setting */ 14