Home
bits pot yellow User..
Contents
1. Run gt bo Reset of Mt Breakpoints Breakpoint Set Reset Event fs Fala Time Measurement elIa XD ee 4 E Workspace bitspot_yell Clear Call e gt None single_operatior vector Source Files HAKKAR AAAAAAAEAAAEET Gi Include Files O88 targst Te Dependencies End debug ermistor_ANO ed Debug adInitialize void LIN_communication abs 132 133 IO AIDRL 0x60 Figure 2 36 Stopping the program 58 FUJITSU AN07 00200 03E 2 2 4 1 If the monitor debugger cannot be controlled It may become unable to control the monitor debugger Le communications between the host system and the target fails due to such as the application program unexpected behavior In such cases restart the debugger using the following procedure 2 2 4 2 0ONO N N P w OMVOOBOHNO Select Debug D Abort Alternatively click the Run Stop button Click the Abort A button in the abort dialog Note MCU cannot be reset at this time This dialog may be displayed several times but ignore it If the warning Cannot abort is displayed click OK Close the debugger and reset the target system Restart the debugger Debugger prohibitions Do not operate resources that use the monitor debugger IO ports P10 P11 P12 Do not operate the PLLC and SYCC registers by using the debugger Do not set break points in
2. FUJITSU AN07 00200 03E F MC 8FX Family 8 BIT MICROCONTROLLER MB95F136JUBS bits pot yellow LIN board User s Manual FUJITSU AN07 00200 03E Revision History Date Revision October 24 2008 Revision 1 0 Initial release May 13 2009 Revision 1 1 TSUZUKI DENSAN s Logo mark was changed April 23 2010 Revision 1 2 Change in company name of FUJITSU MICROELECTORONICS New FUJITSU SEMICONDUCTOR LIMITED left blank FUJITSU AN07 00200 03E Note The contents of this document are subject to change without notice Customers are advised to consult with FUJITSU sales representatives before ordering The information such as descriptions of function and application circuit examples in this document are presented solely for the purpose of reference to show examples of operations and uses of Fujitsu semiconductor device Fujitsu does not warrant proper operation of the device with respect to use based on such information When you develop equipment incorporating the device based on such information you must assume any responsibility arising out of such use of the information Fujitsu assumes no liability for any damages whatsoever arising out of the use of the information Any information in this document including descriptions of function and schematic diagrams shall not be construed as license of the use or exercise of any intellectual property right such as patent rig
3. 0c ccc ener reece eee e eter 50 Figure 2 24 Specifying a batch filerian isata oi ee ets 50 Figure 2 25 Configuring the target file settings cere e cece e eee e eee eeeeeeae eee ee teenie 51 Figure 2 26 Setting setup file selection 0c ee eee ee eee reece eee ee ee eeeceeeeee eater 51 Figure 2 27 Completing the setup Wizard cc ccc erence eee eee eneeeenee ee ee teen 52 Figure 2 28 Completing the project settings eee eee eee e ener eee eeeeeneee eee ee ete 52 Figure 2 29 Opening the file tO Write c ccccssscsssescesssecsseesssescessseeesssedsssccessusnsaasdeaescessuarenasees 53 Figure 2 30 Selecting the file to write ee erence eee eee nneeeneeeeeeee ete 54 Figure 2 31 Writing the programm sii ciehsinsesusedctebebstabebabetetsiahshabevehsbelibabsbabsbsbabetilahebebeeyss 55 Figure 2 32 Completing the program writing 0 0 0 ieee e enna reer neeeeneee eee ee eta 55 Figure 2 33 Start debug ging ss sccissssssesscctssctanessnsssoctssstanesenstsocdaasdeaassoatsceseasdinasssatessieasdenntsssd 56 Figure 2 34 Setting break points ee eee eee inasi pr r panirani p rnk pr erene p rare EaS 57 Figure 2 35 Running the program ssssssserrrersssrrrerrrrrsserrrerrnnnrssrrrrnrnnnnnserrrernneneserrrennn 58 Figure 2 36 stopping the programi isscccconiieicdscctes octal ere erer orea hide ei 58 Figure 3 1 Single unit operation Controls and mechanicals 00 0 0 cece cece ener eee 61 Figure 3 2 LIN communic
4. FUJITSU ANO7 00200 03E Seats Power seat and motor control Passenger detection Heater Switch control Figure 5 1 Example of vehicle LIN applications 80 FUJITSU ANO7 00200 03E The characteristics of LIN used in the way described above are collated and introduced in the following five points 1 Single master communication LIN has two types of communication nodes One is the master sender This controls the start of all communications The other is the slave recipient The slave responds to commands sent by the master LIN communication must start from the master and cannot be started by a slave Further the LIN communication mode designated as the master is pre determined This format is called a single master format 2 A maximum of 15 slave nodes can be connected using bus wiring The LIN network configuration topology is a bus With single master LINs the slaves communicate only when they receive commands from the master so there is no conflict of signals in the bus A maximum of 15 slave nodes can be connected to one master Communications can be Communications cannot be started from the master started from the slave Door Lock Up to 15 slaves max Can be connected Transceiver IC Electronic component for sending and receiving data Figure 5 2 Main LIN network configuration 3 Wiring is completed using a single wire The on board ECUs are con
5. 20 Fo FUJITSU 1 1 Setting IANO7 00200 03E up the PC Install the software required to operate this starter kit into the PC To set up the PC use the following procedures Downloading the software Installing the integrated development environment SOFTUNE bits pot dedicated version Installing the PC Writer FUJITSU FLASH USB Programmer bits pot yellow dedicated version Connecting it to the PC and installing the USB driver Configuring the starter kit settings 21 FUJITSU AN07 00200 03E 1 1 1 Downloading the software Download and decompress the file from the following website bits pot URL http www tsuzuki densan co jp bitspot 1 1 2 Installing the integrated development environment SOFTUNE bits pot yellow dedicated version Note If SOFTUNE V3 of the product version has been installed first uninstall it and then install the bits pot yellow dedicated version Install the integrated development environment SOFTUNE Unzip the following file in the folder you decompressed in 1 1 1 Downloading the software softwares SOFTUNEY ProPack_Rev300016 BV_8FX zip Double click Setup exe in the decompressed folder The dialog shown in Figure 1 4 SOFTUNE setup confirmation will be displayed Click the OK button F2MC 8L 8FX Family SOFTUNE ProPack Setup M Always refer to the INSTALLATION MANUAL Release Note before installing
6. Figure 1 8 SOFTUNE setup Version information The dialog to select the installation path will be displayed as shown in Figure 1 9 SOFTUNE setup Selecting the destination of installation select the default folder or desired folder and then click the Next button F2MC 8L 8FX Family SOF TUNE ProPack Setup Choose Destination Location Select folder where Setup will install files Enter destination directory e g C Softune m Destination Folder C Softune Browse lt Back Cancel Figure 1 9 SOFTUNE setup Selecting the destination of installation 24 FUJITSU ANO7 00200 03E The dialog to select the components will be displayed as shown in Figure 1 10 SOFTUNE setup Selecting the components Leaving the default settings as they are click the Next button F2MC 8L 8FX Family SOFTUNE ProPack Setup Select Components Choose the components Setup will install Select the components you want to install and clear the components you do not want to install Bley SOFTUNE Workbench pn SOFTUNE Workbench Integrated Environment Customize Bar Development Platform a Communication module for EasyCODE Integrated Environment Communication module for ZIPC Development Platform for the SOFTUNE C Compiler F2MC 8L 8FX Family SOFTUNE Assembler Pack Space Required on C 82118 K Space Available on C 102580 K InstallShield _ _
7. singe operation Debug Disa HES ej AC a E Workspace bitspot_yellow_S single_operation abs Source Files Include Files Dependencies Debug m LIN_communication abs Figure 2 4 Setting the active project To set the project for LIN communication as the active project select the project for LIN communication and right click on it as shown in Figure 2 5 Changing the active project The sub menu is displayed so select Set Active Project The project name will be displayed in bold and the build for that project will be enabled e SOFTUNE Workbench bitspot_yellow_Samplq File Edit View Project Debug Setup Window Help Ele ot E mom le sle Debus olsa a single_operation abs m Source Files Include Files SOF TUNE Workbench bitspot_yellq Fie Edit View Project Debug Setup Wir aemelkol FAES LIN_SLAvE Debug Deal alle ael amp l A E Workspace bitspot_yellow_S single_operation abs Source Files w Include Files Dependencies Debug E B LIN_communication single operation Dependencies i Debug D Create new folder Add Member to project Set Project Set Linkage order Make Build Executing linker or librarian Delete Project Property THE FNI Openlist File Open HEX File Figure 2 5 Changing the active project
8. herein void main sysInitialize Port initialization adInitialize AD converter initialization initial_external_int External interrupt initialization __set_il 3 EIQ while 1 Infinite loop Figure 4 14 Main function program 76 FUJITSU AN07 00200 03E Next an interrupt is created when SW2 is pushed The external interrupt function _interrupt void Ext_intl_5 in ext_int c will be called as shown in Figure 4 15 SW2 interrupts LED on off processing Here the LED display is turned on off due to the output settings for the port connected to the LED or due to the switch being pressed several times is shown _interrupt void Ext_int1_5 void 1O_EIC20 bit EIR1 0 if TEMP_MEASURE_OFF lt When using Volume SW IO_DDR1 bit P14 1 IO_DDR1 bit P15 1 IO_DDR1 bit P16 1 lt Port output setting SW_count if SW_count gt 3 SW_count 0 IO_PDR1 byte LED_pat SW_count LED ON processing else if TEMP_MEASURE_ON Using temperature sensor Omitted Figure 4 15 SW2 interrupts LED on off processing An interrupt is also created if SW3 is pressed and the external interrupt function __interrupt void Ext_int2 6 in ext_int c is called as shown in Figure 4 16 SW3 interrupts buzzer output processing This is where the PPG timer output settings are made and timer start stop process is performed __ interrupt void Ext_int2_6 void IO_EI
9. void initial_external_int void if InitIrqLevels i interrupt priority setting zy IO_DDR0 bit P0S 0 INTOS PortPOS input setting ey I0_DDRO bit P06 0 it INTO6 PortP06 input setting urd Figure 2 34 Setting break points 57 FUJITSU ANO7 00200 03E Click Debug Run Go from the menu as shown in Figure 2 35 Running the program By this operation the program runs and the starter kit operates SOFTUNE Workbench bitspot_yellow_SampleProgram_monitordebugger Del File Edit View Project sEcly Setup Window Help 27 70 a Beebo 3 Step In F zlale Reset of MCU Step Over F7 1 Step Out Shift F6 Breakpoints f i Cursor Ctri F Breakpoint Set Reset F9 ms e en equent Stack Workspace bitspot_yell Clear Ca single_operatior vector Source Files Include Files Load target File ermistor_ANO adInitialize void I0_AIDRL 0x60 E Dependencies eng debug if TEMP_MEASURE_ON Debug I0_ADCl byte Ox7l w LIN_communication abs 136 137 138 else if TEMP_MEASURE_OF 1208 TO aN huta Mwlls Figure 2 35 Running the program To stop the program click Debug Abort from the menu as shown in Figure 2 36 Stopping the program SOFTUNE Workbench bitspot_yellow_SampleProgram_monitordebugger De File Edit view Project POSA Setup Window Help
10. Figure 3 2 LIN communication operation Controls and mechanicals Perform LIN communication with bits pot white The starter kit sends responses to the bits pot white as a LIN slave LED red and 7SEG ON signals and buzzer outputs of the starter kit and the bits pot white are controlled by switch operation and temperature sensor and volume switch operation of each starter kit Further if an error occurs during LIN communication a buzzer output is sent 8 LED WERE TOR NTCOM4 3 Ae EN 6 Volume SW T 2 Reset SW 5 Temperature sensor 3 SW2 4 SW3 Figure 3 2 LIN communication operation Controls and mechanicals 63 Fo FUJITSU IANO7 00200 03E Table 3 2 LIN communication Descriptions of the controls and mechanicals No Name Function Description Mode SW Control Switches between PROG mode and RUN mode PROG Write a program RUN Run the program Reset SW Control Resets the MCU when pressed SWw2 Control If SW 2 is pressed when the bits pot white SW4 is set to the left the value on the LED currently displayed in the starter kit is incremented and the bits pot white LED and 7SEG LED are also incremented If bits pot white SW4 is set to the right no operation is performed SWw3 Control If SW2 is pressed when the bits pot white SW4 is set to the left the value on the LED currently displayed in the starter kit is decremented and the bits
11. Omitted uiIJCUTime2 TOODR Acquire timer value adjust Baud Rate Baud rate adjustment processing Omitted vEnableLinUartReception lt LIN UART interrupt authorized ucLinStatus LIN_ID_ RECEPTION State transition ID received Omitted else if TOOCR1_IF SET Check whether there is an overflow interrupt Omitted Acquire number of overflows Figure 5 15 Input capture ICU interrupt controls 102 FUJITSU AN07 00200 03E ID field ID reception processing is performed in the LIN UART interrupt function _LinUART void When an interrupt is created if no error is created and the cause of the interrupt isn t a synch break interrupt reception processing is performed __ interrupt void _LinUART void Omitted if ssr amp OxEO 0 Error check Omitted else if ESCR_LBD SET Synch break detection Omitted else l_ifc_rx data Receive processing Figure 5 16 LIN UART receive interrupt control Processing is divided into ID reception data sending data reception and wakeup sending according the status in the reception judgment processing function _ifc_rx l_ifc_handle rx_data as shown in Figure 5 17 Receive determination processing In normal sequences to migrate the status during the second input capture interrupt process to ID FIELD reception waiting ID reception processing is performed In ID reception processing the ID that h
12. dedicated version Start Installing the PC writer Select the following file in the folder you decompressed in 1 1 1 Downloading the software softwares USB PROGRAMMER BGM_MB95F136JBS_setup exe Double click BGM_MB95F136JBS_setup exe The dialog shown in Figure 1 13 PC writer Installation dialog will be displayed and the installation starts Click the Next button ie FUJITSU FLASH USB Programmer bits pot MB95F136JBS InstallShield Welcome to the InstallShield Wizard for FUJITSU FLASH USB Programmer bits pot NIB95F136IBS The InstallShield R Wizard will install FUJITSU FLASH USB Programmer bits pot MB95F136JB5 on your computer To continue click Next Figure 1 13 PC writer Installation dialog 27 FUJITSU AN07 00200 03E The dialog shown in Figure 1 14 PC Writer Setup type will be displayed Select complete and then click the Next button ie FUJITSU FLASH USB Programmer bits pot MB95F136JBS InstallShield Setup Type Choose the setup type that best suits your needs Please select a setup type Complete 3 All program features will be installed Requires the most disk space O Custom Choose which program features you want installed and where they will be installed Recommended for advanced users Figure 1 14 PC Writer Setup type The dialog shown in Figure 1 15 Finished PC writer Ready to install will be displayed Click
13. define is set so that whether to use the temperature sensor and the enable disable settings can be configured To use the Volume SW for inputs to the A D converter configure the settings as shown in Figure 4 14 and to use the temperature sensor configure the settings as shown in Figure 4 15 In this explanation the temperature sensor is not used but use of the volume switch is enabled Temperature sensor use 1 or unused 0 define TEMP_SENSOR_USE 0 lt Temperature sensor not used Temperature measurement permission non permission define TEMP_MEASURE_ON 0 lt Temperature sensor disabled define TEMP MEASURE OFF 1 lt vVolume SW enabled Figure 4 12 Operation mode settings when using volume switch Temperature sensor use 1 or unused 0 s define TEMP_SENSOR_USE 1 lt Temperature sensor used Temperature measurement permission non permission define TEMP_MEASURE_ON 1 Temperature sensor enabled define TEMP MEASURE OFF 0 lt Volume switch disabled Figure 4 13 Operation mode settings when using the temperature sensor Note The operation mode settings must be configured not only for main c but also for ADC c and ext_int c 75 FUJITSU AN07 00200 03E As shown in Figure 4 14 Main function program the main functions are around line 165 Port initialization A D converter initialization and external interrupt initialization are contained
14. 21 Extension GND Extension GND terminal Extension power supply pin for the LIN transceiver IC Extension power supply This is used to supply external power 12V 22 12V for LIN transceiver IC When in use it is necessary to set the jumper pin JP1 to 2 3 16 FUJITSU ANO7 00200 03E The system configuration during LIN communication operations which are enabled by connecting the separate bits pot white to Figure 1 3 System connection diagram when performing LIN communication which shows the system configuration during single starter kit operations is shown in Figure 1 2 System connection diagram single unit operation Note Prepare the PC by yourself lj all A UIA Use the USB cable included in the kit for the connection The power is supplied by the USB bus power Figure 1 2 System connection diagram single unit operation Connect the PC and starter kit by using the USB cable included in the kit The starter kit power is supplied by the USB USB bus power Connect the USB to the PC directly Do not connect the USB via a USB hub or an extension unit such as a docking station 17 FUJITSU ANO7 00200 03E Note Prepare the PC by yourself LIN connector accessory _ Toe meos TEDE Figure 1 3 System connection diagram when performing LIN communication Connect the PC the starter kit and bits pot white using the en
15. AN07 00200 03E Finally about the processes according to the ID received there is a vBaseTimeTask function around the 100 line of the main routine This function is called periodically at set cycles and mainly checks whether or not sending and receiving has finished If this function is called when all data has finished being sent i e when flagsLinTxRx bit SucceedReception has been set the submain function is called as the reception completion processing as shown in Figure 5 21 Submain processing and temperature measurement processing buzzer output processing LED ON processing and sent data storage are performed void submain void switch ucCurrentld fields id case 0x00 lt ID 0x00 if acDATA00 0 0x55 IO_ADC2 byte OxCB IO_ADC1 byte 0x71 Start AD interrupt if ad_master lt 42 obtain temperature information IO_PDR1 byte LED_pat2 1 Temperature information LED display Omitted case 0x02 IO_ADC2 byte 0xCB IO_ADC1 byte 0x11 Start AD interrupt obtain VR information IO_PCO00 byte Ox0E Omitted Buzzer output case 0x04 if ucDATA04 0 0x55 amp amp ucDATA04 3 OxFF Omitted Received LED value ON processing else if LED_count_Flag 1 lt If switch 2 is pressed Omitted ucDATA05 3 LED_countl lt LED value stored after count increases else if LED_count_Flag 2 lt If switch 3 is pressed Omitted ucDATA05 3 LED_countl lt LED value stored
16. Figure 2 16 Load module outputs select Project Setup Project from the menu The project settings dialog opens check that Start load module converter is enabled on Converter By enabling this checkbox the load module will be output 0 orkbe D po ello ampleP File Edit view Debug Setup Window Help Active Project gt U RH THR es Ka KE Add Project gt Add Member gt Setup Workspace Setup Project Customize Build Project Dependencies Configuration gt Include Dependencies Compile Make Shift F8 Build Ctrl F8 Stop external I F DLL Setup Project Eg Target of setting C Compiler Assembler Linker Librarian Converter D gt 4 Debug rbsoiute module converter is started BE single operation prj Output Data Format Motorola 5 format f2ms 7 E LIN SLAVE pv P Outputs start message V Control of default option file T Adjust F Start address record output Output file format None X Adjust format Output range Auto Padding data H FF Change Other Option Option Xdof cwno 0 D Documents and Settings uenishi Desktop bits pot yellow_files sample Cancel Apply Figure 2 16 Load module outputs 46 FUJITSU AN07 00200 03E Next configure the debug settings On the same project settings dialog open the Debug tab The
17. Figure 5 8 Entire LIN communication control registers Registers named res cannot be used as they are reserved bits The description of each register and the setting values in the sample programs are described in Table 5 1 Description of the entire LIN communication control registers and setting values For more information of the registers refer to the microcontroller hardware manual LIN UART serial control register bit7 bit6 bit5 bit4 bit3 bit2 bitl bitO SCR PEN P SBL CL AD CRE RXE TXE LIN UART serial mode register bit7 bit6 bit5 bit4 bit3 bit2 bit1 bitO SMR MD1 MDO OTO EXT REST UPCL SCKE SOE LIN UART serial status register bit7 bit6 bit5 bit4 bit3 bit2 bitl bitO SSR PE ORE FRE RDRF TDRE BDS RIE TIE LIN UART data receiving register data send register bit7 bit6 bit5 bit4 bit3 bit2 bitl bitO RDR TDR LIN UART expanded status control register bit7 bit6 bit5 bit4 bit3 bit2 bitl bitO ESCR LBIE LBD LBL1 LBLO SOPE SIOP CCO SCES LIN UART expanded communications control register bit7 bit6 bit5 bit4 bit3 bit2 bitl bitO ECCR res LBR MS SCDE SSM res RBI TBI LIN UART baud rate generator register 1 bit7 bit6 bit5 bit4 bit3 bit2 bitl bitO BGRI LIN UART baud rate generator regist
18. This agreement Agreement is made by and between Fujitsu Microelectronics Limited FML and any person User willing to use this evaluation version of SOFTUNE Professional Pack Evaluation Software a set of support tools for developing application software Application for the microcontrollers manufactured and sold by FML to prescribe the terms and conditions under which User is entitled to try this free of charge Evaluation Software under the laws of Japan Do you accept all the terms of the preceding License Agreement If you choose No the setup will close To install F2MC 8L 8FX Family SOFTUNE ProPack bits pot version you must accept this agreement Shield Figure 1 7 SOFTUNE setup License agreement 23 FUJITSU AN07 00200 03E The dialog shown in Figure 1 8 SOFTUNE setup Version information will be displayed Click the Next button F2MC 8L 8FX Family SOFTUNE ProPack Setup Version information The version of the tools installed with this setup is shown below Contents of this Professional Package REV 300016 BY 2008 09 11 This package is included the following softwares 1 F2MC 8L 8FX Family SOFTUNE Workbench 30L31 BY Customize Bar 01L05 Communication module for EasyCODE 01L03 Communication module for ZIPC YOILO 2 F2MC 8L 8FX Family SOFTUNE C Compiler 30L12 3 F2MC 8L 8FX Family SOFTUNE Assembler Pack REV 300013 lt Back Cancel
19. _ 2 _ _ lt Back Cancel Figure 1 10 SOFTUNE setup Selecting the components The dialog to check the installation settings is displayed as shown in Figure 1 11 SOFTUNE setup Confirming the installation settings Click the Next button The installation begins F2MC 8L 8FX Family SOFTUNE ProPack Setup 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 Current Settings Destination Directory C Softune SOFTUNE Workbench SOFTUNE Workbench Install Customize Bar No Install Communication module for EasyCODE No Install Communication module for ZIPC No Install SOFTUNE C Compiler Install SOFTUNE Assembler Pack Install Figure 1 11 SOFTUNE setup Confirming the installation settings 25 FUJITSU ANO7 00200 03E When the dialog shown in Figure 1 12 SOFTUNE setup Completion appears to tell the completion of installation Click the Finish button F2MC 8L 8FX Family SOFTUNE ProPack Setup InstallShield Wizard Complete Setup has finished installing F2MC 8L 8FX Family SOFTUNE ProPack bits pot version on your computer Tl would like to view the Installation Manual file Figure 1 12 SOFTUNE setup Completion 26 FUJITSU ANO7 00200 03E 1 1 3 Installing the PC Writer FUJITSU FLASH USB Programmer bits pot yellow
20. button and then click the OK button as shown in Figure 2 28 Completing the project settings to finish configuring the project settings Setup Project Target of setting Assembler Linker Librarian Converter Debug Debug z Category Setup X single operation prj LIN SLAVE pri Available Setup Name mon_dbg y Setup Name mon_dbg Browse Setup Name List Change Setup Name emu _dbg A Change Delete Figure 2 28 Completing the project settings 52 IANO7 00200 03E FUJITSU 2 2 2 Writing the monitor program into the microcontroller Preparation To write programs it is necessary to set the MODE SW on the starter kit to PROG in advance Turn OFF the starter kit switch the mode setting to PROG and then turn ON the power supply to the starter kit again To activate the PC writer and select the file to be written as shown in Figure 2 29 Opening the file to write click the Open button uss USB Programmer Target Microcontroller MB95F136 JBS x h mance 008000H Crystal Frequency 4MHe z End Address OOFFFFH Hex File Flash Memory Size 008000H Command Help Full Operation D E B P Download Erase Blank Gheck USB Programmer oO f bits pot Program amp Verify Read amp Compare Copy MB95F136 JBS FUJITSU Figure 2 29 Opening the file to write 53 FUJITSU AN07 00200
21. pot white SW4 is set to the left the buzzer sound is not output This is the bits pot white volume information The A D value VR 0 to 255 starter kit outputs the buzzer sound according to the information A D value received 94 Fo FUJITSU IANO7 00200 03E 4 ID 0x03 byte 0 Reserved byte 1 Reserved byte 2 A D value VR information byte 3 Reserved byte 4 Reserved byte 5 Reserved byte 6 Reserved byte 7 Reserved Field name Setting value Remarks This is the response to the ID 0x02 volume value A D value VR 0 to 255 measurement command The volume information is information sent as A D values 5 ID 0x04 byte 0 LED on off change command byte 1 Reserved byte 2 Reserved byte 3 LED value byte 4 Reserved byte 5 Reserved byte 6 Reserved byte 7 Reserved Field name Setting value Remarks This is the LED on off change command from bits pot LED on off change white If bits pot white SW4 is set to the left 0x55 is 0x55 Start OxOF Stop command received and if the LED value is not OxFF the received LED value is displayed on the starter kit LED This is the value of the LED displayed on bits pot white LED value 0 to 7 otherwise OxFF when OxFF is received the data is invalid 95 Fo FUJITSU IANO7 00200 03E 6 ID 0x05
22. 63 6 bits This is bracketed by a 1 bit starter bit and 1 bit stop bit in the same way as the synchronous byte so overall the field is 10 bits in length 4 Data field The data which is in the response header is a variable length field that literally transfers data The data in the number of bytes that has been predetermined 1 to 8 bytes is sent As there is a 1 bit start bit and 1 bit stop bit bracketing the 1 byte data in the same way as the header synchronous byte 1 byte of data is configured from 10 bits Consequently the total data field length is number of bytes x 10 bites 5 Checksum field The checksum which follows the data is a 10 bit fixed length field for checking data The data recipient checks whether there is an error in the data by comparing the data received with the checksum The checksum field length is also 10 bits a start bit and a stop bit added to the 8 bit checksum in the same way as the synchronous byte 84 FUJITSU AN07 00200 03E 5 3 LIN communication flow In general LIN communication one master communicates with numerous slaves LINs which adopt a bus topology connect the master and all the slaves using a single wire so header electrical signals sent by the master are transmitted by the wire to all the slaves The slaves check the frame ID and if the header is addressed to them sent a response to the master according to the content received If the header received
23. Fo FUJITSU DATA field IANO7 00200 03E This section explains data sending and reception processing in the data field First regarding data sending if the ID received in the ID field is for a send ID the vTimeoutCheckTask function is called by the 8 16 bit complex timer free run timer interrupt as shown in Figure 5 18 Timeout detection processing This function is called when the timeout value set using the free run timer is detected and in this case is called the detection of the timeout values from the header reception to the response sending response space In the vTimeoutCheckTask function processing is separated into pre sending and initialization processing etc according to the status information and if the status is pre sending the first data byte is sent void vTimeoutCheckTask void Omitted if uilIntDemandCounter 0 switch ucLinStatus case case case case case case LIN_PRETRANSMIT ucLinStatus LIN_TRANSMIT ucSaveData ucUartTxBuffer 0 1_ifc_tx ucUartTxBuffer 0 Omitted LIN_UART_INITIAL Omitted LIN_ID_RECEPTION Omitted LIN_DATA_RECEPTION Omitted LIN_TRANSMIT Omitted Status before sending State transition DATA FIELD send status Acquiring 1 byte send data lt Data transmit processing LIN_WAIT_SYNCH_FIELD_START Omitted Figure 5 18 Timeout detection processing 105 Fo FUJI
24. Opening the file to write click the Open button uss USB Programmer Target Microcontroller MB95F1 36 JBS tari Ai ess 008000H Crystal Frequency 4MHe gt Ca d Address OOFFFFH Hex File On n Flash Memory Size 008000H_ Command Help Full Operation D E B P Down load Erase Blank Check USB Programmer foe bits pot Program amp Verify Read amp Compare Copy MB95F136JBS FUJITSU Figure 2 8 Opening the file to write 40 FUJITSU AN07 00200 03E The dialog to select the file to which to write will be displayed as shown in Figure 2 9 Selecting the file to write select the file built in 2 1 1 Building a project and click Open bitspot_yellow_SampleProgram bitspot_yellow_SampleProgram_single chip single_operation Debug ABS single_operation mhx If you built a LIN communication project in Figure 2 6 Building a project select the following file and click Open bitspot_yellow_SampleProgram bitspot_yellow_SampleProgram_single chip LIN_communicatio n Debug ABS LIN_communication mhx Look in G ABS cc EB sinale_operation mhx File name single_operation mhx Files of type s format files mhx cnv ahx Cancel Figure 2 9 Selecting the file to write Click the Full Operation button as shown in Figure 2 10 Writing the program to start writing the program The program writing begins
25. Project Debug Setup Window Help aala Open Ctrl o Save As Save All Print Recent Text File gt Recent Workspace File gt Exit Figure 2 2 Opening a workspace As shown in Figure 2 3 Selecting a workspace the dialog that allows you to select a workspace is displayed Select the folder containing the sample program for single chip select the workspace bitspot_yellow_SampleProgram wsp and then click Open bitspot_yellow_SampleProgram bitspot_yellow_SampleProgram_single chip bitspot_yellow_Sam pleProgram wsp Open Workspace Look in e bitspot_yellow_SampleProgram_single me a OLIN communication single _operation bitspot_yellow_SampleProgram wsp File name bitspot _yellow_SampleProgram wsp Files of type Workspace File wsp 7 Cancel Figure 2 3 Selecting a workspace 37 FUJITSU ANO7 00200 03E As workspace opens set it as the active project In this sample program there are two pre built projects single operation prj and LIN communication prj Set the project to be built to Set as Active Project as projects are built per project basis In this section as single unit operation is described check that single operation is set to the active project as shown in Figure 2 4 Setting the active project e SOFTUNE Workbench bitspot_ File Edit Yiew Project Debug Setup
26. after count decreases default break Figure 5 21 Submain processing 108 Fo FUJITSU 6 Appendix 6 1 Sample program folder file configuration IANO7 00200 03E The folder file configuration of the sample program is shown in Table 6 1 Sample program folder file configuration Table 6 1 Sample program folder file configuration File folder name Provision of the file Single Monitor Explanation bits_pot_yellow_SampleProgram bits_pot_yellow_Samplepr ogram_sing lechip 7 bits_pot_yellow_Sampleprogram_monitordebugger bitspot_yellow_SampleProgram wsp Yes No Softune workspace file singlechip_operation Folder for Single unit operation Debug ABS single_operarion abs Yes Yes Sample program abs file single_operarion mhx Yes Yes Sample program HEX file LST OBJ OPT emu_dbg sup No Yes Emulator debugger file mon_dbg sup No Yes Monitor debugger file include _f2mc8fx h Yes Yes Microcontroller header definition file define h Yes Yes Header definition file extern h Yes Yes External function reference file fgm h Yes Yes Header file for incorporated monitor programs mb95130 h Yes Yes Microcontroller header file source fgm_cfg asm Yes Yes Monitor operation definition file startup asm Yes Yes Microcontroller startup assembler file ADC c Yes Yes A D convert
27. e eee eeeeeee eee ee teeta 77 Figure 4 16 SW3 interrupts buzzer output processing eee cee reer creer e eee e teeta 77 Fig re 4 17 A D converter Interrupts vorerst or fonction eed 78 Figure 5 1 Example of vehicle LIN applications c ccc cece e eee eeeeeeeeeee eee ee eee 80 Figure 5 2 Main LIN network configuration 0 cere eee enna errr neeeeneee neater 81 Figure 5 3 LIN communication flow 0 0 0 0 eee erence eee ee ee anneanne anneni 83 Figure 5 4 LIN frame Configuration sissioni ti eet ete ets 83 Figure 5 5 Main LIN network configuration 0 i eccrine rere eeeneeaeeeeee teenie 86 Figure 5 6 Example of communication sequence between the master and slaves during normal COMMUN CAU ON aa vees existe E 86 Figure S 7 EIN CitCuit sesssectcectciseeetscactoncbcvsiesobsecteicievsbbesiencelictevehbvsiueceliciesshavstnssniisiecnanedens 88 Figure 5 8 Entire LIN communication control registers 00 ccs errr teen e ee ee teeta 89 Figure 5 9 LIN communication flowchart main routine eeen 97 Figure 5 10 LIN communication flowchart interrupt routine UART reception interrupts 98 Figure 5 11 LIN communication flowchart interrupt routine input capture interrupts 98 Figure 5 12 Operations points of interrupt ProCesses cc cece eee eee e ee eeeeeeee eee eeeeeniee 99 Figure 5 13 Synch break interrupt control 0 eee e enna eee ereeenee enna eee 100 Figure 5 14 Input capture operation in
28. is addressed to another slave it is ignored In this way 1 to 1 communication between the master and each slave is achieved This section explains the actual trading of communications Currently functions are allocated to each of the slaves from to 15 The master first communicates with slave and turns the motor 1 in Figure 5 5 Main LIN network configuration and Figure 5 6 Example of communication sequence between the master and slaves during normal communication and next acquires sensor information by communicating with slave 3 2 in Figure 5 5 Main LIN network configuration and Figure 5 6 Example of communication sequence between the master and slaves during normal communication Thereafter the motor is turned by communications with slave 2 3 in Figure 5 5 Main LIN network configuration and Figure 5 6 Communications sequence between master and slave during normal communications The master acquires sensor information from slave 3 again 4 in Figure 5 5 Main LIN network configuration and Figure 5 6 Communications sequence between master and slave during normal communications and finally turns ON the lamp by communicating with slave 15 5 in Figure 5 5 Main LIN network configuration and Figure 5 6 Communications sequence between master and slave during normal communications In this chain of communications communications between the master and slaves 2 and 3 are contiguous and the master processes the motor turning by communi
29. steps and handled as internal signals In this sample program the size of the applied voltage is obtained using an A D converter and the buzzer sound changes according to this value 70 FUJITSU AN07 00200 03E Next here explains how to output buzzer sounds An element called a piezoelectric element is used in the buzzer Piezoelectric elements are elements that use the piezoelectric effect and which use materials that create a voltage when shock or pressure are applied piezoelectricity or conversely which use materials with properties that create a distortion in the crystal configuration when a voltage is applied reverse piezoelectricity As shown in Figure 4 8 Piezoelectricity piezoelectric elements have the property of expanding when a voltage is applied in the direction of polarization the direction of the green arrows and contracting when a voltage is applied in the opposite direction to polarization the opposite direction from the green arrows Expansion Contraction Figure 4 8 Piezoelectricity Consequently as shown in Figure 4 9 Principle of piezoelectric elements when an AC voltage is applied the crystals repeatedly expand and contract each time the direction of the voltage alternates By changing the frequency of the AC voltage the speed of the crystal contraction and expansion also changes If this property is used skillfully the crystal can be vibrated at various frequencies If th
30. the Install button Pu 4 s ig FUJITSU FLASH USB Programmer bits pot MB95F136JBS InstallShield Ready to Install the Program The wizard is ready to begin installation Click Install to begin the installation TF you want to review or change any of your installation settings click Back Click Cancel to exit the wizard Figure 1 15 Finished PC writer Ready to install 28 FUJITSU ANO7 00200 03E After the installation complete the dialog shown in Figure 1 16 Completing the PC Writer installation appears to tell the completion of installation Click Finish ie FUJITSU FLASH USB Programmer bits pot MB95F136JBS InstallShield InstallShield Wizard Completed The InstallShield Wizard has successfully installed FUJITSU FLASH USB Programmer bits pot MB9SF136JB5 Click Finish to exit the wizard Cancel Figure 1 16 Completing the PC Writer installation This completes the PC writer installation 29 Fo FUJITSU IANO7 00200 03E 1 1 4 Connecting it to the PC and installing the USB driver Connect the starter kit to the PC and install the USB drivers First connect the USB port on the PC and the USB port on the starter kit using the enclosed USB cable Whereupon the BGM Adapter MB2146 09 installation dialog is displayed as shown in Figure 1 17 Installing BGM Adapter MB2146 09 Select Install from a list or specific location and click
31. the Next button Found New Hardware Wizard Welcome to the Found New Hardware Wizard This wizard helps you install software for USB Device If your hardware came with an installation CD S lt or floppy disk insert it now What do you want the wizard to do Install the software automatically Recommended Install from a list or specific location Advanced Click Next to continue Figure 1 17 Installing BGM Adapter MB2146 09 30 FUJITSU AN07 00200 03E To search for the installation file as shown in Figure 1 18 Selecting the search locations check the Search for the best driver in these locations and Include this location in the search Further click the Browse button and select the Drivers folder in the SOFTUNE which has already been installed and then click the Next button Found New Hardware Wizard Please choose your search and installation options Fate Y gt Search for the best driver in these locations Use the check boxes below to limit or expand the default search which includes local paths and removable media The best driver found will be installed gt Search removable media floppy CD ROM Include this location in the search l C Softune Drivers Don t search will choose the driver to install Choose this option to select the device driver from a list Windows does not guarantee that the d
32. the LIN communication as shown in Figure 2 5 Changing the active project and then right click and select Set as Active project from the sub menu After setting the active project click Project Build from the menu as shown in Figure 2 14 Building a project to build it 44 fo FUJITSU File Edit View SaGa Baloo ESEA SOF TUNE Workbench bitspot_yellow_SampleP Debug Setup Window Help Active Project Add Project Add Member Setup Workspace Setup Project Customize Build Project Dependencies Configuration Include Dependencies Compile Make Build Stop Shift F8 Ctrl F8 E E Do H E LIN communication abs external I F DLL Figure 2 14 Building a project ANO7 00200 03E The message pane at the bottom of the screen displays the message as shown in Figure 2 15 Completing the build to notify you that the build has been completed successfully Figure 2 15 Completing the build 45 D Documents and Settings uenishi Desktop bits pot yellow_files sample program bitspot_yellow_SampleProgram bitspot_yellow_SampleProgram_monita Now starting load module converter D Documents and Settings uenishi Desktop bits pot yellow_files sample program bitspot_yellow_SampleProgram bitspot_yellow_SampleProgram_monita FUJITSU ANO7 00200 03E Next configure the load module output settings As shown in
33. the debugger type select Monitor Debugger and then click the Next button Setup Wizard Please select debug type Debug Type Emulator Debugger Simulator Debugger Monitor Debugger lt Back Finish __ Cance Figure 2 20 Selecting the debugger type 48 FUJITSU AN07 00200 03E Enter the password as shown in Figure 2 21 Entering password when starting debugger Keep the default settings and then click the Next button Setup Wizard Please enter the password for the start of the debugger Password lt Back Finish Cancel Figure 2 21 Entering password when starting debugger Select the device type as shown in Figure 2 22 Selecting the device type Check that USB has been selected in the device name and click the Next button Setup Wizard Please select device type y Type Device Name v _ cmoa Figure 2 22 Selecting the device type 49 FUJITSU AN07 00200 03E Set the frequency as shown in Figure 2 23 Setting the primary oscillation frequency Set to D 4 4MHz frequency setting and click the Next button Setup Wizard It sets up about communication Please set your original oscillation frequency to be used Set up original oscillation frequency frequency Main E MHz lt Back Cancel Figure 2 23 Setting the primary oscillation frequency Specify nothing to the b
34. the monitor program Do not single step thorough within API FGM_WDTON process Debugger limits The initial values for the SP register changes The startup time changes after the reset cancellation Forced breaks are disabled when UART SIO interrupts are prohibited The response time of clock 2 system products with sub clock inputs is lengthened Code breaks are disabled during step in operations Add four bytes to the stack area for the monitor program Make sure to combine use with the flash security function also Use the flash programmer when changing the password A reset occurs after an object has been loaded 59 FUJITSU AN07 00200 03E 3 Operation of the sample Programs This section describes the operation of the sample program The operation of the sample programs is classified into the following two categories bits pot yellow single unit operation LIN communication operation LIN communication operation with the bits pot white 60 FUJITSU ANO7 00200 03E 3 1 bits pot yellow single unit operation Explanations of the operation and control parts as shown in Figure 3 1 Single unit operation Controls and mechanicals are described in Table 3 1 Single unit operation Descriptions of the controls and mechanicals The LEDs red and buzzer are controlled by SW 2 SW 3 volume switch and temperature sensor on the starter kit 8 LEDs red 7 Buzzer 1 Mode SW 2 Re
35. the starter kit as shown in Figure 4 1 Single unit operation Switches and LEDs and connected to the microcontroller respectively This section explains how to turn ON and OFF the LEDs using SW2 operations SW2 LED Figure 4 1 Single unit operation Switches and LEDs First describes how to control turning ON the LEDs using the microcontroller The LEDs and microcontroller of the bits pot yellow are connected as shown in Figure 4 2 LED lighting circuit This is shown diagrammatically in Figure 4 3 LED ON OFF circuit example schematic diagram When the LED is OFF as shown in Figure 4 3 a pin P14 outputs are high so current does not flow to the LED and the LED remains OFF When the LED is ON as shown in Figure 4 3 b pin P14 outputs are low so current flows to the LED and the LED turns ON The switches of the microcontroller can be switched using the program that controls the microcontroller 65 FUJITSU ANO7 00200 03E MB95F136JBS LED4 SML 210LT R19 3 3kQ Ss LEDS SML 210LT R20 3 3kQ LED6 SM Sour R21 3 3kQ Figure 4 2 LED lighting circuit LED ON a LED OFF b LED ON Figure 4 3 LED ON OFF circuit example schematic diagram The pin P14 is controlled by the PDR1 register and the DDR register If using the ports as outputs write the value to be output to the bit corresponding to the pins in the PDR1 register 0 Low 1 High and write 1 to th
36. this product Pressing OK will begin the installation Pressing Cancel will terminate the installation and display the INSTALLATION MANUAL Release Note csi Figure 1 4 SOFTUNE setup confirmation The setup wizard shown in Figure 1 5 Starting SOFTUNE setup will be displayed Click Next F2MC 8L 8FX Family SOFTUNE ProPack Setup Welcome to Setup The InstallShield Wizard will install F2MC 8L 8FX Family SOFTUNE ProPack bits pot version on your computer To continue click Next Figure 1 5 Starting SOFTUNE setup 22 FUJITSU ANO7 00200 03E The dialog shown in Figure 1 6 SOFTUNE setup confirmation will be displayed Click the Next button F2MC 8L 8FX Family SOFTUNE ProPack Setup CAUTION This is the F2MC 8L 8FX Famly SOFTUNE Professional Pack bits pot version If you would like to know more about SOFTUNE products or services please contact your nearest Fujitsu Microelectronics office Figure 1 6 SOFTUNE setup confirmation The dialog shown in Figure 1 7 SOFTUNE setup License agreement will be displayed Read the license agreement thoroughly and then click the Yes button F2MC 8L 8FX Family SOF TUNE ProPack Setup License Agreement Please read the following license agreement carefully Press the PAGE DOWN key to see the rest of the agreement Woreement on Use of Evaluation Software for Supporting FUJITSU Microcontrollers Notes to User
37. uss USB Programmer Target Microcontroller MB95F136 JBS Stat Aides 008000H Crystal Frequency 4MHz z End ddress em OOFFFFH Hex File single_operation mhx Flash Memory Size 008000H Command Help Full Operation D EL BP Down load Erase Blank Check USB Programmer p bits pot Program amp Verify Read amp Compare Copy MB95F136 JBS FUJITSU Figure 2 10 Writing the program 41 FUJITSU AN07 00200 03E The dialog shown in Figure 2 11 Completing the program writing is displayed to notify you that the program writing has been completed Click the OK button to quit the PC writer l Full Operation OK Figure 2 11 Completing the program writing Switch the MODE SW on the starter kit to RUN and then press the Reset button the program starts running 42 FUJITSU ANO7 00200 03E 2 2 Debugging by using Monitor Debugger To debug by using Monitor Debugger take the following procedures Activating SOFTUNE and configuring the debug settings Writing the program into the microcontroller including monitor programs Loading the target file OONO Running the debugger 2 2 1 Activating SOFTUNE and configuring the debug settings Preparation Decompress the following file in the folder you decompressed in 1 1 1 Downloading the software in advance sample program bitspot_yellow_SampleProgram zip From Windows s
38. 03E The dialog to select the file to which to be written is displayed as shown in Figure 2 30 Selecting the file to write so select the file built in 2 2 1 Activating SOFTUNE and configuring the debug settings and click the Open button bitspot_yellow_SampleProgram_monitor debugger single_operation Debug ABS single_operati on mhx If you built a LIN communication project in 2 2 1 Activating SOFTUNE and configuring the debug settings select the following file and click the Open button bitspot_yellow_SampleProgram_monitor debugger LIN_communication Debug ABS LIN_com munication mhx Look in O ABS z e a e File name single_operation mhx Files of type s format files mhx cny ahs Cancel Figure 2 30 Selecting the file to write 54 FUJITSU AN07 00200 03E Click the Full Operation button as shown in Figure 2 31 Writing the program to start writing The program writing begins uss USB Programmer Target Microcontroller MB95F136 JBS Staran 008000H Crystal Frequency 4MHe gt End Address OOFFFFH Hex File single_operation mhx i Size 008000H Command gt Help Full Operation D E B P Download Erase Blank Check USB Programmer foe p bits pot Program amp Verify Read amp Compare Copy MB95F136JBS FUJITSU Figure 2 31 Writing the program The dialog shown in Figure 2 32 Completing the p
39. 11 IANO7 00200 03E Fo FUJITSU Suppliers of the parts materials Capacitors 22pF 220pF 0 luF 10uF Ceramic Resonator 4MHz 6MHz Buzzer TDIK NTC Thermistor Ferrite Beads GCM1552C1H220JZ02 GCM1552C1H221JAO1 GCM188RITE104KA42 GCM32ER71E106KA42 CSTCR4M00G55B CSTCR6M00G55B PKLCS1212E40A1 NTCG164BH103JT1 MPZ2012S300AT IANO7 00200 03E Fo FUJITSU 1 AN07 00200 03E Setting up the starter kit Before using this starter kit be sure to check the components listed in Table 1 1 are fully supplied Before connecting this starter kit you need to install software in your PC You can download the software required for the starter kit from our web site bits pot URL http www tsuzuki densan co jp bitspot Table 1 1 Component list No Article Qty Specifications Remarks 1 bits pot yellow 1 Board mounted with microcontrollers made by See Figure 1 1 LIN board Fujitsu Semiconductor F MC 8FX series MB95F136JBS and F MC 8LX series MB89P585B 2 USB cable 1 USB A to miniB Accessory a wa 3 LIN cable 1 2 pin cable Accessory 4 PC 1 On which Windows XP normally runs and Prepare the PC by USB2 0 ports are supported yourself FUJITSU ANO7 00200 03E 14 LIN transceiver IC 13 Regulator 19 Jumper pin 12 LIN connecto 11 USB connector 22 LIN transceiver IC Extension power 12V
40. 20 Extension power 5V 21 Extension GND 10 Power LED lamp hermistor NICGIES CHIP BEADS MPZ20 STDK 1 Target device 15 Reset IC 16 Oscillator for USB communication microcontroller nae ww ar SS 33 o a Sc aw 18 Extension pins 17 Target device oscillator 2 USB communication microcontroller 9 Buzzer 3 Mode SW 4 Reset SW 8 Volume switch 5 Test SW 6 Temperature sensor 7 LED lamps Figure 1 1 External view of a starter kit 14 Fo FUJITSU IANO7 00200 03E Table 1 2 Description of the respective parts of a starter kit provides descriptions of the respective onboard parts Table 1 2 Description of the respective parts of a starter kit No Name Specifications Function 1 Target device MB95F136JBS Main microcontroller MB95F136JBS Microcontroller for USB communications to connect USB communication 2 MB89P585B the main microcontroller MB95F136JBS and the host microcontroller PC Switch for selection of operation mode of the main 3 Mode SW Slide switch microcontroller MB95F136JBS 4 Reset SW Push switch Switch to reset the starter kit Push switches for testing connected to the 5 Test SW Push switch x 2 general purpose I O port NTC thermistor made by TDK 6 Temperature sensor NTCG164BH103 Temperature sensor connected to the A D converter 7 LED lamps LED red x 3 LED lamps co
41. 38 FUJITSU ANO7 00200 03E Click Project Build from the menu as shown in Figure 2 6 Building a project to build the project SOFTUNE Workbench bitspot_yellow_SampleProgram File Edit view ise Debug Setup Window Help Active Project b Add Project gt Add Member gt Setup Workspace Setup Project Customize Build Project Dependencies Configuration gt Include Dependencies Sompile Shift F8 Figure 2 6 Building a project The message pane at the bottom of the windows shows the message as shown in Figure 2 7 Completing the build to notify you that the build has been completed successfully Now starting load module converter D Documents and Settings uenishi Desktop bits pot yellow_files sample program bitspot_yell JIL Figure 2 7 Completing the build 39 FUJITSU AN07 00200 03E 2 1 2 Writing the program into the microcontroller Preparation To write the program it is necessary to set the Mode SW on the starter kit to PROG in advance Turn OFF the starter kit switch the mode setting to PROG and then turn ON the power supply to the starter kit again From the Windows start menu click All Programs FUJITSU USB PROGRAMMER MB95F136JBS to activate the PC writer To select the file to be written as shown in Figure 2 8
42. C30 bit EIRO 0 IO_PC00 byte Ox0E lt PPG timer output setting IO_PPGS byte IO_PPGS byte lt PPG timer start stop Figure 4 16 SW3 interrupts buzzer output processing 77 FUJITSU AN07 00200 03E The A D conversion is started in the A D converter initialization function Thereafter when the A D conversion is finished an A D converter interrupt is created as shown in Figure 4 17 A D converter interrupts Here the A D conversion values are acquired from the Volume SW or temperature sensor If using the SW the PPG timer cycle and duty changes are implemented using the A D conversion values that have been acquired to change the sound of the buzzer If using the temperature sensor the temperature is displayed according to the A D conversion values acquired __ interrupt void ad_int void IO_ADC1 bit ADI 0 ad IO_ADD byte ADDL Acquire A D conversion value if TEMP_MEASURE_OFF lt If using Volume SW if ad lt 51 IO_PPS00 OxFA 10_ PDS00 0x7D Change interval else if ad lt 102 Omitted else if TEMP_MEASURE_ON lt If using temperature sensor if ad lt 66 IO_PDR1 bit P14 0 TO_PDR1 bit P15 1 Change LED display IO_PDR1 bit P16 0 Omitted IO_ADC1 bit AD 1 Start A D conversion Figure 4 17 A D converter interrupts 78 FUJITSU AN07 00200 03E 5 Try to use LIN communication Communication is to send receive information Th
43. It may take several minutes for the monitor debugger to load 56 Fe FUJITSU IANO7 00200 03E 2 2 4 Running the debugger As shown in Figure 2 34 Setting break points you can set break points to where green round mark is located which is shown on the left side of lines in the source file A maximum of only two break points can be set Note that you cannot set break points while the program is running 1 AGOGO OOOO OOOO amp initialized external_int 1 ROORKEE void initial_external_int void void adInitial ize void IG_AIDRL 0x60 Analog input valid if TEMP_MEASURE_ON THI useing glides 0x71 ANO setting YR1 useing x MP_MEASURE_OFF Ox115 ANOT setting 10_ADC2 byte 0xCB INT valid 8bit A D ROOK Click this to set a break point Init IraLevels To cancel the break point click this again TO_DORO bit PO5 0 x IOLDDRO bit P06 0 INTO6 PortP06 input setting IQLEIC20 bit EIE 0 INTOS interrupt enable clear IQLEIC30 bit EIEO 0 x INTO6 interrupt enable clear IQ_EIC20 byte IQLEIC30 byte 0x33 x INTOS rising edge x Ox33 x INTOS rising edgex a Mepscicctccccecceccectcrrceccesccetertccrcescectortcerceccescortcrrcccceccerccsrce sd fk Main funct ion L Food COOSA CSOSA COS SOOO ORO RARE fan Pay REEREEAAE BRERA ARERE y initialized LRRERTERAEEEE RREKRTERATRAAE 7
44. TSU IANO7 00200 03E When sending the first data byte a reception interrupt is created by receiving the self sent data Whereupon the reception judgment processing function _ifc_rx 1_ifc_handle rx_data is called in the same way as for ID field operations and the data is sent from the second byte onwards according to the data field send status as shown in Figure 5 19 Data send processing and the same process is repeated In these LIN communication the number of data bytes is set to 8 so when the eighth data byte has finished being sent finally a checksum is sent and the send processing ends lt If any send data is remaining lt Send processing lt If send data has all been sent Check sum send processing void 1_ifc_rx 1_ifc_handle rx_data switch ucLinStatus case LIN TRANSMIT lt DATA FIELD send status if ucTxCurrentIndex lt ucTxCount Omitted 1_ifce_tx ucUartTxBuffer ucTxCurrentIndex Omitted else if ucTxCurrentIndex ucTxCount Omitted 1_ifc_tx unsigned char uiTxCheckSum Omitted case LIN_DATA_RECEPTION Omitted case LIN_ID_RECEPTION Omitted case LIN_WAKEUP_TRANSMIT Omitted Figure 5 19 Data send processing 106 FUJITSU AN07 00200 03E The next section explains data reception processing If the ID acquired using ID reception processing is for reception the status is migrated to data reception status and data r
45. Table 5 2 LIN communication conditions of the sample program Condition Setting value Baud rate 2400 9600 default value 19200bps Peripheral clock frequency 16MHz Synch break length 13 bits Receive is fixed to detect 11 bits Data length 8 bits Data bit format LSB first Data byte count 8 bytes Next this section explains message IDs using LIN communication as described in Table 5 3 LIN message IDs in the sample program Table 5 3 LIN message IDs in the sample program Communication ID Description direction Temperature measurement command temperature 0x00 white yellow display command white yellow 0x01 Temperature sensor information white lt yellow Buzzer output command volume value 0x02 white yellow measurement command white yellow 0x03 Volume VR information white yellow 0x04 LED ON change command count up count down white yellow white yellow 0x05 LED value white lt yellow 92 Fo FUJITSU The details of each ID are explained below IANO7 00200 03E 1 ID 0x00 Temperature measurement byte 0 command A D value temperature byte 1 sensor information byte 2 Reserved byte 3 Reserved byte 4 Reserved byte 5 Reserved byte 6 Reserved byte 7 Reserved Field name Setting value Remarks Temperature measurement command 0x55 Start OxOF S
46. are shown below The sample software operates as a LIN slave through multiple interrupt processes as shown in Figure 5 12 Operations points of interrupt processes Look at the processing of the sample software in the LIN frame fields or i j 1 up t Input capture interr Data reception interrupt eee s L ata 1 Data reception interrupt Data reception interrupt Data reception interrupt Figure 5 12 Operations points of interrupt processes Sync break In sync breaks the sync break signals 13 tol6 bit Low signals are received from bits pot white the master and when the bus reaches 0 in the 11 bit time or greater a sync break interrupt is created When a sync break interrupt is detected the sync break interrupt prohibition settings and input capture interrupts are authorized and the system migrates to waiting for the synch field to start 99 FUJITSU AN07 00200 03E __ interrupt void _LinUartRx void if ssr amp OxEO 0 Error check Omitted else if ESCR_LBD SET lt Synch break detection ESCR_LBD CLEAR lt Clear synch break detection flag Omitted vSetLinFreerunTimersCompare hTHEADER_MAX_IND eee timer FRT ucLinStatus LIN_WAIT_SYNCH_FIELD_START State transition omided Wait synch field start TOOCRI1_IE SET Input capture interrupt enabled Figure 5 13 Synch break interrupt control S
47. as been acquired is judged to be either a send ID or reception ID and parity check performed and if it is a send ID the status is migrated to send preparation status and the data to be sent is copied to the buffer If the ID is a reception ID the status is migrated to data reception wait status and a response data is received from the master 103 FUJITSU ANO7 00200 03E void 1_ifc_rx 1_ifc_handle rx_data switch ucLinStatus case LIN_TRANSMIT lt DATA FIELD send status Omitted case LIN DATA RECEPTION DATA FIELD receive status Omitted case LIN_ID RECEPTION ID FIELD reception wait status ucCurrentld byte 1x_data Store received ID if ucCurrentld fields parity ucRightParity ucCurrentld fields id Parity check Omitted lt Error processing else if LinRxDataPtr ucCurrentId fields id 0 lt If ID received ucLinStatus LIN DATA RECEPTION State transition DATA reception Omitted wait status vSetLinFreerunTimersCompare ucRxCount 8 16bit complex timer set else if LinTxDataPtr ucCurrentld fields id 0 ucLinStatus LIN PRETRANSMIT Omitted es l Copy send data to buffer vLinWordCopy ucUartTxBuffer LinTxDataPtr ucCurrentld fields id ucTxCount vSetLinFreerunTimersCompare hTINFRAME_SPACE_IND 8 16bitcomplex timer set Omitted case LIN _WAKEUP_TRANSMIT lt WAKEUP send status Omitted Figure 5 17 Receive determination processing 104
48. atch file field as shown in Figure 2 24 Specifying a batch file keep the field left blank and click the Next button Setup Wizard Setting batch file for just after the start of the debugger Specification batch file Batch file Browse lt Back Finish Cancel Figure 2 24 Specifying a batch file 50 FUJITSU ANO7 00200 03E Enable the Auto load when starting debug checkbox as shown in Figure 2 25 Configuring the target file settings and click the Next button Setup Wizard Make settings for the target file tuto load when starting debug Specification batch file before after load Before Browse afte _ Browse rin Cows Figure 2 25 Configuring the target file settings Select Specification for setup file selection as shown in Figure 2 26 Setting setup file selection and click the Next button Setup Wizard Select item on setup file Select setting item C Select All Specification Specification rin ce Figure 2 26 Setting setup file selection 51 FUJITSU AN07 00200 03E When all the settings have been completed as shown in Figure 2 27 Completing the setup wizard click the Finish button Setup Wizard Settings will be completed when you click finish Figure 2 27 Completing the setup wizard When the debug settings have been completed click the Apply
49. ation operation Controls and mechanicals cccceee eee 63 Figure 4 1 Single unit operation Switches and LEDS 0c ccc eee e eee e eee e eee 65 Figure 4 2 VED lighting Circuit os cst seh ee o r eaa a ees 66 Figure 4 3 LED ON OFF circuit example schematic diagram 00 ceeeeeeee eee ee eee 66 Figure 4 4 Connection configuration between SW2 and microcontroller pins schematic diadora ss eas cnc van Soa ene 67 Figure 4 5 Single unit operation Volume SW ccccc eee ener ee eeeeeeneee neater 69 Figure 4 6 Volume SW variable resistor 00 cece eee eee e reece esas eee eeneeeeaeeeeee teeta 69 Figure 4 7 Circuit surrounding the voltage adjustment knob cc ccc eterna eee 70 Figure 428 Pjezoelectricitys sirtni atai teta ia t kh 71 Figure 4 9 Principle of piezoelectric elements ssssnnsessseserrrrrrrrssrrrrrrnrrrssrrrrerrnnrrserrrrenn 72 FUJITSU AN07 00200 03E Figure 4 10 peripheral circuit diagram for temperature Sensor ccc e eee eee tere 73 Figure 4 11 Single unit operation flowcharts eee e eter ee neneenee ee eee eet 74 Figure 4 12 Operation mode settings when using volume switch 0 ieee etree 75 Figure 4 13 Operation mode settings when using the temperature sensor 0 ee 75 Figure 4 14 Main function program eccrine errr eeecee eee eee ee eeeceeaeeeeeeeeetae 76 Figure 4 15 SW2 interrupts LED on off processing 0 0 ccc eee ene
50. byte 0 Reserved byte 1 Reserved byte 2 Reserved byte 3 LED value byte 4 Reserved byte 5 Reserved byte 6 Reserved byte 7 Reserved Field name Set value Remarks LED value 0 to7 This is the value of the LED displayed on the starter kit 96 FUJITSU AN07 00200 03E 5 6 2 Sample programs sequence The LIN communication flowcharts for the sample programs are shown in Figure 5 9 LIN communication flowchart main routine and Figure 5 10 LIN communication flowchart interrupt routine UART reception interrupts First initialize the microcontroller LIN UART and timer Next implement LIN bus connection processing as a LIN slave Thereafter the program enters a loop Within the loop monitor whether the data being sent and received can be completed in a fixed cycle and when the data has finished being received implement processing according to the ID Synch break detection ID reception and data sending and receiving to operate as a LIN slave is processed using LIN UART reception interrupts Further the baud rate is adjusted within the input capture interrupts as described in Figure 5 11 LIN communication flowchart interrupt routine input capture interrupts START Initialize microcontroller Initialize LIN UART Initialize timer Process LIN bus connection Infinite loop Figure 5 9 LIN communication flowchart main routi
51. cating with slave 2 using sensor information acquired by communicating with slave 3 first In this way during actual communications the master and multiple slaves repeatedly communicate on a 1 to 1 basis 85 FUJITSU AN07 00200 03E Slave 1 Slave 2 Slave 15 Sensor Transceiver IC electronic component for sending and receiving data Figure 5 5 Main LIN network configuration operation All communications start from the master Acquiring sensor E information F i Acquiring ee sensor Figure 5 6 Example of communication sequence between the master and slaves during normal communication 86 FUJITSU AN07 00200 03E 5 4 Communication between master and slave if an error occurs LIN error processing is not determined by the protocols and so depends on the application Consequently during design it is necessary to consider the error detection methods and the process after the error has been processed As this is not determined by the protocols in the LIN specifications either however examples of system design if an error occurs are introduced in the chapter Status Management In the examples introduced errors are managed by slaves reporting their own status to the master This mechanism is described below The basic master operation is merely to send the header to the next slave when communications with the current slave have ended On the other hand
52. cecncttiside hectic ciecthbestentehciecchiesevnsciicneccheserscenieerhiiees 28 Figure 1 15 Finished PC writer Ready to install 00 ee eee e reer reece eee e eee eti 28 Figure 1 16 Completing the PC Writer installation cece reer ence e eee ee teenie 29 Figure 1 17 Installing BGM Adapter MB2146 09 cece e errr rece e enna ee eenae 30 Figure 1 18 Selecting the search locations srsti nnt tt 31 Figure 1 19 Hardware installation 0 0 0 0 eee eee e erence ee eee ee eeennceeaeeeeee teeta 31 Figure 1 20 Completing the BGM Adapter MB2146 09 installation eee 32 igure 1 21 MODE Select Otis sis saeccsivies vec cast vert vaveeee vas evecare sats eee 33 Figure 1 22 Connection between the PC and the starter kit eee eee eee e eee e eee 34 Figure 2 1 SOFTUNE Workbench start WindOW eee cette eee eee e reer eeeeeee eee e erent 36 Figure 2 2 Opening a Workspace 0 0 0 eee eee e nee e eee ee ee akaki 37 Figure 2 3 Selecting a workspace s c cssssssesssgctensnessaeeshaeesstsnensaevsaaneecesnenvaneseseeesesneneenevess 37 Fisure 2 4 Setting the active projectiscsei cc aec veneer a chiens 38 Figure 2 5 Changing the active project 0 0c eee eee eee e eens Naai aeiaai aa N E 38 Figure 2 6 Building a project 0 0 00 da tnua inaani naana annas A natina iae asiwa Sadina 39 Figure 2 7 Completing the Dulder eE 39 Figure 2 8 Opening the file to Write sscotecccisaes sadeccencievsaevsvieecenseerenaesebecusnn
53. cedure described below Consequently using this method it is possible to detect when SW2 is turned ON using an interrupt 1 Write 1 to AIDRL bit 5 and make the settings so that the P5 pin on port 0 is used as the input port 2 Write 0 to DDRO bit 5 and set SW2 to inputs 3 Set EIC20 bit 4 to 0 This prohibits INT5 interrupts 4 Set EIC20 bit 5 to 1 and bit 6 to 0 Set so that an external interrupt is created when 67 Fo FUJITSU the rising edge is detected 5 Set EIC20 bit 5 to 1 This permits INTS interrupts 68 IANO7 00200 03E FUJITSU ANO7 00200 03E 4 1 2 Controlling the buzzer using the volume switch This section introduces processing to change the buzzer sound according to changes in the digital signal converted from the analog signals input into the microcontroller By Volume SW operations the analog signals input into the microcontroller is converted to digital using an A D converter and acquire them as digital signals internally Further the A D converter is a function that separates and converts analog values to digital values using standards based on certain rules In addition this function is built into the microcontroller and the conversion process is called A D conversion In the starter kit the voltage values applied to the analog pins for A D conversion can be controlled using the volume switch which is built into the starter kit A
54. closed USB cables The power for the bits pot white is also supplied by the USB in the same way as for the starter kit USB bus power Note Connect the USB to the PC directly Do not connect the USB via a USB hub or an extension unit such as a docking station 18 FUJITSU AN07 00200 03E Table 1 3 MB95F136JBS pin assignment shows the pin assignment for the microcontroller MB95F136JBS Table 1 3 MB95F136JBS pin assignment IL output On Q1 4MHZz oscillator Ql 4MHz oscillator GND_EARTH SV 12 RST RESET 13 AVCC SV 14 AVSS GND_EARTH 15 POO INT00 ANO00 PPGO00 BUZZER 16 POI INTO1 ANO1 PPGO1 VR ie ey ene ivision 0 to 100 17 PO2 INT02 AN02 SCK LIN TRANSCEIVER 18 P03 INT03 AN03 SOT LIN TRANSCEIVER 19 NC z 20 P04 INT04 AN04 SIN LIN TRANSCEIVER 21 PO5 INT05 AN05 TO00 SW2 W pressed L 22 P06 INT06 AN06 TO01 SW3 W pressed L 23 P07 INT07 AN07 THERMISTOR se when writing to flash USB UART conversion 24 P10 UI0 r during monitor MB89P585B ebugging se when writing to flash USB UART conversion 25 P11 U00 r during monitor MB89P585B ebugging Fo FUJITSU USB UART conversion IANO7 00200 03E se when writing to flash 27 P12 UCKO0 ECO r during monitor MB89P585B i ebugging 28 P13 TRG0 ADTG PULL DOWN 29 P14 PPGO LED4 IL output On 30 P15 LEDS IL output On
55. d configure the Mode switches on the starter kit and then connect it to the PC If the starter kit and the PC are connected by USB i e power is being supplied disconnect the USB temporarily to turn the power OFF Next set the starter kit MODE selector to PROG as shown in Figure 1 21 MODE selection Set the MODE selector to PROG Figure 1 21 MODE selection MODE Selector Operation mode PROG Flash memory serial write mode Used to write a program into the microcontroller RUN Single chip mode Used to run the program written into it Make sure that the MODE selector is set to PROG Then connect it to the PC 33 FUJITSU ANO7 00200 03E After setting the MODE selector connect the USB port on the PC and the USB port on the starter kit using the USB cable included in the kit Be sure to connect the PC and starter kit directly without using a USB hub Connect to the USB port on the PC For information about port locations and so forth refer to the manual of the PC Connect using the USB cable included in the kit Figure 1 22 Connection between the PC and the starter kit The power of the starter kit is supplied via USB USB bus power Note When connecting the PC and starter kit if the driver installation dialog is displayed it is possible that the USB driver has not been installed correctly Return to 1 1 4 Connecting it to the PC a
56. debug settings dialog opens as shown in Figure 2 17 Debug settings Setup Project Target of setting Assembler Linker Librarian Convert amp _Debua gt 4 gt Debug I categoy 7 single operation prj E LIN SLAVE prj Alias File ld Other Parameter ee aoo OK Cancel Apply Figure 2 17 Debug settings Change the category from General to Setup and select mon dbg from the setup name list In the setup name mon_dbg is entered as shown in Figure 2 18 Changing the debug settings Here click the Change button to change the settings The setup wizard activates Setup Project Target of setting Assembler Linker Librarian Converter Debug 4 gt Debug z Category Setup 4 5 single operation pri LIN SLAVE prj Available Setup Name mon_dbg Setup Name Add mon_dbg Browse Setup Name List Change Setup Name Change Cancel Apply Figure 2 18 Changing the debug settings 47 FUJITSU ANO7 00200 03E The debug setup wizard is displayed as shown in Figure 2 19 Starting the debug setting wizard Click the Next button Setup Wizard You can easily set for debugger when use the Setup Wizard Push Next to start making settings lt Back Finish __ Canca Figure 2 19 Starting the debug setting wizard Select the debugger type as shown in Figure 2 20 Selecting
57. e vibration energy of the crystal is sufficiently great it can also vibrate the air to create sound This is the principle used in the piezoelectric buzzer 71 FUJITSU ANO7 00200 03E Contraction Expansion Figure 4 9 Principle of piezoelectric elements In this way a sound can be created by applying a voltage that changes in AC voltage or pulse voltage to the piezoelectric buzzer Here the method outputs a pulse wave using the PPG timer that is built into the microcontroller PPG is an initialize for Programmable Pulse Generator and as the name implies pulse outputs of various widths are obtained from the microcontroller by using programs Basically pulse outputs using the PPG timer are enabled by setting the cycle H width and operations clock In reality in addition to this pulse information the PPG pin output enable settings and PPG operations enable settings are also required 72 FUJITSU AN07 00200 03E 4 1 3 LED displays using temperature sensor operations This section explains how to display temperature information on the LED using the temperature sensor which is mounted to the starter kit A temperature sensor is a sensor for detecting changes in temperature Put simply it is a thermometer for measuring the temperature Although there are various methods of measuring the temperature the temperature sensor mounted to the starter kit is called a thermistor A thermistor is a resistor that use
58. e bits corresponding to the pins in the DDR1 register Next regarding switch controls the switches on the starter kit are connected to the pin P5 which is the external interrupt input pin and the general I O ports on the microcontroller This section explains how to detect switch operations i e when the switch is pushed on the microcontroller using the pins as external interrupt input pins INT5 An overview of the SW2 connection circuit in the starter kit is shown in Figure 4 4 Connection configuration between SW2 and microcontroller pins schematic diagram In the starter kit SW2 is connected to the INT5 pin which is the external interrupt input pin on the microcontroller If SW2 is not pressed i e is OFF the voltage applied to the INTS pin on the microcontroller is VCC 5V which is High Further if SW 2 is pressed i e is ON the voltage applied to the INTS pin is grounded so the INT5 P5 pin input status is Low Consequently when SW2 is pushed the 66 FUJITSU AN07 00200 03E input to the INTS pin changes from High to Low Further when SW2 is released the input to the INTS pin changes from Low to High If using the external interrupt function on the microcontroller an interrupt can be created using timing that changes the pin status In other words if using this mechanism the fact that the switch has been operated can be identified using the interrupt Further SW3 can also be operated in the sam
59. e way as SW2 but SW3 is connected to the INT6 pin on the microcontroller Consequently when SW3 is operated an INT6 pin external interrupt is created mSW2 OFF Figure 4 4 Connection configuration between SW2 and microcontroller pins schematic diagram The next section explains the methods and procedures for using the INT5 pin on the microcontroller as an external interrupt pin If using the INT5 pin as an external interrupt set the I O direction to input using register DDRO on port 0 and further if using combined analog input pins it is necessary to make port input settings Register DDRO on port 0 is an 8 bit register for switching the direction input or output direction used by the port 0 pins If using the pins as input ports write 0 to the bit corresponding to DDRO Further to use the external interrupt function on the microcontroller it is necessary to set the external interrupt register EICOO EICOO is a register that selects the edge polarity and controls interrupts for the external interrupt inputs This section considers when SW 2 being turned ON is detected by an interrupt When SW2 is released the fact that the input level of the INTS pin changes from Low to High has already been explained With the external interrupt function it is possible to detect the change in the level from Low to High i e the rising edge of the INTS pin by setting the external interrupt register using the steps 1 to 5 in the pro
60. eception from bits pot white awaited When a data reception interrupt is created by bits pot white sending data reception is processed in the reception processing function l_ifc_rx _ife_handle rx_data as shown in Figure 5 20 Data reception processing When data is received as well reception is processed using _ifc_rx data each time one byte of data is received in the same way as for the second byte onwards for data that has been sent and when all eight bytes of data have been received if there is no checksum error the reception successful flag is set and reception processing ends void 1_ifc_rx 1_ifc_handle rx_data switch ucLinStatus case LIN_TRANSMIT Omitted case LIN DATA RECEPTION DATA FIELD reception status if ucRxCurrentIndex gt ucRxCount lt If all data has been received if uiRxCheckSum rx_data OxFF lt If Checksum calculations are normal Omitted flagsLinTxRx bit SucceedReception SET Reception successful flag set memepy amp ucUartRxFixedBuffer 0 amp ucUartRxBuffer 0 ucRxCount Omitted T Copy received data else If there is a check sum error I_flg_tst aCHECKSUM_ERR Error processing else If there is still remaining reception data ucUartRxBuffer ucRxCurrentIndex rx_data Received data stored to buffer Omitted case LIN_ID_RECEPTION Omitted case LIN_WAKEUP_TRANSMIT Omitted Figure 5 20 Data reception processing 107 FUJITSU
61. eeeeeeteneaaas 65 4 1 Overview of single unit operation eee eee cece eee ener eeeeeseaeeeeeeeeenneeeaeeeeaae 65 4 1 1 Turning ON LEDs using switch operations 00 0 0 ee eee eee e ener eeeeeeeeaeeenee 65 4 1 2 Controlling the buzzer using the volume SWitch 0 eee eee eee e eee e teeta 69 4 1 3 LED displays using temperature sensor Operations cece ee eeeeeeeeeeeeeeeeeee 73 4 2 Understanding and running the program in single unit operation see 74 5 Try touse LIN Communication v 05 sicssesist intu bets a aiia 79 5d Wh hatis LIN Ys ae cite oat aaa se ohoor nest cone actneoeneset eons actineeresest eoneacabeoresasbesneeccbeoresosbeoneecebeccts 79 FUJITSU AN07 00200 03E D2 LIN YS POCU CALL OIS aotearoa e aaate cee cts state tanec steno as setsyes ea eets 82 5 2 1 Lan frame Configurations i 2 csiesesscscesetecncesers canecnseen cesses caneensnensesnescaueensnenseenne deseo 82 5 3 LIN communication flow scission iets tats 85 5 4 Communication between master and slave if an error OCCUIS ccccceeeeeeeeeeeeeeeeeeeees 87 5 5 LIN communication by using microcontroller ccc cece e ester eeeceeeeeeeeeeeeeeneeaaes 88 5 6 Understanding and overview of the program for LIN communication cee 92 5 6 1 LIN communication configuration c ccc eee eee e eee e ee eeeeeeeeeeeeeeeene 92 5 6 2 Sample programs sequence sr arrn nr a ar ee 97 AP PON moc ssc
62. er 0 bit7 bit6 bit5 bit4 bit3 bit2 bitl bitO BGRO Figure 5 8 Entire LIN communication control registers 89 co FUJITSU IANO7 00200 03E Table 5 1 Description of the entire LIN communication control registers and setting values Parity authorization bit SCR_PEN 0 no parity SCR_P 0 even parity Parity selection bit SCR_SBL 0 1 bit Stop bit length selection bit SCR_CL 1 8 bit Data length selection bit SCR_AD 0 data frame Address data format selection bit SCR_CRE 1 clear flag Clear reception error flag bit SCR_RXE 0 Receive prohibited Receive prohibition enable bit SCR_TXE 1 Transmit enabled Transmit enable bit SMR_MD1 1 mode 3 Operation mode selection bit SMR_MDO 1 asynchronous LIN mode SMR_OTO 0 use external clock 1 to 1 external input enable bit SMR_EXT 0 use baud rate generator External serial clock source selection bit SMR_REST 0 Reload counter restart bit 1 LIN UART reset Programmable clear bit SMR_UPCL LIN UART software reset 0 general I O port or LIN UART clock input SMR_SCKE Serial clock output enable bit pin SMR_SOE 1 LIN UART serial data output pin Serial data output enable bit O LSB first transfer from least significant SSR_BDS Transfer direction selection bit bit SSR_RIE 1 Receive interrupt enable Receive interrupt request enable SSR_TIE O Transmit inter
63. er file autoboot c Yes Yes Autoboot determination processing file ext_int c Yes Yes External interrupt processing function init c Yes Yes Internal clock initialization file main c Yes Yes Main source file vector c Yes Yes Vector table source file fgm_cfg h Yes Yes Monitor operation definition file FGM rel Yes Yes Monitor program sample dat Yes Yes Softune settings file single operation prj Yes Yes Softune project file LIN_communication Debug ABS LIN_communication abs Yes Yes Sample program abs file LIN_communication mhx Yes Yes Sample program HEX file LST 109 Fo FUJITSU IANO7 00200 03E OBJ OPT emu_dbg sup Yes Yes Emulator debugger file mon_dbg sup Yes Yes Monitor debugger file include _f2mc8fx h Yes Yes Microcontroller header definition file define h Yes Yes Header definition file define_l h Yes Yes Header file for LIN driver definition extern h Yes Yes External function reference file fgm h Yes Yes Header file for incorporated monitor programs lin h Yes Yes Header file for LIN drivers linapi h Yes Yes Data communications system API code header file lindbcpu h Yes Yes CPU compatible definitions header file lindbmsg h Yes Yes Header file for LIN communication definition baud rate settings ID settings single registration etc linhibios h Yes Yes LIN driver high level header file li
64. ere are in fact various communications formats such as transmission by people talking letters written in script and electronic communications etc Among these there are various plans for communications using electricity This chapter explains communications in a standard called LIN 5 1 What is LIN LIN is an acronym for Local Interconnect Network and is a type of communications protocol for vehicle mounted LAN The LIN consortium was proposed in 1999 with the objective of enabling a less expensive configuration than CAN which is the most widespread control system vehicle mounted LAN Thereafter after several version upgrades LIN2 0 which has added diagnostic and other functions was launched in 2003 Further in 2006 the version was upgraded to LIN2 1 This section explains LIN applications Concomitant with multi function vehicles the existence of a network in vehicles also became indispensable Currently vehicle mounted LANs are broadly divided into two classifications control systems which are concerned with motoring and the vehicle body and information systems which connect devices such as the satellite navigation system and audio and so different LANs are used depending on the application In particular vehicle body devices such as electric mirrors and power windows which are classified as body systems do not require such fast or detailed control Consequently they are also inexpensive This is where LIN is used 79
65. he counter value which is called the error counter is featured by the specifications but in LIN if an error occurs simple error processing is possible in which LIN merely waits for the next command 5 2 LIN specifications This section explains briefly the LIN specifications For detailed specifications access the LIN consortium website http www lin subbus org and register your name and e mail address to get a specifications 5 2 1 Lin frame configuration This section explains frames which is the basic unit of LIN communication LIN frames are configured using headers and responses As shown in Figure 5 3 LIN communication flow the basic communications flow is a procedure in which the master sends headers to the slaves and the slaves implement processing according to the contents of the headers received and then send a response to the master 82 FUJITSU AN07 00200 03E ot ee Identifier Figure 5 3 LIN communication flow Further headers are configured using three fields Break Sync byte and ID field Identifier and responses are configured using two fields Data field and Checksum field Header Response j 1 1 1 4 gt i 1 1 i 1 1 i i 1 i i 1 1 1 i 1 1 i i 1 1 i i i i ID DATAI DATAN Check Sum E 4 gt 4 gt 4 gt 4 gt 4 Break Sync By
66. ht or copyright or any other right of Fujitsu or any third party or does Fujitsu warrant non infringement of any third party s intellectual property right or other right by using such information Fujitsu assumes no liability for any infringement of the intellectual property rights or other rights of third parties which would result from the use of information contained herein The products described in this document are designed developed and manufactured as contemplated for general use including without limitation ordinary industrial use general office use personal use and household use but are not designed developed and manufactured as contemplated 1 for use accompanying fatal risks or dangers that unless extremely high safety is secured could have a serious effect to the public and could lead directly to death personal injury severe physical damage or other loss i e nuclear reaction control in nuclear facility aircraft flight control air traffic control mass transport control medical life support system missile launch control in weapon system or 2 for use requiring extremely high reliability i e submersible repeater and artificial satellite Please note that Fujitsu will not be liable against you and or any third party for any claims or damages arising in connection with above mentioned uses of the products Any semiconductor devices have an inherent chance of failure You must protect against injury fire damage o
67. icsitissaisasenaicncaievay saad svanancaia ss suaceesuansvasscssaseecesnersesssvevsechavexeossseavesciasaacestseenasse 109 6 1 Sample program folder file configuration 0 ccc eee essere eeeeeseeeeeeeeeeeneeaaes 109 FUJITSU AN07 00200 03E List of Figures Figure 1 1 External view of a starter kit ccccccceeeeeeeeeeeeeeeee eee eeeeeeeaaeeeeeeeeeteeccaeeeeeeeeeene 14 Figure 1 2 System connection diagram single unit Operation ccc ee eee e ener eee 17 Figure 1 3 System connection diagram when performing LIN communication 0 18 Figure 1 4 SOFTUNE setup confirmation cir e eee e eee e eee nn nnn nneur nanan 22 Figure 1 5 Starting SOFTUNE set Psir aN raay 22 Figure 1 6 SOFTUNE setup confirmation 0 0 cece rr aeaa 23 Figure 1 7 SOFTUNE setup License agreement cece eee eee e near eee eeeeeee ee eeee eet 23 Figure 1 8 SOFTUNE setup Version information 00 ccc eee eee sere reece eee ee eee 24 Figure 1 9 SOFTUNE setup Selecting the destination of installation eee 24 Figure 1 10 SOFTUNE setup Selecting the component teeter eee etree 25 Figure 1 11 SOFTUNE setup Confirming the installation settings 0 0 0 0 eee eee 25 Figure 1 12 SOFTUNE setup Completion i ee eee reer neceeeee neater 26 Figure 1 13 PC writer Installation dialog cee erence eee eee eneeeeeee ee eeee ete 27 Figure 1 14PC Writer Setup ty pe vessss
68. nalog signals are input to the microcontroller using this knob Analog signals that have been entered are processed by the microcontroller after being converted to digital signals by the A D converter Volume SW to adjust applied voltage Figure 4 5 Single unit operation Volume SW An A D converter with 8 bit resolution 10 bit resolution can also be used is built into the main microcontroller in the starter kit 8 bit resolution is the name given to the ability to deblock and convert analog values to digital values in 2 G e 256 steps 1 bit voltage accuracy at 5V during 8 bit resolution is described below 1 bit voltage accuracy at 5V With 8 bit resolution 5V 256 Approx 0 01953V This explanation concerns the volume switch mechanism but the symbol for a variable resistor is used in Figure 4 6 Volume SW variable resistor In truth the volume switch is really a variable SK Figure 4 6 Volume SW variable resistor resistor 69 FUJITSU AN07 00200 03E MB95F136JBS VCC5 16 Variable resistance ANO1 Volume switch GND Figure 4 7 Circuit surrounding the voltage adjustment knob In the starter kit the circuit is configured as shown in Figure 4 7 Circuit surrounding the voltage adjustment knob and adjusting this volume switch changes the value of the voltage applied and applies this voltage to the pins that perform the A D conversion The applied voltage can be digitally converted in 256
69. nd installing the USB driver and reinstall the driver 34 Fo FUJITSU 2 Running the Program To run a program with the starter kit take either of the following procedures Executing in single chip mode Debugging by using Monitor Debugger 35 See P 36 See P 43 IANO7 00200 03E FUJITSU ANO7 00200 03E 2 1 Executing in single chip mode In single chip mode take the following procedures Building a project Writing the program into the microcontroller 2 1 1 Building a project Preparation Decompress the following file in advance within the folder you decompressed in 1 1 1 Downloading the software sample program bitspot_yellow_SampleProgram zip Activate SOFTUINE dedicated bits pot version In Windows click the Start All Programs P Softune V3 FFMC 8L Family Softune Workbench to activate SOFTUNE as shown in Figure 2 1 SOFTUNE Workbench start window e SOFTUNE Workbench File Edit View Project Debug Setup Window Help woles Bole al osal ee oe eala ee fuer alal Klal Sd ln fo rw dL I Fae ie Nie inv ie Figure 2 1 SOFTUNE Workbench start window 36 FUJITSU ANO7 00200 03E Click File Open Workspace from the SOFTUNE menu as shown in Figure 2 2 Opening a workspace The workspace opens SOFTUNE Workbench ies Edit view
70. ne 97 FUJITSU AN07 00200 03E Create UART reception interrupt Start UART reception interrupt processing ynch break No detected y ID reception Yes processing v FRT timer operation i No Reception ID Yes v AA ICU interrupt Data reception Data send authorized processing processing v y Check sum reception Check sum send processing processing e End UART reception interrupt processing Figure 5 10 LIN communication flowchart interrupt routine UART reception interrupts Create input capture ICU interrupt y Start ICU interrupt Wa processing Processing to obtain ICU timer value 1 Processing to obtain ICU timer value 2 Baud rate adjustment processing a ICU interrupt processing i Figure 5 11 LIN communication flowchart interrupt routine input capture interrupts 98 FUJITSU ANO7 00200 03E The next section explains the sample programs but the sample programs contain parts in which LIN communication with bits pot white are not used To make these parts expandable programs commensurate with LIN use are included Not all operations however are checked Be careful when using The operations points of the sample program in the LIN protocol during LIN communication
71. nected to the LIN network via transceiver ICs electronic components that send and receive data and each ECU is connected on the bus from the master 81 FUJITSU AN07 00200 03E to a slave An ordinary single metal wire is used as the bus cable CAN combines two opposing metal wires to make one twisted pair cable FlexRay uses two twisted pair cables Consequently LIN has the advantage of using a single cable for numerous network wires unlike CAN and FlexRay which use twisted pair cables The communications distance is 40m max LIN can be used in combination with CAN and in such cases CAN is most frequently used as the core network and LIN is used as the branch network 4 The baud rate is 20kbps max The baud rate according to LIN specifications is within the range 1 to 20kbps Practically the baud rate of LINs used as LANs depends on the individual vehicle manufacturer s system specifications but generally one of the following is used 2 400kbps 9 600kbps or 19 200kbps 5 Communications errors are detected only and subsequent processing depends on the application With LIN communications errors are detected based on information as to whether transmitting and receiving has been performed successfully Processing after an error has been detected however is not specified Here LIN error processing can be customized according to the application CAN and FlexRay management of the communications status depends on t
72. nlobios h Yes Yes LIN driver low level header file linnode h Yes Yes Header file for definitions by LIN communication node mb95130 h Yes Yes Microcontroller header file source fgm_cfg asm Yes Yes Monitor operations definition file fgm_main asm Yes Yes Monitor debugger assembler file startup asm Yes Yes Microcontroller startup assembler file ADC c Yes Yes A D converter file autoboot c Yes Yes Autoboot determination processing file ext_int c Yes Yes External interrupt processing function init c Yes Yes Internal clock initialization file linapi c Yes Yes Data communications system API source file linhibios c Yes Yes Driver high level source file LIN protocol control linlobios c Yes Yes Driver low level source file CPU resource control main c Yes Yes Main source file vector c Yes Yes Vector table source file fgm_cfg h Yes Yes Monitor operations definition file FGM rel Yes Yes Monitor program fsg_sample dat Yes Yes Softune settings file LIN SLAVE prj Yes Yes Softune project file 110
73. nnected to the general purpose I O port 8 Volume SW Volume switch Volume switch connected to the A D converter input External drive electric sounder made by Murata 9 Buzzer PKLCS1212E40A1 Manufacturing Connected to the PPG timer output port Power supply LED 10 LED green x 1 LED lamp for the starter kit power supply lamp USB connector for connection with the PC to write or 11 USB connector mini B to debug a program Connector for LIN communication 12 LIN connector 2 pin connector Connect this connector to the LIN connector on the bits pot white 13 Regulator LP3874EMP 3 3 Regulator IC 3 3V 14 LIN transceiver IC TJA1020T Transceiver IC used for LIN communication 15 Reset IC M51957BFP Reset IC Oscillator for USB CSTCR6M00G55B Ceralock made by Murata Manufacturing 16 communications 6MHz Oscillator for the USB communication microcontroller microcontroller 17 Target device oscillator CSTCR4M00G55B Ceralock made by Murata Manufacturing 15 Fo FUJITSU IANO7 00200 03E 4MHz Oscillator for the main microcontroller Extension pins of the main microcontroller 18 Extension pins For details see the circuit diagram Jumper pin for switching the power supply to the LIN transceiver IC 1 2 Power supply from USB bus power 5V 19 Jumper pin JP1 2 3 Power supply from external power source CN5 12V The default is 1 2 20 Extension power 5V Extension 5V power terminal
74. pot white LED and 7SEG LED are also decremented If bits pot white SW4 is set to the right no operation is performed Temperature sensor Control When bits pot white SW4 is set to the right the temperature of the starter kit temperature sensor is sent Volume SW Control When bits pot white SW4 is set to the right the information of the starter kit Volume SW is sent The sound of the bits pot white buzzer output changes when the volume switch is operated Buzzer Mechanical Buzzer sounds are output when bits pot white SW4 is set to the right Further the buzzer sound output changes according to volume switch operations In addition if an error occurs during LIN communication a buzzer sound is output LED red Mechanical When bits pot white SW4 is set to the left the count is incremented or decremented by pressing starter kit SW2 and SW3 and bits pot white SW3 and SW5 When bits pot white SW4 is set to the right the temperature information from the bits pot white temperature sensor is displayed 64 FUJITSU ANO7 00200 03E 4 Try to operate the bits pot yellow single unit 4 1 Overview of single unit operation After system startup the starter kit LEDs and buzzers are operated by the switches SW2 SW3 and volume switch and temperature sensor as described below 4 1 1 Turning ON LEDs using switch operations General push switches and LEDs are mounted to
75. r file configuration 0 ccc e tere cece e enna nent 109 FUJITSU AN07 00200 03E Introduction Thank you very much for purchasing the bits pot yellow referred to as this starter kit or the starter kit hereafter This starter kit is a beginner s kit intended for those who wish to start learning microcontrollers and on board network processors The kit is designed so that the beginners who ask What is a microcontroller How does it work and How does it control a network can easily learn what it is The kit includes flash microcontroller development tools so if you have slight understanding about the C language you can rewrite a program to let the microcontroller perform in various ways Even if you do not know of programming you may be able to enjoy learning a microcontroller with a study aid book about the C language This starter kit can also serve as an introductory training tool for electronic circuit practice or future embedded software development in a class of a college or high school of technology or training for freshman engineers of a manufacturer Fo FUJITSU Contact Please ask the following e mail address for the technical question Please confirm HP for the latest information and FAQ of bits pot s TSUZUKI Zip code 105 8420 2 5 3 Nishi Shinbashi Minatoku Tokyo E mail pd bitspot tsuzuki densan co jp bits pot URL http www tsuzuki densan co jp bitspot
76. r loss from such failures by incorporating safety design measures into your facility and equipment such as redundancy fire protection and prevention of over current levels and other abnormal operating conditions If any products described in this document represent goods or technologies subject to certain restrictions on export under the Foreign Exchange and Foreign Trade Law of Japan the prior authorization by Japanese government will be required for export of those products from Japan The company names and brand names herein are the trademarks or registered trademarks of their respective owners Copyright 2010 FUJITSU SEMICONDUCTOR LIMITED all rights reserved FUJITSU AN07 00200 03E Table of Contents Revision History sesti AA RA a e aa 2 IN GUS este ied Sat sec it seventeen teetin ieaie eieaa eaii 3 WAOMUCH OM PEP PE PEP TE TT E EE E E 10 Contacto aa he ecg E E E E E E E sotadeessetacededas 11 Suppliers of the parts material Srii saiiesekecav ec teeseiacakeca euasetocateca enchussiocaiecetanevoesdeontaees 12 L Setting pthestarter kitarr eoi a n a e n aan eanais 13 1 1 Setting wp the a O 21 1 1 1 Downloading the software ccccccccccsee eee ee eeeecneee seer ee eeeecaaeeeeeeeeeeeecaaaeeeeeeeeene 22 1 1 2 Installing the integrated development environment SOFTUNE bits pot yellow dedicated Version An sacha waiseahie aw AGA A a ak 22 1 1 3 Installing the PC Writer FUJITSU FLASH USB Programmer bits pot yello
77. river you choose will be the best match for your hardware Figure 1 18 Selecting the search locations A warning message will be displayed as shown in Figure 1 19 Hardware installation ignore and click the Continue Anyway button Hardware Installation The software you are installing for this hardware BGM Adaptor MB21 46 09 has not passed Windows Logo testing to verify its compatibility with Windows XP Tell me why this testing is important Continuing your installation of this software may impair or destabilize the correct operation of your system either immediately or in the future Microsoft strongly recommends that you stop this installation now and contact the hardware vendor for software that has passed Windows Logo testing Continue Anyway STOP Installation Figure 1 19 Hardware installation 31 FUJITSU AN07 00200 03E When the driver installation is complete the dialog shown in Figure 1 20 Completing the BGM Adapter MB2146 09 installation will be displayed Click the Finish button Found New Hardware Wizard Completing the Found New Hardware Wizard The wizard has finished installing the software for BGM Adaptor MB 2146 09 Click Finish to close the wizard Figure 1 20 Completing the BGM Adapter MB2146 09 installation 32 FUJITSU ANO7 00200 03E 1 1 5 Configuring the starter kit After the USB driver installation is complete
78. rogram writing is displayed to notify you of the completion of the program writing press the OK button to quit PC Writer l Full Operation OK Figure 2 32 Completing the program writing After completing the program writing turn OFF the starter kit power supply and set the Mode SW to RUN before reconnecting the power supply to the starter kit 55 FUJITSU ANO7 00200 03E 2 2 3 Loading the target file Click Debug Start debug from the menu as shown in Figure 2 33 Start debugging When the debug starts the target file will be loaded automatically SOFTUNE Workbench bitspot_yellow_SampleProgram_monitor debugger File Edit View Project BSJ Setup Window Help aTeo F Run Abort amp l Reset of MCU aA ea jreakpoints X Breakpoints Breakpoint Set Reset F9 single operation v De Event DSa Sequence Stack amp 2 Time Measurement Call E Workspace bitspot Clear Call single_opera vector ee a Fa 44 lal A Q Source File E Include File Load target File Dependenc Debug H E LIN communication abs Figure 2 33 Start debugging Once the monitor program itself is loaded to flash memory the module can be loaded by the monitor debugger functions subsequently and it is not necessary to use the PC writer Note
79. rupt prohibited Transmit interrupt request enable 0 LIN synch break detection interrupt LIN synch break detection interrupt enable ESCR_LBIE prohibited bit ESCR_LBD 0 LIN synch break detection flag clear LIN synch break detection flag bit ESCR_LBL1 0 LIN synch break length selection bit ESCR_LBLO 0 13 bits ESCR_SOPE O serial output pin access prohibited Serial output pin direct access enable bit ESCR_SIOP 0 Serial I O pin direct access enable bit ESCR_CCO 0 Continuous clock output enable bit ESCR_SCES 0 Sampling clock edge selection bit 90 Fo FUJITSU IANO7 00200 03E ECCR_LBR 0 LIN synch break not created LIN synch break creation bit ECCR_MS 0 Serial clock send receive selection bit ECCR_SCDE 0 Serial clock delay enable bit ECCR_SSM 0 Start stop bit mode enable bit BGR_BGRI1 0x16 when set to 9600bps Baud rate generator 1 BGR_BGRO 0x66 when set to 9600bps Baud rate generator 0 91 Fo FUJITSU IANO7 00200 03E 5 6 Understanding and overview of the program for LIN communication This section explains sample programs as programs that actually perform LIN communication In bits pot LIN communication the starter kit operates as a LIN slave and bits pot white operates as the master 5 6 1 LIN communication configuration The LIN communication conditions for the sample program are described in Table 5 2 LIN communication conditions
80. s the temperature characteristics of semiconductors and is a temperature sensor in which the resistance value changes according to the temperature The circuit surrounding the temperature sensor on the starter kit is shown in Figure 4 10 peripheral circuit diagram for temperature sensor As explained in the section on the volume switch with this circuit also if the resistance value of the temperature sensor changes the input voltage of the A D converter in the microcontroller changes VCC5 MB9S5F136JBS R 10kQ ANO7 pin VV Temperature sensor GND GND Figure 4 10 peripheral circuit diagram for temperature sensor Next about the LED display is basically the same as turning ON OFF the LED Here The LED is turned ON in multiple patterns according to the digital values acquired from the temperature sensor 73 FUJITSU AN07 00200 03E 4 2 Understanding and running the program in single unit operation This section explains sample programs as programs that practically turn on of the LED using switch operations and that control the buzzer using the A D converter operations C m Sq Press SW2 Initialize Port and interrupt levels Start external interrupt processing Start external interrupt y processing Clear external interrupt request Initialize external interrupt flag y y Clear external interrupt reques
81. set SW 6 Volume SW 3 SW2 4 SW3 5 Temperature sensor Figure 3 1 Single unit operation Controls and mechanicals 61 Fo FUJITSU IANO7 00200 03E Table 3 1 Single unit operation Descriptions of the controls and mechanicals No Name Specifications Function Switches between PROG mode and RUN mode 1 Mode SW Control PROG Write a program RUN Run the program 2 Reset SW Control Resets the MCU when pressed Turns ON and OFF the LED when pressed Light up 3 SW2 Control LEDs 4 to 6 in order and turn OFF when they are all ON each time the switch is pressed Turns ON and OFF the buzzer outputs each time the 4 SW3 Control switch is pressed Displays the temperature sensor information on the 5 Temperature sensor Control LED The ON OFF pattern depends on the temperature Change the buzzer sound when the sound is ON 6 Volume SW Control Slide to the left to raise the tone Press SW 3 to sound the buzzer Further operate the 7 Buzzer Mechanical volume switch to change the tone This LED is turned ON either by pressing SW2 or by 8 LEDs red Mechanical the temperature sensor operations 62 FUJITSU ANO7 00200 03E 3 2 LIN communication operation LIN communication operation with the bits pot white Explanations of the operation and control parts as shown in Table 3 2 LIN communication Descriptions of the controls and mechanicals are described in
82. t Initialize AD computer flag PPG output authorized y v LED4 LEDS and LED6 ON ae OFF PPG start stop Infinite loop y End external interrupt End external interrupt processing processing Start AD conversion interrupt y Clear interrupt request flag as time y Acquire A D value Acquire A D value from temperature from slide volume sensor v v Cycle setting LED temperature v displ se Duty setting End AD conversion interrupt Figure 4 11 Single unit operation flowcharts 74 FUJITSU AN07 00200 03E The flowcharts for the sample programs are shown in Figure 4 11 Single unit operation flowcharts First the ports interrupt levels external interrupts and A D converter are initialized Thereafter the program enters a loop Here when SW2 is pressed an external interrupt is created and the LED on of processing is performed Further when SW3 is pressed the buzzer is output Here the buzzer sound can be changed by operating the Volume SW So let us look at an actual program Check the following folder for the sample program The folder contains several files First open main c bitpot_yellow_SampleProgram_single chip single_operation source Check around the line 37 as shown in Figure 4 12 Operation mode settings when using volume switch to select the operation mode
83. tart menu click All Programs P Softune V3 FFMC 8L Family Softune Workbench to activate SOFTUNE Click File Open workspace from the SOFTUNE menu as shown in Figure 2 12 Opening a workspace to open a workspace SOFTUNE Workbench mew Edit View Project Debug Setup Window Help v S Sal sll Recent Text File gt Recent Workspace File Exit Figure 2 12 Opening a workspace 43 FUJITSU AN07 00200 03E As shown in Figure 2 13 Selecting a workspace the dialog that allows you to select a workspace is displayed Select the folder containing the sample program for the monitor debugger and then select the bitspot_yellow_SampleProgram_monitordebugger wsp workspace and click Open bitspot_yellow_SampleProgram bitspot_yellow_SampleProgram_monitor debugger bitspot_yello w_SampleProgram_monitordebugger wsp Open Workspace Look rx bitspot_yellow_SampleProgram_mon a aga DUN _communication single_operation bitspot_yellow_SampleProgram_monitordebugger wsp File name baspot_yellow_SampleProgram_monitordebugg Files of type Workspace File wep 7 Cancel J Figure 2 13 Selecting a workspace The workspace opens check that the single operation project is set to the active project To change the active project to the project for the LIN communication select the project for
84. te ID Field Data Field Checksum Field Start bit L Stop bit H Interval Response space Break delimiter Inter frame space Figure 5 4 LIN frame configuration 83 FUJITSU AN07 00200 03E 1 Break Break which are in the header fields are variable length fields that indicate the start of a new frame They comprise 13 to 16 0 bits fixed value zero min The general frame length is 13 bits 2 Sync Byte Sync byte which follow on from breaks are 10 bit fixed length fields that synchronize the master and the slaves Sync byte configurations comprise 1 starter bit 0 8 data bits and 1 stop bit 1 The 8 bit data bit has the fixed value 0x55 which is expressed as 0x01010101 in binary If the slave receives the 0x55 in the synch byte send by the master normally the master and slave are synchronized 3 ID field The ID field which is the final header field and comes after the synchronous byte is a 10 bit fixed length field that specifies the frame type and objective ID fields have values from 0 to 63 6 bits This ID field is also used by the master to specify individual slaves Slaves judge what type of frame has been sent and if it was intended for them according to the ID field sent by the master and send responses to the master accordingly Further the ID field has a 2 bit parity bit following the 0 to
85. the slave operation is to perform error checking when a header is received and when a response is sent Checksums and other checks are implemented during reception When sending checks are performed by comparing the sent data and the bus data that performs the monitoring In this way the slave identifies its own status and inserts the results into the response that is sent to the master The master identifies the slave status from the response and if there is a nonconformance initializes the slave In this way the error status is completely cleared 87 FUJITSU AN07 00200 03E 5 5 LIN communication by using microcontroller This section explains practical LIN communication using microcontrollers In the starter kit the microcontroller and LIN transceiver IC TJA1020T are connected as shown in Figure 5 7 LIN circuit In the microcontroller SOT sends SIN receives and SCK is the port that controls the transceiver IC Sending and receiving signals flow on the bus via the LIN transceiver IC CN5 EXT PWR VCCS VCC5 1 2 BJP R10 TRI 5 1kQ DTAI44E C8 R8 0 1uF UL IkQ MB95F136JBS GND U4 A LEDI TJA1020T SML 210MT GND SOT 18 CN4 20 sck 4 C9 VCC5 220pF LIN TR2 GND GND DTAI144E R9 1kQ LED2 SML 210MT Figure 5 7 LIN circuit 88 FUJITSU AN07 00200 03E The registers used for entire LIN communication control on the microcontroller are as described in
86. the synch field eee eee e eee e eee 101 Figure 5 15 Input capture ICU interrupt controls ccc eee ee eee ee ener een 102 Figure 5 16 LIN UART receive interrupt COMtIOL cccccseseesesseeeeesseeeeeeeseeeeeseseeeeeeeenes 103 Figure 5 17 Receive determination processing 00 0 0 eee reece eee errr eens e enna teeta 104 Figure 5 18 Timeout detection processing c cece eee reece eee eee e eee eeeeeeeeee eee eet 105 Figure 5 19 Data send proCessing esses tastiest etch eerste eis 106 Figure 5 20 Data reception processing cc cee eee aaa 107 Figure 5 21 Submain processing 00 0 0 eee erence eee eeeeeenceeeeeeeeeee eae 108 FUJITSU AN07 00200 03E List of Tables Tabled Component list 4 40 64 4 ta A A a a a 13 Table 1 2 Description of the respective parts of a starter Kit eee reer e ener e eee 15 Table 1 3 MB95F136JBS pin assignment eee reer erence eee ener eeeeeeaeeeeeeee eta 19 Table 3 1 Single unit operation Descriptions of the controls and mechanicals 0 008 62 Table 3 2 LIN communication Descriptions of the controls and mechanicals 0 008 64 Table 5 1 Description of the entire LIN communication control registers and setting values 90 Table 5 2 LIN communication conditions of the sample program 0 cece eter eee 92 Table 5 3 LIN message IDs in the sample program c cece eee e eee eeeeeee eee ee eee 92 Table 6 1 Sample program folde
87. top If bits pot white SW4 is set to the right temperature information is acquired from the temperature sensor on the starter kit by receiving 0x55 If bits pot white SW4 is set to the left no operation is performed This is temperature sensor information from the bits pot A D value temperature white 0 to 255 sensor information The temperature is displayed on the starter kit using this A D value 2 ID 0x01 byte 0 Reserved byte 1 Reserved A D value temperature byte 2 sensor information byte 3 Reserved byte 4 Reserved byte 5 Reserved byte 6 Reserved byte 7 Reserved 93 Fo FUJITSU IANO7 00200 03E Field name Set value Remarks This is the starter kit response to the ID 0x00 A D value temperature measurement command Temperature Temperature sensor 0 to 255 sensor information is sent as A D values and displayed information on the bits pot white 7SEG LED 3 ID 0x02 Volume value acquire byte 0 command byte 1 A D value VR information byte 2 Reserved byte 3 Reserved byte 4 Reserved byte 5 Reserved byte 6 Reserved byte 7 Reserved Field name Set value Remarks Volume value acquire 0x55 Start OxOF Stop If bits pot white SW4 is set to the right volume information is acquired from the starter kit by receiving 0x55 and the buzzer sound is output If bits command
88. ueresaeveseeeersieveeneeess 40 Figure 2 9 Selecting the file to Write ccccccsesesssoscsssssesesesssesctecssecnssssssccsesanseasassasecsesenscenases 41 Figure 2 10 Writing the program eee ener sawadina sarasa tae 41 Figure 2 11 Completing the program Writing ssssrrersssssesrrrrrrreserrrrrnrrnnserrrrnnrnnsserrrrenne 42 Figure 2 12 Opening Works paCe sistscet cect sek ses tet ees cont sovnse ch eneecvsbososeet enecesbeoceseeteneecconesess 43 FUJITSU AN07 00200 03E Figure 2 13 Selecting a WOrks Pace i scccccccoesestnesseensscassensnesecssnecnuadsuanstessnacausseansseesneeenavsds 44 Figure 2 14 Building a project 0 0 0 ener anana eaa nasa natawa daa anasa rasuna saai 45 Figure 2 15 Completing the builds i tistrei iointeietniain tateitei tetahi intet erinit tataitia 45 Fig re 2 16 L d module Outputs iiinis a n as 46 Figure 2 17 Debug settings ccccceceeeeeeeeeeeceeee eee ee eeeeaaaeeeeeeeeeecccaaaaeeeeeeeeteeecaaeeeeeeeeene 47 Figure 2 18 Changing the debug settings i eee eee eee e eee eeeneeeeneeeeeeee ete 47 Figure 2 19 Starting the debug setting Wizard cece near eee eeeeee eee ee teenie 48 Ficure 2 20 Selecting the debugger ty pe irae r a 48 Figure 2 21 Entering password when starting debugger cccee eee eee reece eee e eee e eee 49 Figure 2 22 Selecting the device type e eee eect e reer e eee anas 49 Figure 2 23 Setting the primary oscillation frequency
89. w dedicated VELSIOMN E 27 1 1 4 Connecting it to the PC and installing the USB driver cece e eee 30 Ls Contipuring the starter Kifarsi iore norra en ero arar a Enr 33 2 Running the Program so sisscssssaseie css tains ssvenaige cats cciass ssayecsis ccvnasssdaysccsasevaasysiavescienseeaseasevesee 35 2 1 Executing in single chip Mode c cece eee anaana iaaa aaa 36 2 1 1 Building a project 2 x sscievscsue sek siassins sin ke Sek cia bss kets absentee tei it 36 2 1 2 Writing the program into the microcontroller eee eee eee eeeeeee eee eeeeeeeeeeeeaes 40 2 2 Debugging by using Monitor Debugger eee eee cece e sneer eeeeceseneeeeeeeeeeneeeaaas 43 2 2 1 Activating SOFTUNE and configuring the debug settings eee eee 43 2 2 2 Writing the monitor program into the microcontroller c ccc eee teen 53 2 2 3 Meading the target tle soisin orere reoi oen ororo esoo orr iona 56 2 2 4 RUMMING the debugger cis siisssevscsnciesevivessvenancveysstessvensnaesusssuavsnsdancusessdesussetansxceaveys 57 3 Operation of the sample Programs ccc eee sete eee eeeee eee eee ee eseeseaeeeeeeeeesneeesaeeeaaae 60 3 1 bits pot yellow single umit Operation ee eee eee e ener eeeeeeaeeeeeeeeeeeneeaeeeeeee 61 3 2 LIN communication operation LIN communication operation with the bits pot white 63 4 Try to operate the bits pot yellow Single UNit cee eee cece e eee e eee eeeeeaaee
90. ync Byte LIN slaves measure the baud rate using input capture in the sync Byte and perform compensation after a synch break has been detected In the sample software 8 16 bit complex timers are used as the input capture and are set to both edges and free run mode In free run mode when an edge is detected the counter value is sent to the data register and the interrupt flag changes to 1 so the counter is not cleared and the count operations continue When the input capture interrupts are set to enabled and both edge detection when an edge is detected an input capture interrupt is created The timer value at both edges and the number of overflows are measured and the baud rate calculated and adjusted using interrupts at 8 100 FUJITSU AN07 00200 03E l Synch field l ASS DATA 0x55 8Tbit f I i4 gt I m 2Tbit gt a 2Tbit 2Tbit gt a 2Tbit gt i l TIIO input LSYN uilCUTime2 uilCUTime1 Figure 5 14 Input capture operation in the synch field 101 FUJITSU AN07 00200 03E interrupt void _LinICU void Omitted if TOOCR1_IR SET Check edge detection interrupt Omitted if ucLinStatus LIN_WAIT_SYNCH_FIELD_START Synch field start wait uilCUTimel TOODR Acquire timer value Omitted ucLinStatus LIN_WAIT_SYNCH_FIELD_END State transition else if ucLinStatus LIN_WAIT_SYNCH_FIELD_END synch field end wait
Download Pdf Manuals
Related Search
Related Contents
Manual - Videosonic Errata--GenoMax 3 - Thermo Fisher Scientific HAT600 instruction Chapter 7 Manuel d`utilisation Altec Lansing Speaker 5100 User's Manual Copyright © All rights reserved.
Failed to retrieve file