Table of Contents

Advertisement

Quick Links

FUJITSU Electronic Devices
User's Manual
2
F
MC-16LX STARTER KIT
USER'S MANUAL

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the F2MC-16LX STARTER KIT and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Fujitsu F2MC-16LX STARTER KIT

  • Page 1 FUJITSU Electronic Devices User's Manual MC-16LX STARTER KIT USER'S MANUAL...
  • Page 2: Revision History

    Revision History Date Description Jun 27, 2005 Edition 1.0: Initial release © Fujitsu...
  • Page 3 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.
  • Page 4: Table Of Contents

    How to create and execute a program to control LEDs by switch operation ..... 51 3.2.1 Outline of program to be created ................51 3.2.2 Creating and executing of program ................ 52 “Let's try to sound a buzzer!” .................. 54 Devices used for buzzer ..................... 54 © Fujitsu...
  • Page 5 Outline of program to be created ................76 7.2.2 Creation and execution of the program..............80 “Let's use the temperature sensor.” ................82 What is a temperature sensor? ................... 82 How to detect temperatures by using "temperature sensor"........83 © Fujitsu...
  • Page 6 Program Execution Method ..................96 Appendix (Method To Write/Read Values in Registers) ..........97 About the Method To Write/Read Values in Registers..........97 Appendix (Method To Change the Include Path)............98 About the Method To Change the Include Path ............98 © Fujitsu...
  • Page 7: Preface

    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...
  • Page 8: Setting Up Of Starter Kit

    (the download version is not delivered on CD-ROM). Table 1.1 List of components and necessary equipment Item Specification Remarks Board Evaluation board equipped with Fujitsu F2MC-16LX Series See Figure 1.1. MB90F387 Microcomputer USB cable Accessory Installation CD-ROM for installing SOFTUNE, ACCEMIC MDE, and...
  • Page 9 (10) USB host connecter main microcomputer (1)Target device (5)LED (12) USB communication microcomputer expansion pin (9)Buzzer (3)Reset switch (4)MODE switch (11)USB communication (8)Temperature (6) Test switch microcomputer sensor (7) A/D test VR (14) Oscillator for USB Figure 1.1 Board © Fujitsu...
  • Page 10 Figure 1.2 is a circuit diagram for the evaluation board. Figure 1.2 Evaluation board circuit diagram © Fujitsu...
  • Page 11 Kyocera's crystal oscillator (CX-5FD) (13) CX-5FD (4MHz) microcomputer It is an oscillator for the main microcomputer. Oscillator for USB Kyocera's crystal oscillator (CX-5FD) (14) communication CX-5FD(6MHz) It is an oscillator for the USB communication microcomputer microcomputer. Table 1.2 Evaluation board parts © Fujitsu...
  • Page 12 Connect the board to the personal computer by using the accessory USB cable. Supply power to the board by USB bus power system. Be sure to connect the USB cable directly to the personal computer. Do not connect the USB cable via a USB hub. © Fujitsu...
  • Page 13 On when the output is L level logic P14/IN4 LED5 Negative On when the output is L level logic P17/PPG3 BUZZER Rectangular Initially at L level, C coupling, bias R wave P40/SIN1 RS232C P42/SOT1 RS232C P30/SOT0 PULL-DOWN(50 kΩ) P31/SCK0 PULL-DOWN(50 kΩ) © Fujitsu...
  • Page 14: Setting Up Of Personal Computer

    ④ 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.) © Fujitsu...
  • Page 15: Installing Of Usb Driver

    1.1.1 Installing of USB driver Install the USB driver according to the content of the "USB Driver Installation Manual". © Fujitsu...
  • Page 16: Installing Of Integrated Development Environment "Softune

    MC-16LX Starter Kit (Jouet Bleu), and open the folder where the files are decompressed. ② Double-click on the Setup.exe icon in the \\jouet_bleu \SOFTUNE folder to start installation. ③ Follow the instructions on the screen to perform installation. Click 'OK.' © Fujitsu...
  • Page 17 Click 'Next >.' Click 'Next >.' © Fujitsu...
  • Page 18 If you accept the agreement, click 'Yes.' (If you refuse the agreement, you cannot install SOFTUNE.) Click 'Next >.' © Fujitsu...
  • Page 19 Click 'Next >.' (Do not change the installation-destination folder here.) Click 'Next >.' © Fujitsu...
  • Page 20 Click 'Next >.' The installation is executed. © Fujitsu...
  • Page 21 Click 'Finish.' The installation of SOFTUNE (limited-function version) is completed. Proceed to the installation of the demonstration version of ACCEMIC MDE. © Fujitsu...
  • Page 22: Installing Of Demonstration Version (Trial Version) Of Accemic Mde

    MC-16LX Starter Kit (jouet bleu), and open the folder where the files are decompressed. ② Double-click the MDE_16LX_DEMO_V22ST_STARTERKIT.exe icon in the \\jouet_bleu\MDE_16LX_DEMO_V22ST_STARTERKIT folder start installation. ③ Follow the instructions on the screen to perform the installation. Click 'Next >.' © Fujitsu...
  • Page 23 If you accept the agreement, click 'Yes.' (If you refuse the agreement, you cannot install ACCEMIC MDE.) Click 'Next >.' © Fujitsu...
  • Page 24 Click 'Next >.' (Do not change the installation-destination folder here.) Click 'Next >.' © Fujitsu...
  • Page 25 Click 'Next >.' The installation is executed. © Fujitsu...
  • Page 26 When the installation is completed, click 'Finish >.' 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. © Fujitsu...
  • Page 27: Setting Up Of Evaluation Board And Connecting Of Board To The Personal Computer

    Flash memory serial write mode → Used to write a program to the microcomputer Single chip mode → Used to actually run the program written to the microcomputer Confirm that the MODE selector is set to PROG. Next, perform the cable connection. © Fujitsu...
  • Page 28 ACCEMIC MDE, connect board personal computer using the USB cable. USB port The power of the evaluation board is supplied from the USB power supply (USB bus power). Figure 1.4 Connection of the evaluation board and personal computer © Fujitsu...
  • Page 29: Starting And Setting Up Of Softune

    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. Open the workspace file for sample programs. Select Open Workspace (R)... from the File (F) menu. © Fujitsu...
  • Page 30 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. © Fujitsu...
  • Page 31 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. © Fujitsu...
  • Page 32: Starting And Setting Up Of Accemic Mde

    Build operation started... --------------------Configuration: special.prj - Debug-------------------- start905s.asm monitor16LX.asm _FFMC16.C … PPG_01_int.c Linked... *** I0312L: 0 warnings were output after S.C.F check. D: ¥ jouet_bleu¥fujitsu_starter_kit¥special¥Debug¥ABS¥apecial.abs ------------------------------ No error was found. Confirm that no error was found. ------------------------------ © Fujitsu...
  • Page 33 -------------------- Configuration: special.prj - Debug-------------------- start905s.asm monitor16LX.asm _FFMC16.C *** D:¥jouet_bleu¥Fujitsu_start_kit¥special¥_ffmc16.c(9) E4038P: #include: File "_ffmc16.h" is not found. … main.c *** D:¥jouet_bleu¥Fujitsu_start_kit¥special¥main.c(17) E4038P: #include: File "_ffmc16.h" is not found. monitor16LX.asm ------------------------------ Error was found. Example of error detection ------------------------------ © Fujitsu...
  • Page 34 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 checking the COM port number] First, click the right side of a mouse on the "My Computer", and click on "Property(R)." © Fujitsu...
  • Page 35 LPT." The "(COMx)" part indicates the COM port number. [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. © Fujitsu...
  • Page 36 (You need not make these settings again unless you change the target microcomputer.) Here, select Fujitsu for "Manufacturer" and MB90F387 for "Type," and then click 'Next >.' If you need to correct settings in the 'Select Processor dialog box' because you made an incorrect "Type"...
  • Page 37 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 MDE will not start. If you fail to perform switch operation correctly, resume the operation from the step described in Item 1.1.6. © Fujitsu...
  • Page 38 With the next Information dialog box displayed, do not click OK immediately but perform necessary switch operations on the board. When this dialog box is displayed, do not click OK immediately, but perform switch operations on the board. © Fujitsu...
  • Page 39 Set the MODE selector to RUN. Press the 'RESET' switch. Now, click 'OK.' When you click 'OK' in the Information dialog box after pressing the 'RESET' switch on the board, ACCEMIC MDE starts. © Fujitsu...
  • Page 40 The LEDs 1 to 5 on the board are shifted leftward respectively at one-second interval. When the program is executed, the LEDs 1 to 5 on the evaluation board are shifted leftward respectively It also has the functions listed in Table 1-4. one-second interval. © Fujitsu...
  • Page 41 Shift speed: 1 second 0.5 seconds 0.25 seconds 0.125 seconds 1 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 Volume © Fujitsu...
  • Page 42 Stop the program as follows: Select Stop from the Start menu to stop the sample program. Reset the program as follows: Select Restart from the Start menu. The program is reset. © Fujitsu...
  • Page 43: Terminating Of Accemic Mde

    1.1.8 Terminating of SOFTUNE After terminating ACCEMIC MDE, terminate SOFTUNE as follows: Select 'Exit' from the File menu to terminate SOFTUNE. The SOFTUNE window closes. Described above are the basic operation procedures using sample programs to start debugging. © Fujitsu...
  • Page 44: Board Operation Without Accemic Mde

    Then, put a checkmark on "Automatic start after reset," and press "OK." It starts erasing the Flash memory and writing the program. It takes several tens of seconds to complete the writing. Wait for a while. When the program writing ends, the progress bar disappears. © Fujitsu...
  • Page 45 "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! © Fujitsu...
  • Page 46: "Let's Try To Turn On The Led

    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. © Fujitsu...
  • Page 47: How Can The Led Emit 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...
  • Page 48: How To Turn On An Led By Microcomputer

    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. Figure 2.4 Actual circuit diagram © Fujitsu...
  • Page 49 PDR1 bit0 When 0 is read Low-level input When 0 is written Low-level output When 1 is read High-level input When 1 is written High-level output Figure 2.6 Explanation of registers to control the output from P10 to P14 © Fujitsu...
  • Page 50: How To Create And Execute A Program To Turn On The Led

    '1' to the bit corresponding to the pin. 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. © Fujitsu...
  • Page 51: Outline Of Program To Be Created

    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 B.1. While the program is executed, you can see that LED5 goes on on the board. © Fujitsu...
  • Page 52: How To Create And Execute A Program To Make The Led Blinking

    LED. You can vary the on/off time by changing the currently set value (30000). - On/off time count for(i=0;i<30000;i++); © Fujitsu...
  • Page 53: Creating And Executing Of Program

    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 executed, you can see that LED5 goes on on the board. © Fujitsu...
  • Page 54 (3) LED5 on time count IO_PDR1.byte=0xFF; (4) LED5 off setting (P10 to P14 =High) for(i=0;i<30000;i++); (5) LED5 off time count IO_PDR1.byte=0xEF; (6) LED5 on setting (P14=Low, P10 to P13=High) Program to be added Figure 2.11 Program to make LED5 blinking © Fujitsu...
  • Page 55: "Let's Try To Control The Led By Switch Operation

    Therefore, the input status at pin P27 changes when SW2 is operated. ■ When SW1 is off ■ When SW1 is on Microcompute Microcomputer Pin P25 Pin P25 PDR2 register PDR2 register Figure 3.2 Connection of SW1 to microcomputer pin (conceptual diagram) © Fujitsu...
  • Page 56 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. © Fujitsu...
  • Page 57: How To Create And Execute A Program To Control Leds By Switch Operation

    Set LED1 to off (PDR1.bit0 = 1) Set LED1 to on (PDR1.bit0 = 0) PDR2.bit7 = 1 SW2 input state? PDR2.bit7 = 0 Set LED2 to on (PDR1.bit1 = 0) Set LED2 to off (PDR1.bit1 = 1) Figure 3.4 Flow of program © Fujitsu...
  • Page 58: Creating And Executing Of Program

    (4) LED1 on else{ IO_PDR1.bit.P10 = 0; (5) LED1 off (6) SW2 input state? if(IO_PDR2.bit.P25==1){ IO_PDR1.bit.P10 = 1; (7) LED2 on else{ IO_PDR1.bit.P10 = 0; (8) LED2 off Program code added Figure 3.5 Sample program code (main routine) © Fujitsu...
  • Page 59 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. © Fujitsu...
  • Page 60: "Let's Try To Sound A Buzzer

    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 device. Piezoelectric devices are also used for piezoelectric loudspeakers, crystal earphones, vibration sensors, and microphones. © Fujitsu...
  • Page 61: Crystalline Characteristics Of Piezoelectric Device

    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 © Fujitsu...
  • Page 62: Principle Of Piezoelectric Device

    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 © Fujitsu...
  • Page 63: Self-Excited And Separately Excited Vibrations

    You can basically output a pulse wave from the microcomputer when you make the following settings on the PPG timer: Setting of L-level and H-level duration Setting of PPG count clock © Fujitsu...
  • Page 64: Setting Of L-Level And H-Level Duration

    When the PPG count clock is set, the cycle of pulse set in Item 4.3.1 is determined. 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. © Fujitsu...
  • Page 65: Outline Of The Program To Be Created

    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. © Fujitsu...
  • Page 66: Creating And Executing Of Program

    0xFA (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 as follows: 2 MHz ÷ 500 (count) = 4 kHz © Fujitsu...
  • Page 67 (6) Infinite loop while(1); 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. © Fujitsu...
  • Page 68: Changing The Tone Of A Buzzer Sound

    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. © Fujitsu...
  • Page 69: "Let's Try To Control The Led By Interrupt

    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 © Fujitsu...
  • Page 70: How To Detect A Switch Operation By Interrupts

    SW2 is connected to pin INT7 of the microcomputer, an external interrupt is generated at pin INT7 when SW2 is operated. Starter Kit board Microcompute Pin INT5 ELVR (pin P25) EIRR ENIR Figure 5.2 Connection of SW1 to microcomputer pin (conceptual diagram) © Fujitsu...
  • Page 71: How To Create And Execute A Program To Control The Led By Switch Input

    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 © Fujitsu...
  • Page 72 ELVR.bit10 = 1, ELVR.bit11 = 1, ENRR.bit5 = 0) End of external interrupt processing Enable interrupt. - - - (4) (ENIR.bit5 = 1) 3000 counted? Turn on or off LED1 (PDR1.bit0 = !(PDR1.bit0)) - - - (6) Figure 5.3 Flow of the program © Fujitsu...
  • Page 73: Creating And Executing Of Program

    (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; (4) Enabling interrupt while(1) for(i=0;i<30000;i++); (5) LED on/off time count IO_PDR1.bit.P10 = ~ IO_PDR1.bit.P10; (6) LED state change Figure 5.4 Sample program code (main routine) © Fujitsu...
  • Page 74 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. © Fujitsu...
  • Page 75: "Let's Blink The Led By Using A Timer Interrupt

    When a timer is used, the timer can take the processing of counting the LED-on and -off time that is 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. © Fujitsu...
  • Page 76: Timer Interrupt

    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 is not © Fujitsu...
  • Page 77 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 µ s) × Number of counts (62500) = 1 s © Fujitsu...
  • Page 78: Creation And Execution Of The Program

    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 LED5. Blinking LED5 indicates the normal operation. © Fujitsu...
  • Page 79 In the above code, there are some expressions such as "IO_XXX.byte" and "IO_YYY.bit". These are the useful description formats, which are defined in the IO header file. For more information, see the Appendix. © Fujitsu...
  • Page 80: "Let's Use The A/D Converter

    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 © Fujitsu...
  • Page 81: Outline Of A/D Converter

    A/D conversion can be accurate. The following shows the 1-bit voltage accuracy (at 5 V) with 10-bit resolution and 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 © Fujitsu...
  • Page 82: Scheme Of Volume Tab

    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 . © Fujitsu...
  • Page 83 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) 01h (Input permitted from Ch0 only) © Fujitsu...
  • Page 84 LEDs 1 to 2 are on. 2.50 to 3.33 V 128 to 171 LEDs 1 to 3 are on. 3.33 to 4.17 V 171 to 213 LEDs 1 to 4 are on. 4.17 to 5.00 V 213 to 255 All LEDs are on. © Fujitsu...
  • Page 85 LED lighting processing (PDR1.byte = 0x1C) Infinite loop AD_DATA<168 LED lighting processing (PDR1.byte = 0x18) AD_DATA<210 LED lighting processing (PDR1.byte = 0x010) LED lighting processing (PDR1.byte = 0x00) External interrupt processing ends Figure 7-5 Flow of the program © Fujitsu...
  • Page 86: Creation And Execution Of The Program

    - A/D converter channel setting IO_ADCRLH.byte.ADCRH = 0xF8; - A/D converter mode setting - A/D sampling condition setting conversion IO_ADCSH.bit.INTE = 1; interrupt permission IO_ADCSH.bit.STRT = 1; (6) A/D conversion starts while(1); Figure 7-6 Example of program code (main routine) © Fujitsu...
  • Page 87 In the above code, there are some expressions such as "IO_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. © Fujitsu...
  • Page 88: "Let's Use The Temperature Sensor

    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. © Fujitsu...
  • Page 89: How To Detect Temperatures By Using "Temperature Sensor

    C 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[kΩ] Temperature[°C] Resistance value[kΩ] 26.250 7.997 20.390 6.437 15.960 5.213 12.590 4.248 10.000 3.481 © Fujitsu...
  • Page 90 [V] can be obtained by using the following formula. × 10000 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 C and © Fujitsu...
  • Page 91: How To Create And Execute A Program To Display Temperature

    (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, repeat ( 2 ) to ( 4 ) . © Fujitsu...
  • Page 92 113 to 141 C or higher but lower than 30 LEDs 1 to 2 are on. 142 to 170 C or higher but lower than 20 LED 1 is on. 171 to 255 Lower than 10 No LED is on. © Fujitsu...
  • Page 93 LED lighting processing (PDR1.byte = 0x1C)) Infinite loop AD_DATA>87 LED lighting processing (PDR1.byte = 0x18) AD_DATA>66 LED lighting processing (PDR1.byte = 0x010) LED lighting processing (PDR1.byte = 0x00) External interrupt processing ends. Figure 8-3 Flow of the program © Fujitsu...
  • Page 94: Creation And Execution Of The Program

    - A/D converter channel setting IO_ADCRLH.byte.ADCRH = 0xF8; - A/D converter mode setting - A/D sampling condition setting (5) A/D conversion IO_ADCSH.bit.INTE = 1; interrupt permission IO_ADCSH.bit.STRT = 1; (6) A/D conversion starts. while(1); Figure 8-4 Example of program code (main routine) © Fujitsu...
  • Page 95 In the above code, there are expressions such as "IO_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 . © Fujitsu...
  • Page 96: A Appendix (Program Creation Procedure)

    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" is displayed in boldface in the list, and debugging of the sample project is enabled. Sample project Select 'Set active project.' © Fujitsu...
  • Page 97 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. © Fujitsu...
  • Page 98 The dialog box below appears. Select Text file, and then click 'OK.' 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.' © Fujitsu...
  • Page 99 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. © Fujitsu...
  • Page 100: Program Building Procedure

    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. © Fujitsu...
  • Page 101 If an error is found in the created program, the error is indicated as shown below. Correct the indicated error, and perform 'building' again. Click the error code to jump to the line that includes the error. Error indication window © Fujitsu...
  • Page 102: Program Execution Method

    ACCEMIC MDE has started, the window as shown below appears: Use the buttons shown below to control the program. Function Button Operation (when clicked) Continuous Starts and runs the program continuously. execution Stop Stops the running program. Reset Resets the microcomputer. © Fujitsu...
  • Page 103: B Appendix (Method To Write/Read Values In Registers)

    It is now immediately clear that the description specifies the processing to write 0xff to the PDR1 register. The I-O header file contains the definitions of these description formats for the registers of the microcomputer built in the Starter Kit. © Fujitsu...
  • Page 104: C Appendix (Method To Change The Include Path)

    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 the include path of the C. Delete the specified include path. © Fujitsu...
  • Page 105 Click this button to select a arbitrary directory. Select a folder. Click the Add button to add the selected include path. After setting, click the OK button. © Fujitsu...
  • Page 106 Use the same procedure for setting the include path of the assembler. Select this tab for setting the include path of the assembler. © Fujitsu...

Table of Contents