Home

F MC-16LX STARTER KIT

image

Contents

1. oet active project Create new folder Add Member to project k oet Project set Linkage order Sample project M Select Set active project Build Executing linker or librarian Delete Project Property Open List File Open HEX File 90 Fujitsu FUJITSU Click on Sample prj to show the list of folders below Click on main c under the Source Files folder to open the main c file 2 6 Sample abe Sample prj Debug Source Files E l sm lo E monitor amp LX sem 0 8 starti 5s asm Lg Include Files Dependencies 1 Diehue After the main c file is opened create your program in the section indicated by the red dotted line below include _ffmc16 h include extern h include monitor h void main void Input the program to be created here Vector Table pragma section INTVECT locate Oxfffc00 pragma intvect start 0x8 0x0 Reset Vector If another program has already been input to the main c file delete the lines from the above program list section enclosed by the red dotted line before creating your new program If you need to save the already input program perform the procedure below to save the program as a backup file before deleting the program O Fujitsu 91 FUJITSU Program source file backup procedure While editing a source file select
2. e i ss Cd External interrupt processing ends Figure 8 3 Flow of the program O Fujitsu 87 FUJITSU 8 3 2 Creation and execution of the program Let us now create the actual program According to the procedure described in Appendix open the source file main c in sample prj and input the program that 15 the circled part in Figure 8 4 Example of program code main routine and Figure 8 5 Example of program code interrupt routine Use all files except main c without any changes After the program is input build the program according to the procedure described in Appendix A 2 If an error is output reconfirm that the contents of the program are correct When the build is successful ACCEMIC MDE starts automatically When the ACCEMIC MDE window appears execute the program and check the operation For the procedure of the program execution see Appendix A 3 When the program starts correctly check the LEDs When the temperature of the room where the operation is performed is between 10 and 20 LED 1 and LED 2 are supposed to be on The number of LEDs lighted varies with the temperature detected by the sensor For example warm up the sensor part using your fingers When warming up the peripheral part of the sensor be aware of the temperature When it gets hot it may damage the board voi main v
3. p PDR value nihit Port 2 pins P20 P21 P22 P23 P24 SW2 SWI P25 Figure 3 3 Outline of PDR2 and DDR2 registers conceptual diagram When using port 2 pins you must specify whether they are used for input or they are used for output DDR2 is the 8 bit register to switch the signal direction between input and output of each pin at port 2 The association of the bits of DDR2 with the pins at port 2 is as shown in Figure 3 3 To use a pin for output 1 should be written to the corresponding bit of DDR2 to use the pin for input 0 should be written to the corresponding bit of DDR2 P25 and P27 are used as input pins to input signals from SW and SW2 Therefore 0 should be written to the bits 5 and 7 of DDR2 The above explanation can be summarized into the following processes to detect the switch state by a microcomputer program 1 Write 0 to DDR2 bits 5 and 7 and set port 2 pins P25 and P27 to input mode 2 Read the values of PDR2 bits 5 and 7 50 Fujitsu FUJITSU When the read value is 0 the switch can be determined to be in the on state When the read value is 1 the switch can be determined to be in the off state 3 2 How to create and execute a program to control LEDs by switch operation This section explains how to create a program to detect the switch operation state The program also controls LED operation to enable you to visually know that the switch o
4. Executing Inker or librarian Delete Project Open List File F Open HES File eetun Window Help ect Select a project to be debugged and click the right mouse button A submenu appears Select Set active project from the submenu The project name in the list is displayed in boldface and debugging of the project is enabled 25 FUJITSU 1 1 6 Starting and setting up of ACCEMIC MDE Use the Start kit wsp workspace file opened in the previous step to start ACCEMIC MDE Confirm that the current active project of SOFTUNE is special prj Select Build B from the Project P menu to execute a build operation ga Workbench Start kit File Edit lew Project Debug Setup Window Help Aetive Project reel fered fare pec BOTEL aos E des un Add Member d setup Workspace Setup Project E Workspace E LED abs Customize Build Done Project Dependencies l3 Buzzer Configuration d timer ch Include Dependencies zi Int Compile P E sencor ShiftFB E mg Soul Hg Deue H Sampleabs Samolepry When the build operation is executed the output screen of SOFTUNE displays the messages below Build operation started start905s asm monitorl16L X asm FFMCI6 C PPG 01 int c Linked 103121 0 warnings were output after S C F check D Xjouet bleuYfujitsu starter kitYXspecialYDebu
5. 4 A D converter interrupt permission ADCS H bytel3 1 5 Infinite loop Y AD_DATA lt 168 N ar LED lighting processing PDRI byte 0x18 Y AD_DATA lt 210 N E LED lighting processing PDRI byte 0x010 LED lighting processing PDRI byte 0x00 km i ss Cd External interrupt processing ends Figure 7 5 Flow of the program O Fujitsu 9 FUJITSU 7 2 20 Creation and execution of the program Let us now create the actual program According to the procedure described in Appendix A 1 open the source file main c in the sample prj and input the program that is the circled part in Figures A 1 and A 1 Use all files except main c without any changes After the program is input build the program according to the procedure described in Appendix A 2 If an error is output reconfirm that the program accords to the contents of Figure 6 4 Example of program code main routine and Figure 6 4 Example of program code main routine When the build is succeeded ACCEMIC MDE starts automatically When the ACCEMIC MDE window appears execute the program and check the operation For the procedure of the program execution see Appendix A 3 When the program starts correctly check the operation
6. Fujitsu 83 FUJITSU Figure 8 2 Peripheral circuit diagram of temperature sensor image shows the peripheral circuit diagram of the temperature sensor on the Starter Kit board In this circuit when the resistance of the temperature sensor changes the input voltage of the A D converter of the microcomputer also changes Suppose the resistance of the temperature sensor 1s Rry Then the input voltage of the A D converter can be calculated by using the following formula The necessary knowledge to calculate it is only Ohm s law Starter Kit board Microcomputer Pin ANI R 10 kQ Temperature Sensor Figure 8 2 Peripheral circuit diagram of temperature sensor image Input voltage of the A D converter According to the Ohm s law the current in the circuit 1s as shown below I Vec R Ri Therefore 15 R 10 kQ R x V VAN 1 Vn xI R Roy GN Because R 10 kQ and Vec 5 0 V the input voltage to the A D converter can be obtained by using the following formula 30x Ry 10000 R Table 8 3 Relationship between the measured temperature of Starter Kit and A D input voltage summarizes the relationship between the measured temperature from 5 to 50 and 84 Fujitsu FUJITSU the input voltage of the A D converter By measuring the input voltage of the A D converter the temperature can be known accordingly Table 8 3 Re
7. timer ch Include Dependencies l Il Interr a edi f G Make Shift FB Ctrl F Ei tart805 asm Lg Include Files 3 88 Dependencies Diehue If no error is found in the created program ACCEMIC MDE starts automatically and displays the information shown below for 10 s This information is displayed only by the trial version of ACCEMIC MDE not displayed by the product version An OK button appears 10 s later Click the OK button 94 Fujitsu FUJITSU Demo Information 459819 lf The following software is for demonstration purposes only This License allows you to install and use the Accemic MDE monitor kernel on one target MCU at a time The Accemic software and all its deliverables are intended and must only be used in an EVALUATION LABORATORY ENVIRONMENT Under no circumstances it may be used in a product Symbolic information is limited Please read our license terms for additional information Thank you for your fairness Copyright c 2001 2003 Accernic GmbH amp Co KG All rights reserved If an error is found in the created program the error is indicated as shown below Correct the indicated error and perform building again EE SOFTUNE Workbench Start kit main c File Edit View Project Debug Setup Window Help 8 x 18 c s Ext sole 1201 m Em 0 main c c fkongoutm
8. If any products described in this document represent goods or technologies subject to certain restrictions on export under the Foreign Exchange and Foreign Trade Control Law of Japan the prior authorization by Japanese government according to the law is required for export of those products from Japan Copyright 2005 FUJITSU LIMITED All rights reserved Fujitsu FUJITSU Contents Preface 1 3 1 1 4 1 1 5 1 1 6 1 1 7 1 1 8 1 1 9 2 1 22 2 3 2 4 2 4 1 2 4 2 25 2 21 252 3 1 2 2 2 2 1 SA 4 1 ousbanus N 1 Upo Starner Ri 2 Setting Up of Personal Computer a a a aS 8 Installing of USB driver va tn od SEEEN 9 Installing of integrated development environment SOFTUNE Iiarted Tunctioli Version sees pete tsp 10 Installing of demonstration version trial version of ACCEMIC MDE 16 Setting up of evaluation board and connecting of board to the personal CODUL NIRE DR REPE 2 Starting and setting Up of SOPTUUNND eet trahe a rera du a aat aae naeh 23 Starting and setting up of ACCEMIC MDE seeRR 26 Terminating of ACCEMIC ee nee eere eren eset sss 27 Terminating of SOFTUNE ccc ccccccessssssec
9. Save As A from the File menu ge SCOFTUNE Workbench Start kit main c zi File Edit Project Debug Setup Window Help Mer Open Same Close p Open Workspace Close Workspace Save Cts 2 SRK THIS SAMPLE CODE soe ACCEPTS NO RESP NSIE save All lp Print 5 Date 2005 nn C REESE NL NE Program TIER Hecent Workspace File k x CPL EMC Exit g Ves 3 18 FFMO16C 101 Include tief 111 x timc _ A start905s asm 12 Output PIO ov Include Files 13 A a l4 include ffmcl8 h 15 include extem h The dialog box below appears Select Text file and then click OK SE Output Window Cancel Project file Sample pri Next the dialog box below appears Select the folder to save the program in the Save in field specify the file name in the File name field and then click Save Save in sample c File name main_old d Save as Ippe i Files Cancel 2 92 Fujitsu FUJITSU The saved file is still displayed Close the displayed file ge SOF TUNE Workbench Start kit main c File Edit Project j 8 ZH View C 5 ii ET Name of the saved file main old c is displayed Workspace Start kit Af LED abs LEDpri Debue i Input ans Inputprj Debi
10. This setting was described in Chapter 3 Next the program makes the settings related to the external interrupt and enables the external interrupt Then the program makes LEDI be blinking Blinking of LEDI continues until the stop or reset button is pressed on the ACCEMIC screen When SW1 is pressed after the external interrupt is enabled an INTS interrupt is generated and an interrupt routine 15 called The interrupt routine clears the interrupt factor and switches LED3 between on and off states In summary this program makes LEDI blinking processing usually as the main processing and switches LED3 between the on and off states only when the interrupt is generated by switch operation Start of main processin Interrupt generated by SW1 I v Start of external interrupt processing Clear external interrupt factor Set output pins for LED1 and LED3 PDR1 bit0 0 DDRI bitO 1 PDRI bit2 0 DDRI bit2 1 1 Set input pin for SW 1 ENRR bit5 0 7 DDR2 bit5 0 2 i Turn on or off LED3 Set external interrupt of SW PDR1 bit2 PDR1 bit2 8 ENIR bit5 0 ELVR bit10 1 ELVR bit11 1 ENRR bit5 0 End of external interrupt processing Enable interrupt ENIR bitS 1 4 3000 counted Turn on or off LEDI PDR1 bit0 PDR1 bit0 6 Figure 5 3 Flow of the program 66 O Fujitsu FUJITSU 5 3 2 Creating and executing of p
11. by the A D converter and processed by the microcomputer FUJITSU MBO0FSE7S CO ip gt z T Volume tab for adjusting applied voltage Figure 7 1 Adjustment of applied voltage with volume tab 7 Analog and Digital Do you know the difference between analog and digital Those are explained as follows in a dictionary Table 7 1 Analog and digital Definition in a dictionary Expressing states of a material or system according to its physical quantity that varies continuously ol Expressing states of a material or system according Digital to discrete signals such as numbers or characters Although you read the above definitions you may have a hard time picturing them Intuitively speaking initially everything is in analog value At the moment a person tries to determine the size or variety of the analog value the quantity becomes digital value In other words a digital value exists only when an analog value exists A digital value is what an analog value is divided into some levels for easier handling and converted to easier 74 Fujitsu FUJITSU understandable form Figure 7 2 Low accurate digital conversion shows an example of analog and digital signals The blue line indicates an analog signal and the black line indicates a digital signal The digital signal in this figure 1s a low accurate A D conversion result Fujitsu Figure 7 2 Low accurate digital conve
12. 0 to the bit 5 of both EIRR and ENIR to disable the external interrupt via INT5 2 Write 1 to the bits 10 and 11 of ELVR to generate an external interrupt when a falling edge is detected 3 Write 0 to the bit 13 of both EIRR and ENIR to clear the INTS interrupt factor 4 Write l to the bit 5 of both EIRR and ENIR to enable the external interrupt via INT5 5 3 How to create and execute a program to control LED by switch Input operation This section explains how to create a program to detect switch operation by an external interrupt The program is also designed to operate an LED to enable you to visually see the detection of switch operation The program incorporates the method to turn on an LED explained in Chapter 2 5 3 1 Outline of the program to be created Let s create a program to better understand the operation of interrupt processing This program will be very similar in contents to the LED control program created in Chapter 2 except that this program will have an additional portion to process the interrupt generated by switch operation The main operation by the program is as described O Fujitsu 65 FUJITSU below Figure 5 3 shows the flow of the program 1 When the program starts LEDI starts blinking 2 When SW1 is pressed LED3 goes on 3 Each time SW1 is pressed LED3 goes off and on alternately The main processing by the program begins with the setting of LED output and switch input pins
13. Suppose the LED on and off time is one second The value to be set for the counter of the 16 bit reload timer can be calculated by using the following expression accordingly LED on and off time period Count clock cycle 16 us x Number of counts 62500 5 Fujitsu Ti FUJITSU Table 6 1 Register setting of 16 bit reload timer Setting value meaning Timer count value EE 0 x F424 62500 counts DO to D15 bitO to bit15 Timer count clock CSLO CSL 1 bit10 bit11 TMCSRO register 0 Timer stops at an interrupt generation Timer count repeat 1 Timer count is reset at an interrupt generation and P RELD bit4 E the operation continues 10 count clock cycle 16 us Timer interrupt 0 Timer interrupt permitted permission Timer interrupt not permitted Timer interrupt 0 There is no timer interrupt factor factor There is a timer interrupt factor Timer operation TMCSRO register 0 Not permitted permission CNTE bit1 1 Permitted ac ene Coe ee TMCSRO register 0 No effect TRG bit0 1 Start Count clock cycle 16 us 32 Internal operation frequency 2 MHz 6 2 2 Creation and execution of the program Let us now create the actual program According to the procedure described in Appendix A 1 open the source file main c in sample prj and input the program that 1s the circled part in Figure 6 4 Example of program code main routine and Figure 6 5 Example of pro
14. Values in Registers B 1 About the Method To Write Read Values in Registers The sample program codes presented in this document include such descriptions as IO XXX byte and IO YYY bit These are the convenient formats of description defined in the I O header file You can use these description formats after setting up Softune Workbench the development environment provided by the Starter Kit An actual C language program contains the descriptions of instructions to write values to various registers to specify microcomputer operation The above description formats enable you to write values to registers in C language For example assume the instruction to write Oxff to the port 1 data register PDR1 which is allocated at address 0x000001 The instruction 1s described in C language as follows volatile char 0x000001 OxFF It is not immediately obvious what kind of processing the above description specifies If you use one of the description formats defined in the I O header file you can write the same instruction as follows IO PDRI byte Oxff You can use this description because the following operation is defined in a separate file Substituting a value for variable IO PDRI byte Writing the value to register at address 0x000001 It is now immediately clear that the description specifies the processing to write Oxff to the PDRI register The I O header file contains the definitions of these description formats f
15. device Piezoelectric devices are also used for piezoelectric loudspeakers crystal earphones vibration sensors and microphones 54 Fujitsu Fujitsu FUJITSU 4 1 1 Crystalline characteristics of piezoelectric device A piezoelectric device uses a substance that has a polarization characteristic Some crystals have an electrical deflection as an inherent characteristic This characteristic is called polarization and the crystal having this characteristic is called a polarized crystal More specifically the polarized crystal contains polarized molecules as shown in Figure 4 1 In the figure the direction of polarization is represented by the green arrow indicating the direction from the positive pole to the negative ole Figure 4 1 Polarization of molecules and crystal 4 1 2 Piezoelectric characteristics As shown in Figure 4 2 a crystal sometimes has a characteristic that expands the crystal when a voltage is applied in the direction of polarization direction of green arrow This characteristic is called the piezoelectric effect When a piezoelectric crystal is given a voltage in the reverse direction of polarization reverse direction of green arrow the crystal contracts Expansion Contraction Figure 4 2 Piezoelectric crystal B5 FUJITSU 4 1 3 Principle of piezoelectric device When an AC voltage 15 applied across a piezoelectric crystal the crystal contracts or expands alt
16. dotted line in Figure 3 5 Use the files other than main c without modification After the input of the program build the program according to the procedure described in Appendix A 2 If an error message is output check that the content of the input program is exactly the same as the description shown in Figure 3 5 When the build operation ends successfully ACCEMIC MDE starts automatically After the ACCEMIC MDE window appears execute the program and check its operation For how to execute the program see Appendix A 3 After executing the program press SW1 SW2 If LED1 or LED2 goes on the program operation is correct void main void set il 7 IO PDRI byte 0x00 lt 1 Port I LED control output setting IO DDRI byte 0x1F IO DDR2 byte 0x00 Gal 2 Port 2 SW input input setting while 1 1 iffIO PDR2 bit P25 1 4 3 SW1 input state IO PDRI bit Pl0 1 4 LEDI on else IO_PDR1 bit P10 0 W 5 LEDI off PDR2 bit P25 1 1 6 SW2 input state IO PDRI bit P10 1 7 LED2 on j else1 IO PDR1 bit P10 0 2 Program code added Figure 3 5 Sample program code main routine 52 Fujitsu FUJITSU Descriptions IO XXX byte and IO YYY bit included in the above program code are the convenient formats of description defined in the I O header file For further information see Appendix B 1 O Fujitsu 53 FUJITSU 4 Let s try to
17. electrodes anode and cathode When a voltage is applied across the LED so that the anode is at a positive potential with respect to the cathode a current flows and the LED emits light In the circuit shown in Figure 2 1 the LED goes on emits light when the switch SW is turned on and goes off when the switch is turned off The brightness of the LED is controlled through the adjustment of flowing current by changing the resistance As the current becomes larger the emitted light becomes brighter An LED can emit light in red orange yellow green or blue Since the three primary colors blue green and red of light can be produced by combinations of the five colors a full color can be displayed by LEDs n Anode Cathode Figure 2 1 LED Compared with an incandescent lamp the LED has lower power consumption longer operating life and shorter response time So the LED is used in lighting equipment backlight for liquid crystal display monitor traffic signals tail lamps of cars and displays The board has red of LED3 and green of LEDs1 2 4 and 5 as shown in Figure 2 2 40 Fujitsu FUJITSU Figure 2 2 LEDs mounted on the board 2 2 How can the LED emit light The LED has a pn junction structure which is the most fundamental structure of semiconductor devices As shown in Figure 2 3 the pn junction structure consists of a p type semiconductor containing many electron holes and an n type semiconductor con
18. microcomputers Figure 5 1 Cases of interrupt In the field of microcomputer and embedded system using interrupts in programs is generally regarded as an efficient programming method In the real word you cannot predict when you will receive telephone calls and visitors You cannot focus on study if you have to often look at the telephone or get the door to check to see if there 15 a visitor Therefore you usually keep concentrating on study and interrupt it only when you receive a telephone call or visitor actually this is more efficient The microcomputer is provided with a mechanism that notifies the microcomputer program of a switch on off operation communication data reception timer event or the like O Fujitsu 63 FUJITSU corresponding to the telephone call or visitor in the real world when the event occurs This mechanism is the interrupt A program can be efficient when it uses interrupts The sample program described in Chapter 3 uses a procedure for checking the on off state of the switches cyclically However an interrupt is used in the program the microcomputer can be notified of a switch on off operation by the interrupt when the operation occurs Therefore the processing to cyclically check the on off state of the switches can be eliminated and the efficiency of the program can be increased thereby This chapter explains how to detect switch operation by using an interrupt and how to create the program for the op
19. sound a buzzer Our daily life 1s full of sounds Many of them are not natural sounds but artificial sounds that give us signals draw our attention to something and give us information The loud sound of the alarm clock wakes us up every morning The cooking timer buzzer sounds to let us know when to stop boiling eggs for our favorite softness of yolk We are surrounded and given much information by artificial sounds varied in loudness and tone including those of microwave ovens level crossing alarms and automobile horns Microcomputers are often used to produce these artificial sounds A microcomputer can be used to control the timing tone and pitch of a sound This chapter explains how to control a buzzer sound simply by using microcomputer functions 4 Devices used for buzzer Before explaining the mechanism of a buzzer this section describes the piezoelectric device that is used for a buzzer A piezoelectric device is a circuit element that uses a piezoelectric effect The piezoelectric device incorporates a substance characterized by the piezoelectric effect which causes a voltage when an impact or pressure 15 applied or the inverse piezoelectric effect which causes a crystalline distortion when a voltage 15 applied A quartz oscillator is a familiar example of piezoelectric device that uses the piezoelectric characteristics The buzzer to be controlled by the microcomputer of the Starter Kit incorporates this piezoelectric
20. the Flash memory and writing the program It takes several tens of seconds to complete the writing Wait fora while When the program writing ends the progress bar disappears 38 Fujitsu Fujitsu FUJITSU a Curent Applcaban Source fle t after reset autharnzatian E Au Y Seton dese gt 0800 LINE 00H DOFF 0TS5F 2540 OR CCR 40H After the writing ends stop ACCEMIC MDE and SFTUNE Then press the RESET button on the board while the USB cable is connected The same operations as confirmed on ACCEMIC MDE are available Described above are the basic operation procedures by using the sample programs to start debugging Next let s try to control LED lighting 39 FUJITSU 2 Let s try to turn on the LED LEDs appear everywhere in our everyday lives for example the LEDs indicating the power on status of a laptop personal computer digital camera washing machine air conditioner or rice cooker the LEDs display indicating train departure times at a railroad station and in traffic signals using LEDs which have now become widespread This chapter explains how to control the port output of the microcomputer to turn on an LED on the board 2 1 What is an LED A light emitting diode LED is a semiconductor device that emits light when an electric current passes through it The LED 1s represented by the symbol as shown in Figure 2 1 An LED has two
21. to visually confirm the on off operation of the LED You can vary the on off time by changing the currently set value 30000 On off time count 1 0 1 lt 30000 1 46 Fujitsu Fujitsu FUJITSU START Set LEDS to on Set P14 output level to low PDR1 bit4 0 1 Set P14 to output mode 2 DDRI bit4 1 Count reached 30000 3 i yes Set LEDS to off 4 Set P14 output level to high PDR1 bit4 1 4 Count reached 30000 5 set LEDS to on 6 Set P14 output level to low PDR1 bit4 0 Figure 2 10 Flow of the program to make LEDS blinking 2 5 0 Creating and executing of program Let us now create the actual program According to the procedure described in Appendix open the source file main c stored in sample prj and input the program portion after while 1 enclosed by dotted line in Figure 2 11 to the LED lighting program created in Section 2 4 2 Use the files other than main c without modification After the input of the program build the program according to the procedure described in Appendix A 2 Ifan error message is output check that the content of the input program is exactly the same as the description shown in Figure 2 11 When the build operation ends successfully ACCEMIC MDE starts automatically After the ACCEMIC MDE window appears execute the program and check its operation For how to execute the program see Appendix A 3 While the program is execut
22. w I GXSoftuneslibxBt inc ludessamples MBS0385 I C Program xl OK Cancel Apply Fujitsu 99 FUJITSU Use the same procedure for setting the include path of the assembler Sety Fro j ect Select this tab for setting Target of setting General MGU Compiler e 1s the include path of the l Gatezory Include Path Ff LED pri H E Inputprj lf Buzzerprj Include Path H E Wnlume prj Files AccemicMDE2Z 2SKXSampless16LsXCommonInclude w iex timer pr Path List Add Delete uo Down al sensor prj i 3 assembler ample pr Files 25k 5amples 16L Commoninclude Cancel m 100 O Fujitsu
23. 2 xX THIS SAMPLE COO Buzzerabe Euzzar prj I 3 ACCEPTS NO RESPCNSIB Volums aba Valumaprj J Xolorooeoro propor ICICI HOEK i timer cbe timar prj Deb Date 2005 M zs Interrupt abe Interruptpr B E PRO JECT Samp zenzorpri I ee XP Fui i i epecialabe mane e E Sample abe Sample x CPU FMi ra Source Files x TS Voc zn io 101 Include e E _ 1 11 x utput 12 moneo E 13 r HC l4ltinclude ffmcl0 h j helo es 15l inelude extern hd After closing the saved file find the original file name of the saved file main old c in this example in the Source Files folder under Sample prj in the list and then click on the original file name to open the file In this status you can edit the source file O Fujitsu 93 FUJITSU A 2 Program Building Procedure After creating a program confirm that the board is connected to the personal computer by the USB cable and then start the procedure to build the program ga SOP TUNE Workbench Start kt File Edit Project Debug Window Help Active Project b E m H Add Project k setup Workspace Setup Project El Workspace LED abe Customee Build l Input zo Project Dependencies Buzzer Configuration li o hme
24. ADC int function is to be executed when an interrupt of the A D converter is generated It is generally required to register the interrupt routine on the vector table so that the ADC int function is executed when an interrupt of the A D converter is generated In this sample project however it has already been registered so it can be used without the registration In the above code there are some expressions such as XXX byte or IO YYY bit These are the useful description formats which are defined in the IO header file For more information see the Appendix 81 FUJITSU 8 Let s use the temperature sensor Most of the microcomputer application systems contain various sensors to detect the external information There are various sensors for different purposes and requirements and one of those various sensors is the temperature sensor The temperature sensor is as its name suggests a sensor to detect changes in temperature Examples of what the temperature sensor is used for include the temperature control features of air conditioners and refrigerators In this way various sensor s are used for household appliances This Starter Kit contains the temperature sensor This chapter describes how to detect temperature by using this temperature sensor 8 1 What is a temperature sensor The temperature sensor is a sensor to detect temperature changes Simply stated it is a thermometer to measure temperature There are v
25. CCEMIC MDE has started the window as shown below appears E Accemic MDE Demo de mije o x File Start View Tools Preferences Help OP SvZC r PGdsirimlowsy ABS Locals Globals main c AIG PIB ADCR 768 0x0300 ols ADCS 512 0 0200 z gt IT NNNM din T E include extern h JAE nck ude meni tor h Source Files nel nai d gt H fi amp def h int i Mito ay cork ffmc15 c E ffmc1 amp h POR F AR Ret Dita Peg ster to WR turn off 18 _190385 h vhi le i end ess H _standby h s e H cpu_16lx h for i O ic i MR av extem h IO FCRI bte urna fhe LED x E 1 amp asm Address Reaiter Window 7 8 start905s asm 1 0000 A OOF FOOCE 0802 LINK A 0000 00 00 0 54011 MOV EE 0O0FF00D3 52111F MOV pP Em m oOFFOOD6 DO MOVN EN ue OOFFOOD 7 CBFE MOVW USB loo D0OFFO00D9 BBFE MOVW 038C OOFFOODB 353075 CMPW oo OOFFOODE FBOS BGE 028 0 0 7353 INCU oam 00FFOOE3 60F4 BRA OOFFOOES DO MOVN ONOVOIG 7 zl xj M m zoroso RPlo State Breaked INT Level Disable 2 Use the buttons shown below to control program Operation when clicked Continuous Starts and runs the program continuously execution Stops the running program 96 Fujitsu FUJITSU B Appendix Method To Write Read
26. FUJITSU Electronic Devices User s Manual F MC 16LX STARTER KIT jouet bleu for microcomputer starters USER S MANUAL FUJITSU Revision History Jun 27 2005 Edition 1 0 Initial release O Fujitsu FUJITSU Precautions The contents of this document are subject to change without notice The general information of operation and samples of application circuits described in this document are mere examples of standard operation and use of semiconductor devices They are not intended to guarantee the device operation in actual equipment The customer who incorporates the operation or sample circuit described in this document in the customer s system should design the system on the customer s own responsibility Fujitsu will not assume responsibility for damages resulting from the use of the information described in this document The general information of operation circuit diagrams and other technical information described in this document are not intended to grant the customer any license for the intellectual property rights such as patents and copyrights and other rights held by Fujitsu or a third party Also the information is not intended to guarantee the customer to practice any intellectual property or other rights held by third parties Fujitsu will not assume responsibility for infringement of any intellectual property or other rights of third parties arising from the use of the information or circuit diagrams
27. Hz microcomputer It is an oscillator for the main microcomputer Oscillator for Kyocera s crystal oscillator CX 5FD communication CX SFD 6MHZz It is an oscillator for the USB communication microcomputer microcomputer Table 1 2 Evaluation board parts m oo ON wa ma 11 12 14 m Ne Fujitsu 5 FUJITSU Figure 1 3shows the system configuration Prepare a personal computer by yourself FUJITSU 9 F MC16LX c ie Oo o ie 3 gs e 11 on 4 zr 058 CONTROL FIRMWARE INTERFACE oh om LET 1 H N id 2 LINE T qe DR cos LI s OS EJ U UL EER 5 21 i a 8 At s BILE lt 7 n 0 v gt o LI Nx F ET m 7 ar ALI 5 eT Me or r a o a Ma 2 SENSOR RR mt Figure 1 3 System configuration Connect the board to the personal computer by using the accessory USB cable Supply power to the board by USB bus power system Connect the evaluation board to the personal computer using the accessory USB cable Use the USB bus power as the power supply Microcontroller evaluation board Be sure to connect the USB cable directly to the personal computer Do not connect the USB cable via a USB hub O Fujitsu FUJITSU Table 1 3 shows the assignment of functions to the
28. I bit PI0 IO PDRI bit P10 6 LED state change Figure 5 4 Sample program code main routine Fujitsu 67 FUJITSU interrupt void ext int void IO EIRR bit ER4 0x0 lt 7 Interrupt factor clearance IO PDRI bit PI2 IO PDRI bit P12 mI 8 LED on off switching Program code added Figure 5 5 Sample program code interrupt routine The ext int function is called when the external interrupt INT5 is generated If you program the above operation without using this sample project you should register the interrupt routine in the vector table so that the ext_int function will be called when the external interrupt INT5 is generated You need not perform the registration when you use this sample project in which the interrupt routine has already been registered Descriptions IO XXX byte and IO YYY bit included in the above program code are the convenient formats of description defined in the I O header file For further information see Appendix B 1 68 O Fujitsu FUJITSU 6 Let s blink the LED by using a timer interrupt The procedure for controlling the LED blinking is described in Item 2 5 in Chapter2 There are some other methods to control the LED blinking other than the method described in Chapter 2 One of them is the method using a timer interrupt This chapter describes the method to control the LED blinking by using a 16 bit reload timer 6 1 What is a timer Let s begin with a brief ex
29. It can be confirmed that the LEDs 1 to 5 are lighted according to the size of the applied voltage that has been adjusted on the volume voi main void Program code to be added IO PDRI byte Ox1F 1 Port 1 LED control output setting IO DDRI byte 0x1F I l JO DDRS bit D50 0 2 Port 5 AD input input setting JO ICRO3 byte 0x06 IO ADCSH bit BUSY 0 3 Stop A D converter IO ADER byte 0x01 4 A D converter initialization IO ADCSL byte 0x80 A D converter channel setting ADCRLH byte ADCRH OxF8 A D converter mode setting A D sampling condition setting IO ADCSHLbit INTE 1 mm 5 AD conversion IO ADCSH bit STRT 1 3 interrupt permission 6 A D conversion starts while 1 Figure 7 6 Example of program code main routine 80 O Fujitsu Fujitsu FUJITSU interrupt void ADC int void Program code to be added unsigned char AD DATA IO ADCSH bit INT 0 7 Clearing interrupt factor AD DATA IO ADCRLH DATAS HB Obtain A D converted value if AD DATA gt 171 9 LED control based on AD value IO PDRI byte 0x1F j else DATA gt 142 IO PDRI byte Ox1E else if AD DATA gt 113 IO PDRI byte 0 1 else if AD gt 87 IO PDRI byte 0x18 else if AD_ DATA gt 66 IO PDRI byte 0x10 Figure 7 7 Example of program code interrupt routine The
30. Ma the setup will clase To install F2MC 16 Family SOFTUNE Professional Pack E valuation Version must accept this agreement 15 If you accept agreement click Yes If you refuse the agreement you cannot install SOFTUNE F2MC 16 Family SOFTUNE Professional Pack Evaluation Version information The version of the tools installed with this setup is shown below Contents of this Professional Package REY 300018 E L 2005 05 09 This package 1 included the following softwares 1 F2MC 16 Family SOFTUNE Workbench v 30L32 EVL 2 FZML 15 Family SOFTUNE C Compiler 30L14 E L 3 SOFTUNE C Checker V 3ULTU 4 F2MC 16 Family SOFTLINE Assembler Pack REV 300D13 EVL fasmBI7s W30L11 zu Ld retell rela Cancel Click Next gt 12 O Fujitsu Fujitsu FUJITSU F2MC 16 Family SOFTUNE Professional Pack Evaluation Choose Destination Select Folder where Setup will install files Either the Fujitsu semiconductor support tool SUFTUNE is already installed ar the environment information used prior to still remains Destination Directory C S oftune Install the SOFTUNE Tools in the same folder Install to the above folder when continuing the environment information Destination Folder CS ottune Browse Cancel Click Next gt Do not change the installation destination folder here F2MC 16 Family SOFTUNE Professional Pack Evaluation
31. NE Professional Pack Evaluation V Setup Complete Setup has Finished installing F2eMC 16 Family SOFTUNE Professional Pack E valuation V ersian on your computer Click Finish to complete Setup Click Finish The installation of SOFTUNE limited function version is completed Proceed to the installation of the demonstration version of ACCEMIC MDE O Fujitsu 15 FUJITSU 1 1 3 Installing of demonstration version trial version of ACCEMIC MDE Install the demonstration version trial version of ACCEMIC MDE The trial version of ACCEMIC MDE is subject to a limitation on the size of the program that can be debugged to 12 The trial version cannot be used to create a program over 12 kB D Insert the CD ROM into the CD ROM drive When using the download version download the software for F MC 16LX Starter Kit jouet bleu and open the folder where the files are decompressed 2 Double click the MDE 16LX DEMO V22ST STARTERKIT exe icon in the YXjouet bleuYMDE 16LX DEMO V22ST STARTERKIT folder to start x MOE TEC BE V sT ST ARTERKITex msmuuusanunuauumuEAMEAEEHERRAREEREEEEEE installation Ja Accemic MDE Demo for MBBLDF387 Starter Kit Welcome ta amp ccemic Demo Far MBSU F 387 Starter Kit Setup program This program will install Accemic MDE Demo for MBS F3S Starter Rit on your computer It is strongly recommended that you exit all Windows programe before running this Set
32. Select Components Choose the components Setup will install Select the components you want to install and clear the components you do nat want to install iam UF TUNE Workbench E valuation Version 12007 mw SOFTUNE Workbench Integrated Environment fg SOFTUNE C CompilerE valuation Version Tw SUFTUMNE Assembler Pack E valuation Version Integrated Environment 1S8BFTLUME C Checker Development Platform far the F2MC 16 Family Space Required on 144288 Space Available on 1656865 K lt Back Cancel Click Next gt 13 lt o FUJITSU F2MC 16 Family SOFTUNE Professional Pack Evaluation Install information Check the current setting before starting to copy files Click the BACK button to make changes Click the NEXT button to start copying files Curent Settings Destination Director C SS oftune SOFTUNE Workberch E valuation Version SOFTUNE Workbench Install SOFTUNE Campiler E valuation version Install SUFTLHME Assembler Pack E valuation Install SUFTLHME E Checker Mo Install Cancel Click Next gt F2MC 16 Family SOFTUNE Professional Pack Evaluation Setup Status F2MC 16 Family SOFTUNE Professional Pack E valuation Version Setup is performing the requested operations Installing SOFTUNE Workbench C Sottune BIN AF 907 exe The installation is executed 14 Fujitsu FUJITSU F2MC 16 Family SOFTU
33. UNE Workbench Start Eit File Edit View Proect Debug Setup Window Help septo Caen bo 2 Ae presens Workspace Start kit i LED abs LED prj Debug li Inputabs Input Debi Buzzerabs Buzzerpri I Wolume abe Valumeprj i timer che timarpej Deb ii Interrunt abz Interrupt prj ii senzorabe eenzorpe LI enecialprj 5Sample abz Sampleq Eg Source Files m Include Files sm Dependencies s Debug 24 O Fujitsu Fujitsu Make the settings for the active project FUJITSU Multiple projects can be stored in one workspace file The sample programs include already created projects including LED prj Input prj and Buzzer prj Since program debugging is performed in units of projects you should specify the project to be debugged as an active project 3O0F TUME Workbench Start kit Fille Edit View Proect Debug aon pu sm E Fa ea Cy 7 spec ial Debug Workspace Start kit i LED abs LEDpri Debue fi Inputabs inputprj Debi li Buzzerabs Buzzerpri I li Wolume abe Valumeprj i timar zba timarpej Deb i Ail Interrustabs prj BE sensor BADE prj i TEE pro Create new folder Add Member to project aet Froject B B Sample abs Makes Build Property set Linkage order
34. You should install the software on your personal computer before connecting the evaluation board to the personal computer The Starter Kit software is available in two versions A CD ROM version and a download version the download version is not delivered on CD ROM Table 1 1 List of components and necessary equipment Board 1 Evaluation board equipped with Fujitsu F2MC 16LX Series See Figure 1 1 MB90F387 Microcomputer ree ium a Installation CD ROM for installing SOFTUNE ACCEMIC MDE and CD ROM version CD ROM sample programs only Related manuals are contained on the CD ROM The download User s Manual jouet bleu start kit manual E pdf version has the USB Driver Installation Manual same contents USB driver installation manual E pdf 90385 Series Hardware Manual MB90385 HM E pdf 90385 Series Data Sheet MB90385 DS E pdf Set of SOFTUNE related manuals SOFTUNEX MANUAL folder Personal Personal computer on which Windows XP Me 2000 98 can To be prepared by computer operate normally the user USB2 0 port necessary About 200 megabytes of free space necessary on the hard disk 27 Fujitsu FUJITSU 2 Target device expansion pin CN2 2 Target device expansion pin CN1 13 Oscillator for main microcomputer 10 USB host connecter 1 Target device 5 LED ioi Perfore nce Debyo r db 223 AENDE E DIET as EE 12 USB communication oo0000r Za microcomputer expansion pin 9 Buz
35. aetfsofft 1 lx fujitsu_starter_kit sample main c 23 E4110C 152 T 25 KT OETA io Tmr c io prl23 c io prl T c Workspace Start kit Volume abs Volume p specialabs specialpr Sample abs Samp B Source Files _ _ 16 p R monitor16LXasm 8 start905s asm Include Files Dependencies 5 mple Y J Debug LED abs LEDprj Debug il Input abs Inputprj Debi i Buzzer abs Buzzerprj I n timer abs timerpri Deb Interrupt abs Interruptprj sensor abs sensor prj rI le r 10 Include 11 Output 12 13 14 include ffmcl6 h 15 tinclude extern h 16 fuis monitor h 17 18 void main void 19 t 20 set il D 21 EIQ Zx enable interrupt for Accemic X 25 H Click the error code to jump to 27 while 1 x endless loop the line that includes the error gi25 H e d A CAPS Bera ARR 24 us Svar sev Guuseavh Mg 1 jouet bleu igsoFTu Adobe emp 1738 Error indication window 95 Fujitsu FUJITSU Program Execution Method Execute the created program and check that it performs the intended operation After A
36. an 10 C 86 Fujitsu FUJITSU Interrupt occurs by A D conversion end l l l v External interrupt processing starts External interrupt factor is cleared ADCS H bit14 0 Set an input pin of ANI 2 DDRS5 bitl 0 Turns on off LED3 PDRI bit2 PDR1 bit2 8 Stop the A D converter 3 l ADCS H bit15 0 Obtain A D converted value i AD DATA ADCR L byte Initialize the A D converter Set the channel ADER byte 0x02 Set the mode continuous conversion Set output pins of LEDI to LEDS PDR1 byte Ox1F Start of main processing DDR1 byte Ox1F 1 7 E 9 I I i I I i N LED lighting processing PDRI byte Ox1F I Y AD_DATA gt 142 LED lighting processing PDRI byte 0x1E A D conversion started 6 AD DATA gt 113 ADCS H byte9 1 Y I LED lighting processing PDRI byte 0x1C I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I AD _DATA gt 171 ADCS L byte 0x89 Set the sampling conditions ADCR H byte OxF8 4 A D converter interrupt permission ADCS H bytel3 1 5 Infinite loop Y AD_DATA gt 87 N ar LED lighting processing PDR1 byte 0x18 Y AD_DATA gt 66 mE N E LED lighting processing PDRI byte 0x010 LED lighting processing PDRI byte 0x00 km
37. ard then press OK Infor matian 1 x r1 Please switch target to asynchronous Burn In Px1 0 0 0 1 1 2 1 while it iz in reset state When you click OK after pressing the RESET switch on the board downloading starts If the above switch operation is not performed in correct order ACCEMIC MODE will not start If vou fail to perform switch operation correctly resume the operation from the step described in Item 1 1 6 31 FUJITSU ish Performance ebuocer CTS ACCEMIC MDE 0j EU CN Reconfirm that the MODE selector is set to the PROG 1758 a d SENS side ish Perforsence Debuocer ACCERNC MDE Press the RESET switch 9090090000000000 When downloading ends the next information item appears With the next Information dialog box displayed do not click OK immediately but perform necessary switch operations on the board Infor mation When this dialog box is Please switch target to Marmal MadetMD 1 1 1 MD220 while it is in reset state displayed do not click OK immediately but perform switch operations on the board 32 Fujitsu igh Perforsence ebuooer MDE N gon a igh Perforsonce ebuocer ACCERIIC MDE ee Ug ona e Press the RESET switch 5 DICES EIE Infarmatian Please s
38. arious methods to measure temperature One of those methods uses a mercurial thermometer and another one uses a radiation thermometer that enables contactless measurement Table 8 1 Temperature measuring method shows the general methods for measuring temperature Of course it depends on the purposes or requirements however most of the systems containing microcomputers use the thermocouple thermometer or thermistor This Starter Kit also uses the thermistor as its temperature sensor Table 8 1 Temperature measuring method Method and its feature Mercurial alcohol This method uses thermal expansion of mercury or alcohol to detect thermometer temperature This method is used for many thermometers and clinical thermometers Thermocouple This sensor uses the Seebek effect It contains the two contact thermometer circuit using two different metals and when there 15 a difference in temperature between two contact points it generates thermal electromotive force It can measure the wide range temperature Thermistor This sensor uses the resistance thermometer bulb that uses the temperature characteristic of semiconductor It is in heavy usage Radiation The infrared energy emitted by an object varies with temperature thermometer The radiation thermometer uses this principle for measuring temperature It enables contactless measurement 82 Fujitsu FUJITSU The thermistor is the resistor using the temperature characteristic of
39. arter Kit Registration Information This software has already been installed by the following person IF are not licensed to this software you may nat install this software onto your computer TEMP FUJITSU Wise Installation Wizard Cancel Click Next gt 1 72 FUJITSU 8 Accemic Demo for MBB F387 Starter Kit Destination Location Fe Demo for MBBLF387 Starter Kit Select Program Manager Group Accemic 2 Adobe ATLAS 10 0 COView V8 FFFTP FUJITSU FLASH MCU Programmer JT Lhaplus Microsoft Office OAK V8 18 O Fujitsu Fujitsu Ja Accemic MDE Demo for MBODF387 Starter Kit Start Installation You now ready to install amp ceemic MDE Demo For MBSUF387 Starter Kt Press the button to begin the installation ar the Back button to reenter the installation information Wise Installation Wizard Cancel Click Next gt Accemic Demo for MBBLDF387 Starter Kit Installing Current File E Copying file C Program Files 4ccemchMDE 25E S amples bL amp LibsAtosnmd lib All Files Time Remaining minutes 12 seconds Wise Installation The installation is executed 19 FUJITSU 3 Demo for MBSOFS87 Starter Kit Accemic MDE Demo for MBSOF Se Starter Kit has been successfully installed Press the Finish butto
40. as follows 2 MHz 500 count 4 kHz 60 O Fujitsu FUJITSU Table 4 2 Correspondence of counts and pulse frequencies with operating frequency at 2 MHz Count per cycle L level duration Pulse frequency H level duration After the PPG pulse output is started by the program and the buzzer starts sounding the buzzer sound cannot be stopped even when the stop button on the ACCEMIC screen 1s clicked This is because the PPG timer continues operation and pulse output is not stopped even when the CPU stops To stop the buzzer press the stop button and then reset the microcomputer void main void Set il 7 IO PPGC23 bit PEI 0x01 IO PPG23 byte 0x00 1 Enabling PPG pin output 2 PPG count clock setting IO PRL23 byte PRLL3 0xFA IO PRL23 byte PRLH3 0xFA 3 PPG timer count for L level 4 PPG timer count for H level IO PPGC23 bit PEN1 0x01 5 Enabling PPG Program code added while 1 m 4 4 c 6 Infinite loop Figure 4 8 Program to sound the buzzer Descriptions IO XXX byte and IO YYY bit included in the above program code are the convenient formats of description defined in the I O header file For further information see Appendix B 1 O Fujitsu 61 FUJITSU 4 4 3 Changing the tone of a buzzer sound Try to vary the setting of pulse duration to check how the buzzer sound changes Our audible frequencies are said
41. at 2 to 4 O Fujitsu 85 FUJITSU In the flow of the main processing of the program first set up the output pin of the LED and the input pin to be used for the A D converter The settings of the pins are explained in the previous chapter Then make the settings related to the A D converter The settings to be made are about the same as the previous chapter The only difference is that the channel of the A D converter to be used is set to 1 Channel 0 is used in the previous chapter The operation mode of the A D converter is set to the continuous conversion mode that is also used in the previous chapter The operation of the A D converter is as follows accordingly A D converter is activated A D conversion starts A D conversion ends A D conversion starts When the A D conversion ends an interrupt of the A D converter is generated and an interrupt routine is called In the interrupt routine the interrupt factor is cleared the A D value is obtained and the LEDs are lighted according to the obtained A D value The LED lighting processing is as shown in Table 8 4 LED lighting processing Table 8 4 LED lighting processing 0 to 65 BEBE 50 or higher 66 to 86 40 C or higher but lower than 50 C 87 to 112 30 or higher but lower than 40 113 to 141 IE JL 20 C or higher but lower than 30 C 142 to 170 Se 10 C or higher but lower than 20 C 171 to 255 LEE ME I Lower th
42. converted values are obtained 4 Light the LEDs according to the obtained A D converted values Determine the number of LEDs to be lighted 5 Then repeat 2 to 4 First in the program set up the output pin of the LED and the input pin to be used for the A D converter Then make the settings regarding the A D converter operations such as the sampling time of the A D conversion operation mode and A D input channels In this section the sampling time is set to 128 60 the comparing time is set to 176 the resolution is set to 8 bit and the A D conversion channel to be used is set to only and the operation mode is set to the continuous conversion mode indicates the internal operation frequency of the microcomputer Table 7 2 Register settings of A D converter shows the values to be written to the register for the settings Table 7 2 Register settings of A D converter Register bit Setting value contents A D conversion started ADCS H bit 9 1 A D conversion started A D interrupt permission ADCS H bit 13 1 permitted 0 not permitted A D interrupt factor ADCS H bit 14 0 factor cleared cleared A D conversion stopped ADCS H bit 15 A D conversion is forcibly stopped A D conversion end Ch ADCS L bits 0 to 2 0 Select A D conversion start Ch ADCS L bits 3 to 5 0 Select A D conversion mode ADCS L bits 6 to 7 2 Continuous conversion mode setting Comparin
43. cturer Fujitsu Type Cancel Here select Fujitsu for Manufacturer and MB90F387 for Type and then click Next gt If you need to correct settings in the Select Processor dialog box because you made an incorrect Type setting or for other reasons select from the Preferences menu to display the Select Processor dialog box Ww Accemic MDE Dema File Start Wiew Tools Preferences Help ay c M C Communication Processor General 30 Fujitsu Fujitsu setup Processor Package FPT 48P M 26 Hot used 9 Bit data bus Number o Bit data bus Use external clock SCK Ext fred kHz Tolerance a Speed 9600 Bitz s P31 HIGH P30 HIGH Level Lor 9 Download Kernel Help When the target microcomputer is the MB90F387 select FPT 48P M26 for Package and Not used for PLL factor Do not change other parameters from their defaults Note Use either Not used or 1 for the PLL setting Note that the operations are not guaranteed if any other value is entered After the setup press Download Kernel When ACCEMIC MDE is used for the first time it 1s required to download the monitor debugger kernel only once When the following information is displayed reconfirm that the MODE selector is set to the PROG side press the RESET switch on the bo
44. eceeeceeceeeeececeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 27 Board operation without ACCEMIC MDE 38 Lets ity on 40 WY Waa Ws an Tc 40 How can the LED emit light ninin rnin etre terrere nter trae rhe ee 41 How to turn on LED by microcomputer 42 How to create and execute a program to turn on the 44 Outline of program to be ener 45 Creating and executing of program ssessssssssseseseeeeeeener en rnn nne nnn nnns rsen nnns nis 45 How to create and execute a program to make the LED blinking 46 Outline of the program to be created eeeeeeseeesessesseeeeeee nnns 46 Creating and executing of program sssssssssssssesseeeeeeenre nen nennene ener nnne nnns 47 Let s try to control the LED by switch 49 How the microcomputer detects switch operation 49 How to create and execute a program to control LEDs by switch operation 5 Outline of program to be nnns 5 Creating and executing of program sessssssssseseeeeeeeeeennnnr nnn nnrne nnn nnn n ss nns neis 52 Lets try to Sound
45. ed you can see that LED5 goes on on the board _47 FUJITSU void main void IO PDRI byte O0xEF uii 1 LEDS on setting P14 Low P10 to High IO DDRI byte Ox1F lt 2 P10 to P14 output setting 1 0 1 lt 30000 1 3 LEDS on time count IO PDRI byte O0xFF ii 4 LEDS off setting P10 to P14 High for i 0 1 lt 30000 1 m 5 LEDS off time count IO PDRI byte OxEF 6 LEDS on setting P14 Low P10 to P13 High Program to be added Figure 2 11 Program to make LEDS blinking 48 Fujitsu FUJITSU 3 Let s try to control the LED by switch operation This chapter explains how to control LEDs by operating the push switches on the board and how to create a program that controls LEDs based on switch operations 3 1 How the microcomputer detects switch operation The board of the Starter Kit has two switches SWs as shown in Figure 3 1 switches are connected to pins P25 and P27 of the microcomputer The following explains how the microcomputer detects your operation of these switches Figure 3 1 Switches on the Starter Kit board Figure 3 2 shows a conceptual diagram of the connection of SW1 on the board On the board SW1 is connected to pin P25 which is a general I O port of the microcomputer While SWI is released off state the voltage applied to pin P25 of the microcomputer 15 Vcc 5 V which is the high level input When SW1 is pressed on state t
46. eeeeeeeeeeeeeeeeeeeeeeeeees 63 How to detect a switch operation by 64 How to create and execute a program to control the LED by switch Input ODIT dU dosi nox 65 Outline of the program to be created eessesesesesseeee eene 65 Creating and executing of PLO eter tent eie uu E Ee Ru E Op Xe ERE us 67 Let s blink the LED by using a timer 69 YY TA IE NS ARE 69 How to create and execute a program to control the LED blinking by using a ns ee eee 70 Outline of the program to be created eeeeeeeeeeseeesseseeeeeee eres 70 Creation and execution of the program eeeeeseeseseseseseeeeee ens 72 te A D ti dosi use Dun he pui uae E oue 74 Anaon abd DIS cicero E etinm emi oe 74 Outline oT UE 75 Scheme ol volume tab iia 76 How to create and execute a program to display 76 Outline of program fo De 76 Creation and execution of the eene 80 Let s use the temperature enirn 82 What is a temperature senso
47. enerated at pin INT7 when SW2 15 operated Starter Kit board Microcomputer SWI pin P25 GND J Figure 5 2 Connection of SW1 to microcomputer pin conceptual diagram 64 Fujitsu FUJITSU Explained next is the procedure for using pin INTS as an external interrupt pin To use pin INTS for the input of external interrupt you should set the I O direction of the pin to input by using the port 2 register DDR2 Handling of DDR2 was described in Chapter 3 Write 0 to the bit 5 of DDR2 You should also set necessary values in external interrupt registers EIRR ENIR and ELVR for using pin INTS5 as the external interrupt input pin is an 8 bit register that indicates external interrupt factors ENIR is an 8 bit register that enables and disables external interrupts ELVR is a 16 bit register that specifies the conditions for external interrupt detection Assume the processing to detect the SW1 operation from the off state to the on state by using interrupt When SW1 is pressed the signal input to pin INTS changes from the high level to the low level as described before When values are set in external interrupt registers in steps 1 to 4 below the external interrupt function enables the microcomputer to detect the change falling edge of the signal input to pin INTS from the high level to the low level In this way the on operation of SW can be detected as the generation of an interrupt 1 Write
48. eration 5 2 How to detect a switch operation by interrupts As described in Chapter 3 the board of the Starter Kit has two switches that are connected to pins P25 and P27 of the microcomputer Pins P25 and P27 connecting the switches were used as input ports in the program example described in Chapter 3 These pins can be used also as external interrupt input pins INT5 and INT7 The following describes how to detect switch operation pressing of a switch by using an external interrupt input Figure 5 2 shows an outline of SW connection circuit on the board of the Starter Kit SWI is connected to pin INTS of the microcomputer as shown in Figure 5 2 While SWI 15 released in the off state the voltage at pin INT5 of the microcomputer is Vcc 5 V and the signal input to pin INT7 is at high level When SWI is pressed in the on state the voltage at pin INTS becomes the GND level and the signal input to pin IN5 changes from the high level to the low level When SWI is released subsequently the signal input to pin INTS changes from the low level to the high level When the external interrupt function of pin 5 of the microcomputer is used an interrupt can be generated when the pin status is changed short this mechanism enables the microcomputer to be informed of switch operation by the interrupt SW2 can be handled in a similar way to handle SW Because SW2 is connected to pin INT7 of the microcomputer an external interrupt is g
49. ernately each time the direction of current is reversed as shown in Figure 4 3 The cycle of contraction and expansion changes when the frequency of AC voltage is varied This characteristic can be used to vibrate the crystal at various frequencies If the vibrational energy of the crystal 1s large the crystal can generate an aerial vibration which makes a sound Piezoelectric buzzers use this principle Contraction Expansion Figure 4 3 Principle of piezoelectric device 4 2 Microcomputer and piezoelectric buzzer A piezoelectric buzzer uses a piezoelectric device as described above To produce a sound from the piezoelectric buzzer you should apply a changing voltage e g AC or pulse voltage to the buzzer Here let s sound a piezoelectric buzzer by using a pulse wave pulse voltage output from the microcomputer Pulse input Vibration Figure 4 4 Buzzer using a piezoelectric device 56 Fujitsu 4 3 FUJITSU 4 2 1 Self excited and separately excited vibrations Buzzers are classified into two types type called a self excited buzzer generates only one sound by the self resonance of the crystal when a voltage is applied The other type called a separately excited buzzer generates different kinds of sound according to the frequency of applied voltage The self excited buzzer can generate only one kind of buzzer sound based on the self resonant frequency of the crystal The separately excited buzzer ca
50. etain microcomputer operation status Writing data to and reading data from registers enables you to control the CPU and peripheral functions of the microcomputer Here the term peripheral functions means the functions of the I O ports timers and A D converter incorporated in the microcomputer For input setting this register is used to check the input level of each pin value read from the bit corresponding to each PDRI register IO PDRI byte PinnameP17P16P15 P14P13 P12 P11 P10 pin 0 low level input or 1 high level input For output setting this register is used to set the output level of each pin value written to the bit corresponding to each pin 0 low level output or 1 high level output bit 7 6 5 4 3 2 0 DDRII register BEBNNENNNEN This register is used to specify whether each port pin is IO DDRI byte used for input or output value written to the bit Pin name P17 P16 P15 P14P13 P12 P11 P10 corresponding to each pin 0 input or 1 output Example of P10 setting po Input setting DDRI bit0 0 Output setting DDR1 bitO 1 1 bit0 When 0 is read gt Low level input When 0 is written gt Low level output When 1 is read High level input When 1 is written gt High level output Figure 2 6 Explanation of registers to control the output from P10 to P14 Fujitsu 43 FUJITSU The internal switch of microcomputer as shown in Figure 2 5 actually consists of a p cha
51. from pin P10 is at the high level Therefore no current flows through the LED and the LED is off In the case of b in Figure 2 5 the signal output from pin P10 is at the low level Therefore a current flows through the LED and the LED goes on The switch in the microcomputer can be operated by a program that controls the microcomputer EE EE dei T5V D l LED iJ SS a s n3 Taka LEDS V SML 21 BMT Green SS R12 2d Tk e SML 218MT Green a mMEMENEM gU 1 1 9 LED3 SML 218VT RED e SS R10 tka lL epg SML 210MT Green ENS Rg gt S ko c 1 O OT 3 C3 9 1zF 1BpF LED1 XA SML 21BMT Green Figure 2 4 Actual circuit diagram 42 O Fujitsu a LED is off Figure 2 5 Example of circuit to turn on off an LED with a conceptual diagram of the internal circuit of microcomputer The output settings of pins 10 to P14 are controlled by using the internal registers of the microcomputer The pins P10 to P14 are controlled by the PDR1 DDRI registers as shown in Figure 2 6 To use a port for output write the value 0 low or 1 high to be output to PDRI register bit corresponding to the pin and 1 to DDRI register bit corresponding to the pin Registers are the memory areas to control microcomputer operation and r
52. function version See Item 1 1 2 Installing the demonstration version of ACCEMIC MDE See Item 1 1 3 Connecting the evaluation board to the personal computer See Item 1 1 4 Starting and setting up SOFTUNE See Item 1 1 5 Starting and setting up ACCEMIC MDS See Item 1 1 6 Terminating ACCEMIC MDE See Item 1 1 7 Terminating SOFTUNE See Item 1 1 8 C 6 6 amp O9 8 O Fujitsu co FUJITSU 1 1 1 Installing of USB driver Install the USB driver according to the content of the USB Driver Installation Manual O Fujitsu 9 FUJITSU 1 1 2 Installing of integrated development environment SOFTUNE limited function version Install SOFTUNE limited function version The limited function version of SOFTUNE is subject to the limitation on the program size that can be debugged to 32 kilobytes The limited function version cannot be used to create a program over 32 kB D Insert the CD ROM into the CD ROM drive When using the download version download the software for F7MC 16LX Starter Kit Jouet Bleu and open the folder where the files are decompressed 2 Double click on the Setup exe icon in the YXYjouet bleu SOFTUNE folder to start installation 3 Follow the instructions on the screen to perform installation F2MC 16 Family SOFTUNE Professional Pack Evaluation Version Setup IN Always refer to the INSTALLATION MANUAL Release Note before installing this produc
53. g time selection ADCR bits 11 to 12 3 176 Sampling time selection ADCR H bits 13 to 14 3 128 A D resolution selection ADCR H bit 15 1 8 bit resolution Analog input permission ADER bits 0 to 7 Olh Input permitted from only 77 FUJITSU The sampling time includes the time for loading the A D input voltage after the A D conversion starts The comparing time is the time to perform comparison operations of the sampled A D voltage and the standard voltage of the A D converter and to convert it to a digital value After that permit interruptions of A D converter settings of the A D converter mode of the A D converter is set to the continuous conversion mode Start the A D conversion the A D converter is as follows accordingly This is the end of the operation In this program the operation The operation of A D converter is activated A D conversion starts A D conversion ends A D conversion starts The operation repeats as shown above the A D converter is generated and an interrupt routine is called When the A D conversion ends an interrupt of In the interrupt routine the interrupt factor is cleared the A D value is obtained and the LEDs are lighted according to the obtained A D value which is the volume size The correspondence between the volume size and the number of LEDs lighted is as shown in Table 7 3 LED lighting according t
54. gYA BSYapecial abs No error was found 7 Confirm that error was found 26 Fujitsu FUJITSU If an error is detected as shown below in the build operation perform the software installation again from the initial step as described in Item 1 1 2 reinstalling the software be sure not to change the installation directory that is displayed on the screen Build operation started start905s asm monitor16LX asm _FFMC16 C D Yjouet bleuXFujitsu start kitYspecialY ffmcl6 c 9 E4038P include File ffmcl6 h is not found main c D YXjouet bleuYFujitsu start kitYspecialYmain c 17 E4038P include File ffmc16 h is not found monitorl6LX asm Error was found 7 Example of error detection Fujitsu 207 FUJITSU Subsequently ACCEMIC MDE starts automatically Input the COM port number that is confirmed after the USB driver is installed setup Serial Part If you need to correct settings in the Select Processor dialog box because you made an incorrect Type setting or for other reasons select Communication from the Preferences menu to display the Select Processor dialog box wa Accemic File Start View Tools Freferences Help oe m F G Gorm munication 4 4 4 Fraceszar General If the COM port number is unknown use the following procedure to check the COM port number to which the board is connected Procedure for checki
55. gram code interrupt routine Use all files except main c without any changes After the program is input build the program according to the procedure described in Appendix A 2 If an error is output reconfirm that the program accords to the contents of Figure 6 4 Example of program code main routine and Figure 6 5 Example of program code interrupt routine When the build is succeeded ACCEMIC MDE starts automatically When the ACCEMIC MDE window appears execute the program and check the operation For the procedure of the program execution see Appendix A 3 When the program starts correctly check LEDS Blinking LEDS indicates the normal operation 2 O Fujitsu Fujitsu void main void IO PDRI byte OxEF IO DDRI byte Ox1F Set 1 7 _ FIQ IO ICRO03 byte 0x06 IO TMR 0 0xF424 IO TMCSRO bit CSL 2 IO TMCSRO bit RELD 1 IO TMCSRO bit INTE 1 IO TMCSRO bit CNTE 1 IO TMCSRO bit TRG 1 while 1 Program code to be added FUJITSU lt 1 LED5 on setting P14 Low lt 2 P10 to P14 output setting Sj 3 CPU interrupt level setting 4 Interrupt permission ui 5 Timer interrupt level setting lt 6 Timer count value setting lt 7 Timer count clock setting um 8 Timer count repeat setting lt 9 Timer interrupt permission 10 Timer operation permission wait for a start factor 11 Software start factor of timer starts operation m 12 Infinite loo
56. he input to pin P25 becomes the low level because the voltage at pin P25 becomes GND Thus the input status at pin P25 of the microcomputer changes depending on the state of SW1 The same mechanism applies to SW2 except that SW2 is connected to pin P27 which is a general I O port of the microcomputer Therefore the input status at pin P27 changes when SW2 is operated MWhen SW1 is off MWhen SWI is on Figure 3 2 Connection of SW to microcomputer pin conceptual diagram Fujitsu 49 FUJITSU The change of pin status can be detected by a program running on the microcomputer The microcomputer of the Starter Kit can determine the status of pins P25 and P27 from the corresponding values in an I O port register PDR2 Register values can be read using instructions of a microcomputer program In other words the microcomputer can determine the operation state of a switch by reading the corresponding value from PDR2 by the program Let us explain some specifications of PDR2 PDR2 is the 8 bit register that indicates the status of port 2 pins P20 to P27 Figure 3 3 shows the association of the pins at port 2 with the bits of PDR2 When a pin is at the high level the corresponding bit is 1 when the pin is at the low level the bit is 0 Therefore the status of pin P25 or the operation state of SW1 can be known when the value of the bit 5 of PDR2 15 read Similarly the operation state of SW2 can be known when the bit 7 of PDR2 is read
57. hift direction Left shift Right shift 9 Left shift Right shift SW2 normal The shift speed is changed press Shift speed 1 second 90 5 seconds 90 25 0 125 seconds SW1 long press It controls on and off of the buzzer Volume It can adjust the volume of the buzzer while buzzer sounds adjustment ITI cr iL off SW1 SW2 Volume O Fujitsu 35 FUJITSU Stop the program as follows Select Stop from the Start menu to stop the sample program MDE Demo 90490 File Start View Toole Preferences Help Disconnect fis ae 4 software Reset F5 EL t Restart AD Mj Stop ADC Gf Step Over ADEF Ci Step Into Reset the program as follows Select Restart from the Start menu The program 1s reset amp Accemic MBE Demo L5 File Start View Toole Preferences Help Software Reset Globals T k Disconnect ADC g atep Over ADEP Bj Step hto Fi Br Return from Gall FG Assembler Stepping 36 O Fujitsu FUJITSU 1 1 7 Terminating of ACCEMIC MDE To terminate ACCEMIC MDE select Exit from the File menu Demo Relf File Start Wem Toole Pre O Load File Gb Reload The ACCEMIC MDE window closes 1 1 8 Terminating of SOFTUNE After terminating ACCEMIC MDE terminate SOFTUNE as follows Select Exit from the File menu t
58. id eost epe 54 TIE VICES used 54 O Fujitsu 4 1 1 4 1 2 4 1 3 4 2 4 2 1 4 2 2 4 3 4 3 1 4 3 2 4 4 4 4 1 4 4 2 4 4 3 5 9 2 5 3 Jl pod 6 1 6 2 6 2 1 6 2 2 Tal 7 1 1 2 TN 7 2 1 122 8 1 8 2 Fujitsu FUJITSU Crystalline characteristics of piezoelectric 1 55 Piezoelectric characteristics eese nennen nnns 55 Principle of piezoelectric CEVICE i 25c0iceiccdececdccdecastacceceadenccdestacceceateacstestacceseateoats 56 Microcomputer and piezoelectric DUZZet 56 Self excited and separately excited vibrations sssseeee 57 Pulse wave generated by the microcomputer 57 How to sound the buzzer by PPG ssssssssseeenneeeeneeeneenneeen enne 57 Setting of L level and H level duration aieo eiae tede aces 58 OCR 58 How to create and execute a program to sound the 58 Outline of the program to be created eeeeeesesesesesseeee enne 59 Creating and executing Of PLO STAM 60 Changing the tone of a buzzer sound eeeeeeseseseeseeseseeeeee een 62 Let s try to control the LED by 63 What is an interrupt cc ccccccccccccccceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
59. lationship between the measured temperature of Starter Kit and A D input voltage Temperature A D input voltage Temperature A D input voltage VanilV Vanil V 8 3 How to create and execute a program to display temperature The following section explains how to create a program to detect temperature by using the sensor For how to use the A D converter apply the contents of the previous chapter For checking the detected temperature visually the lighting of the AD input LED 1s controlled 8 3 1 Outline of the program to be created Let us now create the actual program The contents of the program are to use the A D converter to obtain the temperature information of the sensor and to control the lighting of the LED to change the lighting pattern according to the obtained value For processing related to the A D converter create the program based on the program of the volume control A D converter that is created in the previous chapter The main operation of the program is described below The flow of the program is shown in Figure 8 3 Flow of the program 1 After the program is started performs the initialization such as initial settings of the A D converter 2 Starts A D conversion to obtain the sensor information using the A D converter 3 The A D conversion is completed The A D converted values are obtained 4 According to the obtained A D converted values controls the LED lighting 5 Then repe
60. lse duration Set L level duration count Set H level duration count Start operation Enable PPG operation Infinite loop 6 Figure 4 7 Flow of program to sound the buzzer The following describes the detailed method of PPG setting Let s try to make the settings of L level duration H level duration and PPG count clock as described in Items 4 3 1 and 4 3 2 To make these settings write values to the registers dedicated to PPG setting in the microcomputer Writing a value to a register is a programmed operation in by which the value is set in the register according to an instruction Here try to make settings for the output of a 4 kHz pulse wave as an example To make the setting easier specify an equal count for L level and H level duration and specify the PPG count clock same as the internal CPU operating frequency The CPU operating frequency is 2 MHz Therefore the counts of L level and H level duration should be 250 as shown in Table 4 1 In addition to the above pulse information you should make settings to enable PPG pin output and PPG operation Table 4 1 shows all the necessary register settings O Fujitsu 59 FUJITSU Table 4 1 Register settings Register for setting bit Value to be set meaning of Setting item Registername O O O setting L level duration OxFA Count 250 PRLL bits O to 7 PPG reload register L PRLH bits 0 to 7 OxFA H level du
61. m see Appendix B 1 While the program is executed you can see that LEDS goes on on the board 45 FUJITSU void main void IO PDRI byte OxEF LEDS on setting P14 Low P10 to P13 High IO_DDR1 byte 0x1F lt 2 P10 to P14 output setting while 1 3 Infinite loop Program to be added Figure 2 9 Program to turn on the LED Descriptions IO XXX byte and IO YYY bit included in the above program code are the convenient formats of description defined in the I O header file For further information see Appendix B 1 2 5 How to create and execute a program to make the LED blinking This section explains how to create a program that makes the LED be blinking 2 5 Outline of the program to be created Here you will create a program that switches the output from pin 14 of the microcomputer between the low and high levels repeatedly to make LEDS turn on and off repeatedly While 0 and 1 are written alternately to the bit 4 of the PDRI register LEDS is blinking as shown below On 8 m gt LEDS is on LEDI to LED4 are off LEDS is off LED1 to LED4 are off Figure 2 10 shows flow of program The only difference of this program from the LED lighting program shown in Figure 2 8 is that this program has additional steps of LED off and LED on off time count processing The LED on off time count processing is described by the for statement as shown below to enable you
62. n Figure 4 6 Cycle of pulse and L level and H level duration To output a pulse wave based on the PPG timer you should set the duration of L level and H level signals as the counts by the PPG timer For example when you specify 300 as the count of L level duration and 500 as the count of H level duration the PPG outputs the L level signal while the PPG timer counts 300 and the H level signal while the PPG timer counts 500 alternately from the PPG output pin The counting by the PPG timer is called PPG counting 4 3 2 PPG count clock To output a pulse wave based on the PPG timer you should also set the speed of PPG counting The PPG count per second that 15 the frequency of PPG counting is called the PPG count clock The PPG count clock is set on the basis of the CPU clock internal operating frequency of the microcomputer In details the PPG count clock is set to the divide by 1 divide by 2 divide by 4 divide by 8 or divide by 16 whole one half one quarter frequency of the CPU clock When the PPG count clock is set the cycle of pulse set in Item 4 3 1 1s determined 4 4 How to create and execute a program to sound the buzzer Here let s create a program to actually control the operation of the PPG timer in the microcomputer and sound the buzzer 58 Fujitsu FUJITSU 4 4 1 Outline of the program to be created START Perform initial setting Enable PPG output pin Set PPG count clock Set pu
63. n generate the buzzer sound that varies depending on the frequency of applied voltage Therefore the separately excited buzzer enables to vary the sound in a wide range of frequencies The board of the Starter Kit has a built in buzzer the KBS 13BB 4P 2 made by Kyocera Corporation Since this buzzer is of separately excited type it can be used to produce various tone colors of sound in principle buzzer Figure 4 5 buzzer 4 2 2 Pulse wave generated by the microcomputer The microcomputer can output a pulse wave in several ways The basic method to output a pulse wave is to use a built in timer and the setting of H level and L level widths The microcomputer has different built in timers that can be used for different purposes Here use the programmable pulse generator PPG timer which is convenient for pulse output to output a simple pulse wave for sounding the buzzer How to sound the buzzer by PPG The programmable pulse generator PPG enables you to obtain the output of various widths of pulse from the microcomputer through programming You can basically output a pulse wave from the microcomputer when you make the following settings on the PPG timer Fujitsu Setting of L level and H level duration Setting of PPG count clock 57 FUJITSU The following sections sequentially explain how to use the PPG timer 4 3 1 Setting of L level and H level duration nma meme L level duration H level duratio
64. n to exit this installation Lancel When the installation is completed click Finish gt Installation of the demonstration version of ACCEMIC MDE is completed Proceed to the setup of the evaluation board and its connection to the personal computer 20 Fujitsu FUJITSU 1 1 4 Setting up of evaluation board and connecting of board to the personal computer After the installation of SOFTUNE and ACCEMIC MDE perform switch setting on the evaluation board and connect the board to the personal computer On the evaluation board set the MODE selector to PROG Set the MODE selector to PROG PROG Flash memory serial write mode Used to write a program to the microcomputer single chip mode gt Used to actually run the program written to the microcomputer Confirm that the MODE selector 15 set to PROG Next perform the cable connection Fujitsu 21 FUJITSU Connect the USB port of the evaluation board to a USB port of the personal computer using the accessory USB cable Do not connect the USB cable via a USB hub but connect it directly between the board and personal computer Connect the USB cable to a USB port of the personal computer For the location of USB port refer to the manual for the personal computer After installing SOFTUNE and ACCEMIC MDE connect the board and personal computer using the USB cable USB port The power of the evaluation board is sup
65. nclude path special pr C Program Files AccemicMDE2 sk 5ampls 16L44 il Sampleprj Delete the specified gt Option FE 1 CXSoftuneslibau7 includexsamplex MBOUS385 I OC3XProgram Cancel Apply 98 Fujitsu FUJITSU Setup Praject X Target of setting General Mol Compiler Assembler Linker Librarian Cc gt Debue El Category Include Path Common Option gt LED prj Input prj dicet Click this button to HE volume prj SAB timerpri selecta arbitrary H E eenznor pr Samplepri directory Option at model SMALL OK Gancel Apply Browse for Folder i 7 x Please Select Folder 2 8 zw 3 Floppy amp amp E Local disk 0 zl cros Select a folder Setup Praject E Target of setting General MCU Compiler Assembler Linker Librarian Gc gt Debug El Category Include Path Gammon Option H LED prj Click the Add button to H E Inputpri add the selected include Buzzer prj Include Path Mg volume prj am Files 4ccemichMD rSamples 16L3ommaninc udel H timerprj a sensor pri Ce 5ottune ib 90 A inc lude samples MBSU0385 path E CX Program Files 2 25 H Sampleprj After setting click the OK button 4 Option RE
66. nction is executed when an interrupt of the A D converter is generated In this sample project however it has already been registered so it can be used without registration In the above code there are expressions such as XXX byte or IO YYY bit These are the useful description formats which are defined in the IO header file For more information see the Appendix O Fujitsu 69 FUJITSU A Appendix Program Creation Procedure A Program Creation Procedure This appendix explains the procedure you should follow when creating an actual program First start up SOFTUNE as instructed in Item 1 1 5 Starting and setting up of SOFTUNE pages 15 to 17 and open the Start kit wsp file Use the sample project provided for easy creation of software To use the sample project select Sample prj in the list right click to open a submenu and select Set active project from the submenu Then the string including Sample prj 15 displayed in boldface in the list and debugging of the sample project is enabled ge SOPTUNE Workbench Start kit File Edit View Project Debug Setup Window Help Workspace Start kit LED abs LED pri Debug H Inputabs Inputpri Debug H Buzzer abs Buzzerpri Debug m Volumeabs Valumepri Debug H timer abs timerpri Debug Il Interruptabs Interruptprji Debug H E specialabs specialpri Debug H senzorabs T En
67. ng the COM port number First click the right side of a mouse on the My Computer and click on Property R My Computer Open Explore Search Network Drive Disconnect Network Drive Create Shortcut Rename Properties 28 Fujitsu FUJITSU When the Property window of the system appears click Hardware and then click Device manager D System Properties E 2 xl General Network Identification Hardware User Profiles Advanced Hardware wizard The Hardware wizard helps you install uninstall repair unplug eject and configure your hardware Hardware Wizard Device Manager The Device Manager lists all the hardware devices installed on your computer Use the Device Manager to change the properties of any device Driver Signing Hardware Profiles Se Hardware profiles provide a way for you to set up and store eal different hardware configurations Hardware Profiles OF Cancel Apply When the Device manager window appears check the indication of INTERFACE USB to RS232C Converter Virtual COM Port COMXx under the Port COM and LPT The COMx part indicates the COM port number LT vice Manager E ction View Disk drives H Display adapters S DVD CD ROM drives AS Floppy disk controllers H E Floppy disk drives H IDE ATAJATAPI controllers 1 88 keyboards H Mice and other poin
68. nnel type transistor and an n channel type transistor as shown in Figure 2 7 The pin outputs a low level signal when the n channel type transistor is in the on state the pin outputs a high level signal when the p channel type transistor is in the on state You can switch the output level of each port by setting the relevant value in the PDRI register of the microcomputer In the example shown in Figure 2 7 0 is written to the bit 0 of PDRIto set pin P10 for low level output and 1 is written to the bit 1 of PDRI to set pin P11 for high level output With these settings LEDO 15 turned on and is turned off Figure 2 7 LED on off control by rewriting the register with a conceptual diagram of the internal circuit of microcomputer On the board the LEDs are connected to pins P10 to P14 Therefore the five pins are set to the output mode for controlling the LEDs When the microcomputer is reset all bits of DDR are reset to 0 initial value which means the ports are set to the input mode In this status to use a pin as an output port be sure to write 1 to the bit corresponding to the pin 2 4 How to create and execute a program to turn on the LED This section explain how to create a program that actually controls a microcomputer pin to turn on an LED 44 Fujitsu Fujitsu FUJITSU 2 4 1 Outline of program to be created Here you will create a program that outputs a low level signal from pin P14
69. nt LED off time coun LED on time _ y gt My CPU processin ON OFF switching N OFF mE em switching Figure 6 1 LED blinking processing without using the timer interrupt When a timer is used the timer can take the processing of counting the LED on and off time that 1s described in Figure 6 1 so that the CPU does not have to count the LED on and off time The CPU can perform processing other than the LED blinking control accordingly O Fujitsu 69 FUJITSU Figure 6 2 shows the LED blinking processing with using the timer LED off i l Count not required Count not Count not ON OFF switching ION OFF switching ON OFF switching Interrupt processing Interrupt CPU processin Cleared by Cleared by software I Timer interrupt factor oftware Ee L xm qq REL ER Count clock cycle Figure 6 2 LED blinking processing with using the timer To use the timer to count the LED on and off time the count clock and the number of the counts need to be specified The LED on and off time can be calculated by using the following expression Using the timer as just described has the advantage of enabling the accurate time count LED on and off time period count clock cycle x number of counts 6 2 How to create and execute a program to control the LED blinking by using a timer interrup
70. o terminate SOFTUNE gs 9OFIUNE Workbench Start Eile Edt Miew Project Debug Set Mew Open Ctrl 0 Close Open Workspace al Close Workspace 2 II Deve 5 Seve S 2 cave All Recent Text File Recent Workspace File 4 The SOFTUNE window closes Described above are the basic operation procedures using sample programs to start debugging O Fujitsu 3 FUJITSU 1 1 9 Board operation without ACCEMIC MDE This Starter Kit can operate the generated program on the board without using ACCEMIC MDE The procedure is described below First start the program to be operated on ACCEMIC MDE The procedure for operation is described in Item 1 1 6 Confirm that the program runs on ACCEMIC MDE normally Then stop the program and select Automatic Start under Tools in the menu Then the following window appears bx Demo special ebs File Start Toole Preferences Help on e F Erase Flash Automatic Star start3 bs asm ext int kenel Autaqarzatn SEER Test Accesa Authorization dmy 06 10 Ron User Function waged int LED Target Information Current 4pplicatio Source file c kongausmae saft blssfujksu starter kityspectalydebug startaddress Automatic start after reset Date of creation 2005 06 15 15 55 44 access authorization It starts erasing
71. o volume Table 7 3 LED lighting according to volume level Applied voltage 0 to 0 83 V 0 83 to 1 67 V 1 67 to 2 50 V 2 50 to 3 33 V 3 33 to 4 17 V 4 17 to 5 00 V Obtained A D value 78 LED lighting No LED is on SLE TL TL LEDI is on BELLL LEDs 1 to 2 are on SENI I LEDs 1 to 3 are on SENI I LEDs 1 to 4 are on All LEDs are on O Fujitsu FUJITSU Interrupt occurs by A D conversion end Set output pins of LEDI to LEDS PDR1 byte Ox1F l Start of main processing l v External interrupt processing starts External interrupt factor is cleared ADCS H bit14 0 Set an input pin of ANI 2 DDRS5 bitl 0 2 Turns on off LED3 1 610 PDR1 bit2 8 Stop A D converter 3 ADCS H bit15 0 Obtain A D value i AD DATA ADCR L byte Initialize the A D converter Set the channel ADER byte 0x01 Set the mode continuous conversion DDR1 byte Ox1F 1 7 E 9 I I i I I i N LED lighting processing PDRI byte Ox1F I Y AD_DATA lt 84 d N LED lighting processing PDRI byte Ox1E A D conversion started 6 AD DATA lt 126 ADCS H byte9 1 Y I LED lighting processing PDRI byte 0 1 i I I I I I I I I I I I I I I I I I I I I I I I I I I I I I I AD DATA 42 ADCS L byte 0x80 Set the sampling conditions ADCR H byte OxF8
72. ocomputers do and how they are used can easily learn about microcomputers The Starter Kit includes a flash microcomputer and application development tools in order to enable a user with some knowledge of C language to modify sample programs and make the microcomputer actually perform various operations This User s Manual gives detailed descriptions of how to control LED operations and buzzer sounds using the microcomputer Even users with no knowledge about programming languages will be able to comfortably learn in an enjoyable way about microcomputers provided they have an introductory reference book on the C language handy This User s Manual has been established incorporating various recommendations of employees who had only been engaged in microcomputer related work for one to three years and had had only little prior knowledge of microcomputers to begin with Therefore this User s Manual has been written specifically for questions that beginners of microcomputers usually have The Starter Kit can be effectively used as a tool for training about electronic circuits or as introductory education for embedded software developers in classes at universities technical colleges and industrial high schools as well as in new employee education programs at corporations Fujitsu 1 FUJITSU Setting Up of Starter Kit Before setting up the Starter Kit make sure that all the components and equipment listed in Table 1 1 are ready for use
73. of the microcomputer to turn on LEDS Figure 2 8 shows the flow of the program In the flow a value is set in register first and then output setting is made using the DDR1 register For port output be sure to set the output level in the PDRI register before the output setting using the DDR1 register The setting operation should be performed in this order because the initial value that is applied after the microcomputer 15 reset is not defined for register to set the output level START Set LEDS to on Set P14 output level to low PDR1 bit4 0 1 Set P14 to output mode DDRI bit4 1 2 Infinite loop Figure 2 8 Flow of the program to turn on the LED 2 4 0 Creating and executing of program Let us now create the actual program According to the procedure described in Appendix open the source file main c stored in sample prj and input the program portion enclosed by dotted line in Figure 2 9 Use the files other than main c without modification After the input of the program build the program according to the procedure described in Appendix A 2 If an error message is output check that the content of the input program is exactly the same as the description shown in Figure 2 9 When the build operation ends successfully ACCEMIC MDE starts automatically After the ACCEMIC MDE window appears execute the program and check its operation For how to execute the progra
74. oid Program code to be added Set il 7 EI IO PDRI byte Ox1F lt 1 Port 1 LED control output setting IO DDRI byte Ox1F IO DDR5 bit D51 0 2 Port 5 AD input input setting IO ICRO3 byte 0x06 IO ADCSH bit BUSY 0 lt 3 Stop A D converter IO ADER byte 0x02 4 A D converter initialization IO ADCSL byte 0x89 IO ADCRLH byte ADCRH OxF8 A D converter channel setting A D converter mode setting A D sampling condition setting ADCSHLbit INTE 1 5 A D conversion O ADCSH bit STRT 1 interrupt permission 6 A D conversion starts Figure 8 4 Example of program code main routine 88 Fujitsu FUJITSU interrupt void ADC int void Program code to be added unsigned char AD DATA IO ADCSH bit INT 0 7 Clearing interrupt factor AD DATA IO ADCRLH DATAS EB Obtain A D converted value if AD DATA gt 171 9 LED control based on AD value IO PDRI byte 0x1F j else DATA gt 142 IO PDRI byte Ox1E else if AD DATA gt 113 IO PDRI byte 0 1 else if AD gt 87 IO PDRI byte 0x18 else if AD_ DATA gt 66 IO PDRI byte 0x10 Figure 8 5 Example of program code interrupt routine The ADC int function is to be executed when an interrupt of the A D converter is generated It is normally required to register the interrupt routine on the vector table so that the ADC int fu
75. or the registers of the microcomputer built in the Starter Kit O Fujitsu 97 FUJITSU C Appendix Method To Change the Include Path 1 About the Method To Change the Include Path A necessary include path is specified for each sample program A sample program requires the specified include path to reference sample I O register files If the installation folder of SOFTUNE or ACCEMIC MDE 1s changed change the include path settings of the C compiler and the assembler before using the sample program Workbench Start kit Project Debug Setup Window Help Active Project Add Project Add Member Setup Workspace Setup Project Customize Build Project Dependencies Configuration Include Dependencies 8 S SEI ES Shift F8 Build Ctrl F8 EStG ZIPC EasyCODE Select Project setting J under Project P Change the include path settings of the C compiler and the assembler as shown below The following window shows the include path setting of the C compiler Select this tab for setting Setup Project Target of setting General the include path of the C Debue z Category Include Path 20 gt LEDpri il Inputpri M Buzzer prj Include Path volumeprj GXSoftunex ibat inc udesa mple M BS0385 il timer prj A Interrupt prj Include Path List Add Delete A sensorn i
76. or h 0 0263 6 580001 CLRB 0100H 0 A monitort 6LX asm 00FF0267 32F9 MOV HF9H ppg 01 int c DO0FF0269 759FO0001 AND 0100H ppg on off c D FF026D 6C5BODO1 CLRB 0100H 3 ppg timer initial c DO FF0271 54011E MOV 01 1 reload timer initial c 00FF0274 54111F MOV IO 11H 1FH reload timer int c 00 0277 644902 CALL 0249H 8 start805s asm OOFFO27A 64D202 CALL O2D2H DO FF027D 64F302 CALL O2F3H State Breaked INT Level Disable A2 eu BaP CuNYZiYN start kit ma 73 Adobe Accemic Qa AEB 2052 The ACCEMIC MDE window opens Execute the program of the sample project special pr Select Run under Start The LEDs 1 to 5 on the board are shifted leftward respectively at one second interval 2 Demo MBBU48lLabs File Start View Toole Preferences Help gg Disconnect Bu an jlobals EL Software Reset F5 i C Restart F10 oc 0 e ADE d Step Over F8 Step hto Fi ARSE 6 Return trom Gall FG the LEDs evaluation board leftward respectively It also has the functions listed in Table 1 4 one second interval 34 Fujitsu When the program is executed to 5 on the FUJITSU Table 1 4 Board operations at the special prj execution Switch control Board operation SWI normal The LED shift direction 1s changed press S
77. p Figure 6 4 Example of program code main routine interrupt void reload int void Program code to be added 1 12 Clearing interrupt factor 8 13 LED on off switching Figure 6 5 Example of program code interrupt routine The reload int function in Figure 6 5 Example of program code interrupt routine is to be executed when an interrupt of the 16 bit reload timer is generated It is normally required to register the interrupt routine on the vector table so that the reload int function is executed when an interrupt of the 16 bit reload timer is generated In this sample project however it has already been registered so it can be used without registration In the above code there are some expressions such as IO XXX byte and Y YY bit These are the useful description formats which are defined in the IO header file more information see the Appendix 73 For FUJITSU 7 Let s use the A D converter This section describes the processing to convert the analog signals input to the microcomputer into the digital signals by using the A D converter and to load the digital signals into the microcomputer This Starter Kit can control the value of the voltage applied to the analog pin for the A D converter by using the volume tab mounted on the board Let s input the analog signal to the microcomputer by using this tab The input analog signal can be converted into the digital signal
78. peration state is detected The program applies the method of turning on the LED described in the previous chapter 3 2 1 Outline of program to be created The operation of the program to be created is as described below Figure 3 4 is the flow of the program that performs the operation 1 When SW1 is pressed is turned on 2 While SW1 is in the on state LED1 is kept lighting 3 When SW1 is released set to off LED 1 is turned off 4 Similarly LED2 is turned on and off according to the SW2 state START Set output pins for LED1 and LED2 PDRI bit0 1 PDRI bitl 1 3 PDR2 bit5 1 SWI input state Set LED2 to off PDR1 bit1 1 Figure 3 4 Flow of program O Fujitsu 51 FUJITSU This program first sets the output pins for the LEDs and then sets the input pins for the switches The necessity of these settings was explained in the previous section The program subsequently reads the value of the bit 5 of PDR2 to detect the state of SWI The program turns on or off LEDI according to the read value To turn on and off the program writes 0 or 1 respectively to the bit 0 of PDR1 Also for SW2 the program performs the similar processing and controls LED2 3 2 2 Creating and executing of program Let us now create the actual program According to the procedure described in Appendix open the source file main c stored in sample prj and input the program portion enclosed by
79. pins of MB90F387 microcomputer Table 1 3 Function assignments to the pins of F MC 16LX Series MB90F387 Microcomputer 3 P50 ANO VR ANALOG _ Division of power supply voltage 0 17 P25 INT5 SWI Negative L level when the switch is pressed BN a a 19 W2 P27 INT7 Negative L level when the switch is pressed 20 MD2 MODE 21 MDI PULL UP 2 RST RESET Negative On when the output is L level e rm No 2 1S 2 NO O3 P10 INO LEDI Negative On when the output is L level logic P11I INI P12 IN2 LED3 P13 IN3 LED4 P14 IN4 LEDS 6 P17 PPG3 BUZZER RS232C RS232C PULL DOWN 50 PULL DOWN 50 LED2 Negative On when the output is L level logic Negative On when the output is L level logic eS Negative On when the output is L level logic Negative On when the output is L level Rectangular Initially at L level C coupling bias 37 39 42 3 4 Fujitsu FUJITSU 1 1 Setting Up of Personal Computer This section describes how to install the software required to operate the Starter Kit on the personal computer Be sure to perform the software installation operation before connecting the board to the personal computer Take the following steps to set up the personal computer D Installing the USB driver See the separately provided USB Driver Installation Manual Installing the integrated development environment SOFTUNE limited
80. planation of the timer The word timer is often heard in daily life such as a recording timer of VCR a start timer or sleep timer of the audio system a kitchen timer for cooking or the timer function of an alarm clock The function of the timer contained in the microcomputer is the same as those timers Let s take the alarm clock timer as an example to explain the timer function Most of the people set the alarm clock timer for a certain time and wake up at the sound of the alarm every morning What would happen if there was no alarm timer function People would be bothered about the time to wake up once the dawn breaks and could not keep relaxing and sleeping People can re realize that the timer function of the alarm clock allows us to sleep tight until the time to get up The microcomputer has the timer interrupt function that performs as an alarm timer function In this case the timer interrupt is used for the LED on time count and the LED off time count Because the LED blinking control described in Item 2 5 in Chapter2 counts the LED on time and LED off time by executing the CPU instruction the CPU is always required to perform the processing for controlling the LED blinking Figure 6 1 LED blinking processing without using the timer interrupt shows the LED blinking processing without using the timer interrupt This figure shows that the CPU must always control the LED and there is no time for other processing LED on LED on time cou
81. plied from the USB power supply USB bus power Figure 1 4 Connection of the evaluation board and personal computer 202 Fujitsu FUJITSU 1 1 5 Starting and setting up of SOFTUNE Before the operation described below copy the sample programs to the hard disk of the personal computer Uncompress the Fujitsu starter kit zip file included in the CD ROM or among the downloaded files in an arbitrary directory Start SOFTUNE limited function version From the Start menu of Windows select Programs P and Softune V3 in this order and then click on FFMC 16 Family Softune Workbench trial version to start EN S 8 nes rede FE es ei el del dl Open the workspace file for sample programs SOFTUNE Workbench _ Hose Open Workspace mc zi TAWE S rF ririt Select Open Workspace R from the File F menu O Fujitsu 23 FUJITSU Open Workspace E m x Look in E Fujitsu starter kit 28 Buzzer special Input timer Interrupt Ci valume Lec start_kitwwsp sample sensor Files of type workspace File wep Cancel 2 In this step the workspace file to execute a sample program is opened No sample program is executed when the workspace file is opened Open the Start kit wsp file located in the Fujitsu starter kit folder The project window displays the opened workspace ga SOPT
82. r 2 ccciaccccsccenestennsaesenensaestenssaessnensaestensssesseessneseenseaeseansts 62 How to detect temperatures by using temperature sensor 83 FUJITSU 8 3 8 3 1 8 3 2 1 2 A 3 B 1 C How to create and execute a program to display temperature 85 Outline of the program to be created eeeeeeeesseseseseseeeee enn 85 Creation and execution of the program eeeeeeeeeseseesesseeeee een 88 Appendix Program Creation Procedure sese 90 Program Creation Procedute treat tie e ardere raa iiaei 90 Program Procedi 94 Program Execution Method ei E ne Step deae e e pce se d sbdp 96 Appendix Method To Write Read Values in 97 About the Method To Write Read Values in Registers sss 97 Appendix Method To Change the Include 98 About the Method To Change the Include Path 98 Fujitsu FUJITSU Preface Thank you for your purchase of this Starter Kit The Starter Kit 1s intended for first time users of microcomputers The Starter Kit is designed in such a way that even beginners who have neither any actual experience with microcomputers nor any knowledge about what micr
83. ration PPG reload register R Count 250 PPG bits O to 7 0x00 PPG count clock Same as internal operating PPG count clock selection register frequency PPGC bit 13 Enabling PPG 0 disabling output PPG operation mode control 1 enabling register PPGC bit 15 Enabling PPG 0 disabling PPG operation mode control operation 1 enabling register 4 4 2 Creating and executing of program Let us now create the actual program According to the procedure described in Appendix open the source file main c stored in sample prj and input the program portion enclosed by dotted line in the figure below Use the files other than main c without modification After the input of the program build the program according to the procedure described in Appendix A 2 If an error message is output check that the content of the input program is exactly the same as the description shown in the figure below When the build operation ends successfully ACCEMIC MODE starts automatically After the ACCEMIC MDE window appears execute the program and check its operation For how to execute the program see Appendix A 3 The PPG count clock is set to 2 MHz equal to the CPU operating frequency The pulse duration count is set to OxFA 250 for both L and H levels Therefore the total count of a cycle is 500 and the pulse wave at 4 kHz will be output The pulse frequency is calculated
84. rogram Let us now create the actual program According to the procedure described in Appendix A 1 open the source file main c stored in sample pr and input the program portions enclosed by dotted line in Figure 5 4 and Figure 5 5 Use the files other than main c without modification After the input of the program build the program according to the procedure described in Appendix A 2 If an error message is output check that the content of the input program is correct When the build operation ends successfully ACCEMIC MDE starts automatically After the ACCEMIC MDE window appears execute the program and check its operation For how to execute the program see Appendix A 3 After the program starts normally check LED1 is blinking when the program is operating normally Also press SWI to check for normal interrupt operation The interrupt operation is normal if LED3 goes on and off alternately each time SW1 is pressed voi main void set il 7 cenceneeeeue Program code added IO PDRI byte 0x00 IO DDRI byte Ox1F a 1 Port 1 LED control output setting IO DDR2 byte 0x00 lt 2 Port 2 switch input input setting IO ICRO06 byte 0x00 um 3 Interrupt related processing IO ENIR bit EN5 0 Setting to use external interrupt IO ELVA word 0x0800 INT5 IO ENRR bit ER5 0 IO ENIR bit EN5 1 c 4 Enabling interrupt while 1 1 for i 0 i lt 30000 i 4 5 LED on off time count IO PDR
85. rsion 7 1 1 Outline of A D converter A digital value is a value into which an analog value is divided according to a standard based on a certain rule The A D converter is mounted on the microcomputer to perform this conversion For this conversion the important factor is resolution This resolution 1s like the resolution of photograph a scale of how small the analog value is to be resolved and converted to the digital value For example a school record that 15 evaluated on a scale of one to five can be a poor accurate digital value In contrast a school record that is evaluated on full mark of a 1000 point scale can be a highly accurate digital value The microcomputer mounted on this Starter Kit contains the A D converter that has 10 bit resolution 8 bit resolution is also available Having the 10 bit resolution means that it can resolve an analog value into 2 or 1024 levels to convert it to a digital value with 8 bit resolution the value is resolved into 25 or 256 levels The higher the resolution 1s the more highly the A D conversion can be accurate The following shows the 1 61 voltage accuracy at 5 V with 10 bit resolution 8 bit resolution 1 bit voltage accuracy at 5 V 10 bit resolution 5 V 1024 approximately 0 00488 V 8 bit resolution 5 V 256 approximately 0 01953 V 75 FUJITSU 7 1 2 Scheme of volume tab PN Figure 7 3 Variable resistor shows the symbol of a variable resistor The volume is the
86. semiconductor The resistance value of the temperature sensor varies with temperature This Starter Kit contains the TDK s NTC thermistor NTCG164BH103 for its temperature sensor NTC stands for Negative Temperature Coefficient and this thermistor has negative characteristic of the resistance value which is reduced as the temperature rises This section describes the concrete method of detecting temperature by using this temperature sensor EMPERATURE SENSOR Tas Li Temp sensor Figure 8 1 Temperature sensor NTCG164BH103 8 2 How to detect temperatures by using temperature sensor To use the temperature sensor and detect temperature it 1s necessary to understand the specifications of the sensor The specifications of the sensor to be used NTCG164BH103 can be confirmed on the sensor data sheet which is issued from the manufacturer The data sheet of the temperature sensor contains the information required for measurement For this time the relationship between the measured temperature and the state of the sensor resistance value is especially important According to the data sheet the relationship between the temperature from 5 to 50 and the resistances are shown in Table 8 2 Relationship between measured temperature and resistance of NTCG164BH103 Table 8 2 Relationship between measured temperature and resistance of NTCG164BH103 Temperature C Resistance value kQ Temperature C Resistance value kQ
87. t Pressing OK will begin the installation Pressing Cancel will terminate the installation and display the INSTALLATION MANUAL Release Note Click 10 O Fujitsu Fujitsu FUJITSU F2MC 16 Family SOFTUNE Professional Pack Evaluation Welcome to Setup This program will install F2MC 16 Family SOFTUNE Professional Pack E valuation Version on your computer It iz strongly recommended that you exit all Windows programs before running this Setup program CAUTION This product is the F2MC 16 Famly SOFTUNE Evaluation Inquiry Office http COMMON sales e html World wide http edevice fujitsu com CATALOG COMMON sales html Japan Cancel Click Next gt 11 co FUJITSU F2MC 16 Family SOFTUNE Professional Pack Evaluation License Agreement Please read the following license agreement carefully Press the PAGE DOW key to see the rest of the agreement greement on Use of Evaluation Software for Supporting FUJITSU Microprocessors Notes ta Users Evaluation Software Evaluation version of SOFTUNE Professional Pack This amp greement hereinafter referred to as this Agreement is made by and between users and FUJITSU Ltd and prescribes the conditions for using Evaluation Software FUJITSU provides Do you accept all the terms of the preceding License Agreement If you choose
88. t This section explains how to create a program to control the LED blinking by using a timer interrupt The 16 bit reload timer is used for the timer of this program 6 2 1 Outline of the program to be created In Chapter 2 the LED blinking time is controlled by a WAIT of the loop processing In this section a program that uses the 16 bit reload timer interrupt to count the LED blinking time is created The LED operation of this program is the same as that of the program created in Chapter 2 However as the operation of the microcomputer the 16 bit reload timer instead of the CPU is used for counting the LED on and off time The CPU 1s not 0 Fujitsu FUJITSU required for counting the LED on and off time Figure 6 3 Flow of the program shows the flow of the program Timer interrupt is generated Start of main processing v Set LEDS to on 1 Set P14 output level to Low 1 13 Set P14 to output mode 2 DDRI bit4 1 14 o 7 9 o a an Figure 6 3 Flow of the program Timer interrupt processing ends The program created in this section goes into an infinite loop No 12 in the flow of the program after a sequence of the processing During this infinite loop processing the CPU can execute any processing other then the LED processing Table 6 1 Register setting of 16 bit reload timer shows the register of the 16 bit reload timer that 15 set in the program created in this section
89. taining many electrons that are joined to each other t electrode AMEN electrode pn junction surface Figure 2 3 pn junction structure When a voltage is applied across the pn junction structure so that the n type semiconductor is at a negative potential with respect to the p type semiconductor electrons move from the n type semiconductor to the p type semiconductor electron holes move in the reverse direction and thereby a current flows Then some of electron holes and electrons collide with each other and are combined together When an electron hole and an electron are combined together they lose their energy partially and the lost energy is emitted in the form of light The color of emitted light depends on the material of the semiconductor Table 2 1 shows examples of semiconductor materials and corresponding colors of emitted light Fujitsu 41 FUJITSU III Table 2 1 Examples of semiconductor materials and colors of emitted light Semiconductor material Color of emitted light ZnCdSe Blue AlGaAs Red 2 3 How to turn on an LED by microcomputer Figure 2 1 showed an example of circuit in which an LED 1s turned on and off by turning on and off a switch This section explains how to control the switch using microcomputer Figure 2 4shows the connection of LEDs to the microcomputer on the board Figure 2 5 shows a conceptual diagram of the connection In the case of a in Figure 2 5 the signal output
90. ting devices 9 Monitors fe Network adapters H Mon Plug and Play Drivers 2 Other devices E PCMCIA adapters 51 97 Ports COM amp LPT i Communications Pork COM F Communications Port COM2 Hg Sound video and game controllers H E Storage volumes System devices H Universal Serial Bus controllers ES S SCSI and RAID controllers Note If the assigned COM port number is 5 or higher ACCEMIC MDE cannot be used Change the PC settings so that 4 or lower number is assigned to the port O Fujitsu 29 FUJITSU Demo Information 1598719 lit The following software is for demonstration purposes only This License allows you to install and use the Accemic monitor kernel on one target MCU at a time The Accemic software and all its deliverables are intended and must only be used in an EVALUATION LABORATORY EHVIROHMEHT Under no circumstances it may be used in a product Symbolic information is limited Please read our license terms for additional information Thank you for your fairness Copyright e 2001 2003 Accernic GribH Co EG All rights reserved Click OK With this trial version the OK input will take effect 10 seconds later Make the settings of the target microcomputer When you use ACCEMIC MDE for the first time you should download the monitor debugger kernel You need not make these settings again unless you change the target microcomputer Manufa
91. to range from 20 Hz to 20 kHz Try to confirm the range of audible frequencies by changing the buzzer sound Also the buzzer sound will change when the PPG count clock is varied Try to find the reason for the change 62 Fujitsu FUJITSU 5 Let s try to control the LED by interrupt A method to detect the switch operation state was described in Chapter 3 There are also other methods to detect switch operation than the one described in Chapter 3 of the other methods is to use an external interrupt input This chapter explains how to detect switch operation by using an external interrupt input 5 What is an interrupt Let s begin with a brief explanation of interrupts The word interrupt is popularly used in daily life and the meaning of the word is similar when the word is used in the world of microcomputers Imagine that you are studying at home on the day before an examination day You need to focus on study but are disturbed by a telephone call from a friend or an unexpected visitor The telephone call and visitor are interrupts The microcomputer terminology names the events like the telephone call and visitor as interrupt factors and the handling of such events as interrupt processing course the interrupts in the world of microcomputers are not telephone calls and visitors but the on off operation of a switch reception of communication data generation of a timer event and other various events typical for
92. u FUJITSU Table 1 2 lists the parts of the evaluation board 1 MB90F387S Main microcomputer MB90F387S on this board Target device 26PINX2 I O expansion pin of the main microcomputer expansion pin 3 Reset switch A push switch Pressing this switch resets the main microcomputer It switches the operation mode of the main 4 MODE switch A slide switch microcomputer MB90F387S 5 LED lamps 1 red LED lamps that are connected to the general purpose 5 LED lamp and 4 green lamps I O pin Push switches for tests that are connected to the EN wm Test switch 2 push switches general purpose I O pin 7 A D test VR Slide VR A slide VR that is connected to the A D converter input A temperature sensor that is connected to the A D Temperature sensor Thermistor converter input Kyocera s separate excitation type piezo alarm with a 9 Buzzer Buzzer case KBS 13DB 4P 2 It is connected to the PPG timer output pin A USB pin to connect the evaluation board and the host USB host connecter MIN B PC A USB communication microcomputer to connect the USB main microcomputer MB90F387S and the host PC communication MB90F334 It contains the USB communication firmware that has microcomputer been developed by Interface Co Ltd USB communication An expansion pin of the USB communication 2 4 pins microcomputer microcomputer expansion pin Oscillator for Kyocera s crystal oscillator CX 5FD CX 5FD 4M
93. up Program Click Cancel to quit Setup and clase any programs vau have running Click Nest to continue with the Setup program WARNING This program is protected by copyright law and International treaties Unauthorized reproduction or distribution of this program or any portion of it may result in severe civil and criminal penalties and will be prosecuted ta the masimum extent possible under law Cancel Click Next gt 16 Fujitsu Fujitsu FUJITSU Ja Accemic MDE Demo for MBODF387 Starter Kit License Agreement The following terms govern your use of the amp ccemic MDE software unless you have a separate written agreement with 4ccemic PLEASE READ THIS SOFTWARE LICENSE AGREEMENT LICENSE CAREFULLY BEFORE USING THE SOFTWARE BY USING THE SOFTWARE YOU AGREEING BE BOUND BY THE TERMS OF THIS LICENSE IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENSE NOT USE THE ACCEMIC SOFTWARE 1 License The software documentation and any fonts accompanying this License whether on disk in read only memory on any other media ar in any other Farm the Accemic Software gt Do vau accept all the terms of the preceding license agreement If so click on the Yes push button IF select Setup will close Wise Installation Wizard If you accept the agreement click Yes If you refuse the agreement you cannot install ACCEMIC MDE Ja Accemic MDE Demo for MBS0F387 St
94. variable resistor that you use in an experiment in a science class This Starter Kit uses the circuit configuration shown in Figure 7 4 Peripheral circuitry of voltage adjustment By using this tab the voltage is changed and applied to the target pin of the A D conversion The applied voltage is digitized into 1024 levels so that it can be used as an internal signal Figure 7 3 Variable resistor Starter Kit board Microcomputer Variable resistor Volume Figure 7 4 Peripheral circuitry of voltage adjustment tab How to create and execute a program to display potental Let s create a program to display the potential based on the contents so far Input the adjusted voltage convert the analog signal to digital and obtain the digital value Also light the LED to display the potential 7 23 Outline of program to be created Let us now create the actual program The contents of the program are to use the A D converter to digitalize the potential of the applied voltage and to determine the number of LEDs to be lighted according to the potential The main operation of the program is described below The flow of the program is shown in Figure 7 5 Flow of the program 76 Fujitsu Fujitsu FUJITSU 1 Perform initialization such as initial settings of the A D converter 2 Start the A D conversion to obtain the applied voltage by using the A D converter 3 The A D conversion is completed The A D
95. witch target ta Normal Mode MD0 1 MD1 1 MD2z0 Now click OK while it i in reset state When you click OK in the Information dialog box after pressing the RESET switch on the board ACCEMIC MDE starts O Fujitsu 33 FUJITSU w Accemic MDE Demo special abs 81 File Start View Tools Preferences Help I a OLES AES main c start905s asm struct bit 255 OxFF f ZES EE unsigned int LED dir 1 Afer ruri rg d roction af LED AMRO O 0xo0000000 int LED interval 2 her tae ined of LED AMAI O 0x00000000 unsigned int buzzer 1 far beze on ar off AMSR O oxo000 Hlag lang THRE FA24 ar ad isting rel oad ti ner counter lone FFM int LED Aker iD sti ft _ffme16 h 2 enl e terrux for Avenic _io_pil01 c set il CD Let inert Level epl23c J abkBb RE SRE SRE SHES HESHESHESHESHESHEE SEE SEE SESE SESE SEES SESE SEES EES SESE HE jo tmr c enable iterrut mb30385 h _190385 h flag LED dir 0i JAD shi ft of rection for eft 1 for ri ght _standby h fla LED inter val interval Level Is 1 0 amp 2 00 28 3 vreturn to 15 ad initial c flag buzzer Ov MO stop hze 1 start buzzer ad_int c H cpu_16lx h ext_int c Address 0 ext_int_initial c OOFF025D 0800 LINK 00 extem h QOFFO25F 2540 OR CCR 40H main c OOFFO0261 1407 MOV ILM 07H monit
96. zer ATTN j Mif Hmm 3 Reset switch On _ __ _ 5 I al 254552428525125152 P Hiiisaldg si 1 B m Y L s CONTR FIRMWARE Y NU OT REACH o BYTES vunhe yato cO mens 4 MODE switch ln u 11 USB communication 6 Test switch o Temperature microcomputer sensor 7 A D test VR 14 Oscillator for USB Figure 1 1 Board O Fujitsu 3 FUJITSU board lon for the evaluati t diagram HE 15 a circul Figure 1 2 le tdl ONS 380d8d AS IWO LC 2 e 044 LAB LC WS ZN j V Fal 29 LABLZ IWS ZA traal LN S uaa 39 LWaLZ IWS AA 037 7 amp dt Q isi T 129 u3zznsa 3 id 1 SE UMS 13sau x 3 d3818 LEASH MZ V na UAL v ca SC BEJOBSN L31 ENO SH La 62 7 2 fid bed 0 Led Atd Ltd cid QNS OND Os 1105 3 INIS Z Ux cu UWL v Gla ONS YOSNAS 1 1 P I gt UBL i Evaluation board circuit diagram Figure 1 2 Fujits

Download Pdf Manuals

image

Related Search

Related Contents

ScreenPlay Manual  FT- BROU DE NOIX  BENUTZERHANDBUCH  Chief LVM2X2U flat panel floorstand  

Copyright © All rights reserved.
Failed to retrieve file