Home

AP16175 - Infineon

image

Contents

1. 330 31 USER CODE END 332 333 Simulation A Remember Port_2 pins used as GPIO User LED_2 Toggled via Software Me ee ee IDEE Application Note 95 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Double click CCU61 C insert code CCU61 Interrupt Service Routine Timer T12 period match if char UOCO_RBUF Z song aborted by user pos maxtl if pos lt max read_song_string read next note T12 note length CCU61_T12PR float current_note_length float tempo 120 0 period value note length CCU61_CC60SR 0 not used 100 duty cycle CCU61_CC61SR 0 not used 100 duty cycle if compare value CCU6_CC62SR 0 gt 100 duty cycle note length CCU61_CC62SR 0 CCU61_vEnableShadowTransfer CCU61_TIMER_ 12 T13 note frequency CCU61_T1I3PR T13_values note octave A note frequency CCU61_CC63SR T13_values note octave 2 A duty cycle note frequency 50 CCU61_vEnableShadowTransfer CCU61_TIMER_ 13 if note 0 myprintf note c else if note 1 myprintf note cis else if note 2 myprintf note d else if note 3 myprintf note dis else if note 4 myprintf note e else if note 5 myprintf note f else if note 6 myprintf note Tis else if note 7 myprintf note g else if note 8 myprintf note gis else if note 9 myprintf note a els
2. Loan pi 3 PERRA AREE RENNEN Application Note 64 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Select Project File Look in choose CAXE164 1 Select Project File Files of type check choose Project Files uvproj 2 Click XE164 uvproj 3 Select Project File Look in A XE164 v EIXE164 uvproj Histo ry IN De 5 ktop Li My Dacuments var My Com puter My Network Pla File narne XET64 uvpro Yd Files of type Project Files upro uvmpw uve un m ow Cancel E Click Application Note 65 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music 2 File C XE164 XE164 dpt has changed Do you want to migrate the changes Yes No Click Yes Application Note 66 V2 0 2010 04 Infineon AP16175 XE164 Playing Music Y XE164 pVision4 File Edit View Project Flash Debug Peripherals Tools SVCS Window Help 4 Target 1 EH E ZA USER CODE BEGIN Main 3 while RS232 wait USER CODE END while l USER CODE BEGIN Main 4 myprintf menu elect input i 83 CCU61 C new fitch select a User Files we intf case 1 blinking 0FF x myprintf c case 2 blinking OFF 389 case 3 USER CODE END Build Output 67 Application Note E MAIN L mann myprintte jcc2c IO vResetPin IO P2 7 myprintf n IO vSstPin IO P2 1 myprintf Ain blink
3. D gt iN eg n nn ge y Ves San ay i 2 X l Microcontrollers Cinfineon Never stop thinking Note In the following steps of this document we will expand the Hello World Application Application Note AP16174 with the requirements for PWM generation playing music Application Note 14 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music 1 Let s Get Started tol Ty Dm gt wes W zu Aut Saver ANNA eee ff Configuring and Reconfiguring the DAVE Project Settings Application Note 15 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Start the program generator DAVE and open your XE164 dav DAVE project View Project Window Closes the Project Window View Command Window Closes the Command Window File Open Location C XE164 Filename XE164 dav Hista ry i De 5 ktop im My Computer Tao My Network Pla Files of type DAVE project file dav Cancel E Click Open Application Note 16 V2 0 2010 04 AP16175 XE164 Playing Music De View Options Add Ins Windows B Dec ug 4 A na XE DAF CXXEI 64 E 164 dav Application Note 17 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Reconfiguration of Port 2 9 DAVE File View Options Add Ins Windows j Cea alamo E DAVE XE164F Release v2 1 DPR ST stem Bus XE DAF CASE 1 64 66 164 d
4. song counter song b unsigned int next song c 0 song counter song c unsigned int next song d 0 song counter song d unsigned int next song e 0 song counter song e unsigned int next song f 0 song counter song f unsigned int next song ge song counter song g unsigned int next song h 0 song counter song h unsigned int next song 1 0 song counter song 1 unsigned int next song j 0 song counter song j unsigned int next song k 0 song counter song k unsigned int next song 120 song counter song unsigned int next song m 0 song counter song m volatile bit OctaveLOW OFF Application Note 78 V2 0 2010 04 AP16175 XE164 Playing Music Infineon Y XE164 pVision4 File Edit View Project Flash Debug Peripherals Tools SVCS Window Help DAA AO Fre Sue Taget LANG EI name LU manu 2 eege Dese a e const char songk T12000L4DDL8C L8DL4EL4D OLL8HONO0L4EL4D OLL8HONOULZC LAEELSD LSTZ Lili Marleen song 1 E Start V3 A66 17 const char songl T12000L4EL8E L16FL4GL4EL8F L16FL8F O1L16COOL2HL8D L16DL8D L16EL i 33 MAIN C 158 musical scale chromatic scale for testing purpose song m i 159 const char songm TOOONOOLIC OLLIC H scs c m B IO C 161 QU0CO C 162 3 USICO C 163 default values wx char song MAX SONG LENGTH for global variables will be overwritten before use E 3 CC2 C 2 CCU61 C volat
5. Kuer vSetDeadTimePerod CCU61_yEnableShadowTranster CCU61_vLoadChannelShadowRegister CCU61_uwGetChannelShadowRegister Kuer uwGetChannelRegster SI ss SS SS Kuer _vResetStatusBit VLLT XE b4F CXXET64XET64 dav A Application Note 98 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Parameters do nothing File View Options Add Ins Windows de Dea hus Header File File name ecus H Parameters Part 1 CCUG1 TIMER 12 CCUG1I TIMER 13 CCUG61 CHANNEL 0 CCUG CHANNEL 1 CCUG CHANNEL 2 CCUG CHANNEL 3 XE b4F L4xE164 lt E164 dav fA Application Note 99 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Notes If you wish you can insert your comments here File View Options Add Ins Windows de Dea hus Insert Notes XE b4F L4xE164 lt E164 dav fA Exit and Save this dialog now by clicking Ej the close button Application Note 60 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Generate Code File Generate Code DAVE will show you all the files he has generated File Viewer opens automatically Application Note 61 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music File View Options Add Ins Windows leta Gemt Anual DAVE XE164F Release v2 1 Si Generated Files in C XE164 19 B DAvE s Project Documentatio
6. gt IT Use P2 6 as general IO Use P2 7 as general IO use P2 8 as general IO I Use P2 9 as general IO I Use P2 10 as general IO T Use P2 11 as general IO T Use P2 12 as general 10 c t a e gt gt IXE164F CAXE164 XE164 day A Remember Port pins used Application Note 20 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Input Characteristic do nothing 9 DAVE File View Options Add Ins Windows Sa DG ta 4 DAvE XE164F Release v2 1 4 Parallel Ports We BA M D Ports Functions Parameters Notes Ia dta 2 Pull Device P2 0 pull device P2 1 pull device P2 2 pull device P2 3 pull device P2 4 pull device P2 5 pull device P2 6 pull device P2 7 pull device P2 8 pull device P2 9 pull device P2 10 pull device P2 11 pull device P2 12 pull device XE164F CAXE164 XE164 day A Application Note 21 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Output Characteristic do nothing ed DAvE File View Options Add Ins Windows 65 007 fius Si DAvE XE164F Release v2 1 4 Parallel Ports We BA M D Ports Functions Parameters Notes 9 Configure Port 2 KR da 2 Driver Characteristic Control Driver of P2 0 P2 3 Strong driver Edge of P2 0 P2 3 Driver of P2 4 P2 7 Strong driver v Edge of P2 4 P2 7 Sharp edge mode v Driver of P2 8 P2 11 Strong driver v Edge of P2 8 P2 1
7. File View Options Add Ins Windows a Oeal 4 203 2 4 DAVE XE164F Release v2 1 4 Capture Compare Unit 61 CCU61 Im dia 2 Module Clock Pin Control Timer 1 2 Timer 1 3 Multi Channel Channels Trap Interrupt Configuration Interrupts Ir 4 A 1H Configure CCU61 Interrupts EES Interrupts Configuration Node 0 fod Ti Boden EE INTERRUPTS LIST T12 Interrupts D Note To assign Interrupts to the Nodes 0 1 2 3 click on the interrupts in Interrupts List drag it and drop to the required node XE DAF CNXET64XET64 dav AL Exit and Save this dialog now by clicking Eai the close button Application Note 53 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Interrupts drag and drop the CCU61 IO INT to Interrupt Level 12 Group 0 File View Options Add Ins Windows da Deo Alcs ee ce cee eee Level 0 non interrupting CCUG 10 INT Cle T INT Note To change the level and the group of an interrupt source click on it drag it to its new position and drop it To set an interrupt source to the non interrupting level Level 0 click on it drag it to the Level O list and drop it CAXE1641 lt E164 dav A Application Note 54 V2 0 2010 04 AP16175 Infineon XE164 Playing Music CCU61 Int Extension do nothing File View Options Add Ins Windows It De A fus z DAVE XE164F Release v2 1 D jGr
8. Remember Port 0 pins used by our PWM module CCU61 Duty Cycle purpose modulated by P0 0 CCUGLCC OO 100 notelength Timer 12 P0 6 CCU61 COUT63 SO notefrequency Timer 13 Application Note 30 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Timer 12 note length CCU61 Timer 12 Input Selection Input selection choose fcpu 32 gt Resolution 124 12 us 1 CCU61 Timer 12 T12 Single Shot Control tick M Enable single shot mode T12SSC CCU61 Timer 12 Interrupt Control tick M Enable interrupt for T12 Period match File View Options Add Ins Windows leta Diu gifs Input Selection T1 2 CLK Timer 12 Start Control m Start T12 after initialization Input selection cpu y 32 Resefffilu 0 485 us 8 TI2RS T12 External Run Selection Timer 12 Period T12PR Disable external setting of T12R Period ns p69 6969 70 Period register T12PR Timer 12 Single Shot Control d 0x0001 Enable single shot mode 112550 Dead Time Control Dead time ns 484 848 112 Counting Mode CTM Edge aligned mode count up Dead time register DTM 0x01 Center aligned mode count updown T12 Operating Mode T12CNT and ISCNT12 Interrupt Control 112 Interrupts Timer Mode 7 Enable interrupt for T12 Period match ENT12PM C Counter Mode Enable interrupt for T12 One match ENT120M ISCNT12 Disable Counting Mode of T12R y CAXEIBAXEIBA day 4
9. See AP16175 Infineon XE164 Playing Music Syntax used in our programming example Real Music LENGTH Y 2 beats 12 2 1 beat 34 3 beats Note The extends the length of the note by half of its length Application Note 138 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Syntax used in our programming example Real Music Note The notes C D E F G A Harenamed C D E F G A B in other countries In this document we stick to the German names Application Note 139 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Syntax used in our programming example Real Music Syntax used in our programming example Real Music Application Note 140 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music _Syntax used in our programming example Real Music LENGTH 1 1 Whole Rest 4 beats 1 2 Half rest 2 beats 1 4 Quarter rest 1 beat 1 8 Eighth rest 1 2 beat 1 16 Sixteenth rest 16th rest 1 4 beat Note The realisation of our programming example is easier when we deal with rests as notes Therefore playing a rest means playing a note The frequency of the note which is a rest was chosen above our hearing threshold level e g 60 000 Hz Application Note 141 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Octave Definition In music an octave is the interval between one musical n
10. USICO C 376 warning C174 Scs EnableHighPrecOsc unreferenced static function compiling CCZ C cc2 C 376 warning C174 Scs EnableHighPrecOsc unreferenced static function compiling CCU61 C CCU61 C 376 warning C174 Scs EnableHighPrecOsc unreferenced static function compiling myprintf c myprintf c 376 warning C174 Scs EnableHighPrecOsc unreferenced static function compiling read song string c read song string c 376 warning C174 Scs EnableHighPrecOsc unreferenced static function linking Program Size data 2673 near 2673 const 3949 near 3759 code 3206 creating hex file from XE164 XE164 O Error s 9 Warning s Simulation Application Note 127 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Make sure that the UConnect CAN XE164 is still connected to the host computer Real Time SignaEContr ll r 44 USB USB To UART JTAG Bridge USB Connection used for UART communication the USICO CHO UART RS232 serial interface is available via USB as a virtual COM port of the second USB channel of the FTDI FT2232 Dual USB to UART JTAG interface used for On Chip Flash Programming and Debugging first USB channel of the FTDI FT2232 Dual USB to UART JT AG interface the USB connection works also as the power supply Application Note 128 V2 0 2010 04 AP16175 Infineon XE164 Playing Music Connect your active l
11. d Alle gro und klein tralala lad ich zu uns ein i Ref Hey Pippi Langstrumpf Hey Pippi Langstrumpf song 1 code unsigned char songil T1800LL4AONOOL4DF DL2EL8GF EDL4C EOLAONOOL4C L2DF OLL4AONO OL4DF DL2EL8GF EDL4C EOLL4AONOO0L4C DP4P20LL4A ONOOL4DF DL2EL8GF ED L4C EOLAONOOL4C L2DF OLL4AONOOL4DF DL2EL8GF EDL4C EOLL4AONOOL4C DP4P200L2F L4F F L2GL4GL8GF L4EL8EEL4EL8EDL4C DEP4L2F L4F F L2GL4GF EEDC DP4L2F GAH O1L4DC 00L4HAGL2A01L4C 00L4HAGF L2G L4HAGF EL2F GL 4AF GAL2H 01L4DC 00L4HAGL2A 01L4C 00L4HAGF L2G L4HAGF EL2F EDP2 Application Note 161 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music 4 10 Song j Stille Nacht heilige Nacht Stille Nacht heilige Nacht song J code unsigned char song T7200L8G LI6AL8GL4E L8G LI6AL8GL4E 01L4DL8DO0L4H O1L4CL8COOL4G L 4AL8AOIL8C O0OLI6HL8AL8G LI6AL8GL4E L4AL8AO1L8C O0OLI6HL8AL8G L16AL8GL4 E O1IL4DL8DL8F L16DOOL8HO1L4C L4E L8C O0OLI6GL8EL8G LI6FL8DLIC Application Note 162 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music 4 11 Song k Junge komm bald wieder Junge komm bald wieder Jun ge komm bald wie der bald wie der nach Haus Jun ge d nie wie der G e G p EEH EE E Ze a EE m ee 7a jc Ze wie der hin aus Ich mach mir Sor gen Sor gen um dich Denk auch an mor gen G SSS
12. 9 myprintf note a else if note 10 myprintf note ais else if note 11 myprintf note h ir else if note 7 12 myprintf note S2B888 885828558HEZHHPHHESEEENNSESEEHESEEZ2SS3US3JSS 412 else myprintf notez2 3 an if octave 1 amp amp OctaveLOW OFF myprintf 00 415 else if octave 1 amp amp OctaveLOW ON myprintf tOL at else if octave 2 myprintf 01 417 else if octave 4 myprintf 02 410 else if octave 3 myprint 03 a9 else myprintt sprintf mb2 T12 pv 45u 5u current_note_length CCU61 T12PR myprintf mb2 sprintf mb2 T12 ps 1 2f 1 2f 5 current note length 124 12 1000 0 1000 0 CCU61 T12PR 124 12 1000 0 1000 0 5 myprintf mb2 sprintf mb2 T13 pv 5u 5u T13 values note octave CCU61 T13PR myprintf mb2 if OctaveLOW OFF help float T13_values note H helps help octave 60 606 1000 0 1000 0 1000 0 help 1 help sprintf mb2 T13 7 0 Hz n help myprintf mb2 vl KEESRSESBRSERESERSE Application Note 98 V2 0 2010 04 AP16175 Infineon XE164 Playing Music ax n else if OctaveLOW ON a 440 help float T13_values note nt he lp help octave 121 21 1000 0 1000 0 1000 0 A help 1 help a sprintf mb2 T15 f 7 0f Hz Xn help w myprint mb2 us 446 w IO vTogglePin IO P2 8 Toggle P2 8 Am CCU61 vStartTmr CCU TIMER 12 S
13. NOR c none Group 2 and Level 14 12 10 8 Configure PEC channel 3 Interrupt source Tor none Group 3 and Level 14 1 2 10 8 Configure PEC channel 4 Doo oot none Group 0 and Level 15 13 11 9 Configure PEC channel 5 O none Group 1 and Level 15 13 11 9 Configure PEC channel 6 De CH none Group 2 and Level 15 13 1 1 9 Configure PEC channel 7 DL none Group 3 and Level 15 13 11 9 XE b4F CASE b4 46 1b4 day fA Application Note 57 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Functions Initialization Function tick check M CCU6_vInit CCU61 Functions Function Library Part 1 tick M CCU61_vStartTmr CCU61 Functions Function Library Part 1 tick M CCU61_vStopTmr CCU61 Functions Function Library Part 1 tick M CCU61_vSetTmrPeriod CCU61 Functions Function Library Part 1 tick M CCU61_vEnableShadowTransfer CCU61 Functions Function Library Part 1 tick M CCU61 vLoadChannelShadowRegister File View Options Add Ins Windows da Dell nus DAVE XE164F Release v2 1 Y Capture Compare Unit 61 CCU61 jm ea 2 Initialization Function source File Bee OOOO File name SS Function Library Part 1 Function Library Part 2 jocuel_vStartfmr 0 CCUB1_viNodel0 Kouer weem 0 CCU61_viNodell r a _ Dy CCUB1 viNodel2 Kouer vSetTmPerod CCUB1_viNodels r CCU61_uwGetTmCounter GV Kuer uwSetTmCounter
14. break 569 case k next_song_k play song break 570 case l next_song_l play song break 571 case m next_song_m play song break 572 573 USER CODE END 574 575 576 57 End of function main o 578 579 Y gt Build Output TER Build target Target 1 assembling Start_V3 A66 v 4 gt Application Note 89 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Double click Main h and insert the following Defines define MAX SONG LENGTH 500 Y XE164 pVision4 File Edit View Project Flash Debug Peripherals Tools SVCS Window Help SO b Gaga o Ce f m ml a e Qec d PO Er NE Tae AA a 3 Target 1 Se Dave Files 038 7 s at ak ak AAA ok ab ok ak o ok ak AR o ok E ak o o ok ak o o oe ak o o ak ak AR oe eee ORO o ok ak ok ae ak ak ak oe ok Start V3 A66 99 Macros B 040 LH re ae E sk pk ek o o p ok v o v ok o o v e ok v o v e ok o o v ok ob o o oe ok v oe v o ok o o v e ok pb oe oe veo b ve o ve oe s oe oe ve oe ve o ve eke oe o e ov eo 2 MAIN C d ne 3 main h 042 USER CODE BEGIN MAIN Header 3 3 intrins h 043 Qxel6xregs h USER CODE END i n 045 l scs h c pene 3 io h 047 ff AR v v vk o ok ok ook o o o o o o ok o ok ob ok ook o ok v o v o ob o ok ob ok ob ok ook ov ok v o v ob o ob ok o ok ok ve oe ve o oe o oe o oe e oe se oe veo ve ok ve Ed L Bcc2 h 08 Defines i Eu 049 ff PE PE 9 v ek ok o ok ok ok e v ee o ok
15. lt stdlib h gt 15 include lt string h gt 16 include read song string h 147 USER CODE END Build Output Application Note 93 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Double click CC2 C change code CAPCOM 2 Timer 7 Interrupt Service Routine from if RS232 wait RS232 wait if blinking d IO_vTogglePin IO_P2_7 if RS232 wait RS232 wait IO vTogglePin IO P2 7 Application Note 94 V2 0 2010 04 AP16175 Infineon XE164 Playing Music Y XE164 pVision4 File Edit View Project Flash zes Peripherals Tools SVCS Window Help gg id d X 3a o mm mmissu usa amp ecod au i Target 1 33 Target 1 Sat 3 5 Dave Files 30 A Start_V3 A66 30 a MAIN C a 304 a SCS C An 3 IO C 306 3 UOCO C Date 17 04 2010 308 A USICO C 309 Jf PC Hv ak ok o v a ak ok v ok ke aka o ok o o o o o o o o ok o o ok o o ok o o ok o o ak o ee o ok v oe ve ke ee ke o oe ke oe ve ak oe ve ak oe ak ok ak ok v i3 CC2 C 310 a CCU61 C 31 USER CODE BEGIN Tmr7 1 gt User Files dm E myprintf c 33 USER CODE END i 314 35 void CC2_viTmr7 void interrupt CC2_T7INT 316 317 USER CODE BEGIN Tmr7 2 318 if RSZ232 wait 319 RS232 wait 320 321 IO vTogglePin IO P2 7 322 USER CODE END 323 324 End of function CC2_viTmr 325 326 327 328 3 USER CODE BEGIN CC2 General 10
16. um AP16175 Infineon XE164 Playing Music Insert Music Files Components Environment and Books Project Components Folders Extensions Books Project Targets QU Groups IXA Files x EE Dave Files mbrin Files Music Files Set as Current Target Add Files cancel lt ENTER gt OK Application Note 109 V2 0 2010 04 AP16175 Infineon XE164 Playing Music Y XE164 pVision4 File Edit View Project Flash Debug Peripherals Tools SVCS Window Help DS d a E E lle lla a za q Oe ER a d E 4 Target 1 AA n read song string h ES MAIN C dl MAIN H Er myprintf c Id S ecac x 1 extern void read_song_ string void 2 Target 1 3 5 Dave Files A Start_V3 A66 MAIN C 8 SCS C IO C s UOCO C s 8 USICO C CC2 C CCU61 C R a myprintf Files q myprintf Files myprintf c amp Music Files Music Files E Simulation Application Note 110 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music File New Y XE164 pVision4 BE nx File Edit View Project Flash Debug Peripherals Tools SVCS Window Help AENA en ERA ot EIA lms Open Strg 0 amp c ee i GEES Ir TE i iman Cl aan EI pointes Al ecco C 4 Save Strg S L read_song_string h ius Ed Save As extern void read song
17. 0 T12 mo T13 pv 56122 56122 T13 f 234 Hz T13 pv 56122 56122 T13 294 Hz T13 pv 50000 50000 T13 f 330 Hz T13 pv 56122 56122 T13 f 294 Hz T13 pv 42092 42092 T13 f 392 Hz T13 pv 44685 44685 T13 369 Hz T13 pva56122 56122 T13 f 234 Hz T13 pv 56122 56122 T13 f 294 Hz T13 pv 50000 50000 T13 f 330 Hz T13 pv 56122 56122 T13 f 294 Hz T13 pva37500 37500 T13 f 440 Hz T13 pv 42092 42092 T13 f 392 Hz T13 pv 56122 56122 T13 f 294 Hz T13 pv 56122 56122 T13 f 294 Hz T13 pva28061 28061 T13 f 588 Hz T13 pv 33401 33401 T13 f 494 Hz T13 pv 42092 42092 T13 f 392 Hz T13 pv 42092 42092 T13 f 392 Hz T13 pva44685 44685 T13 f 369 Hz T13 pv 50000 50000 T13 f 330 Hz T13 pv 31488 31488 T13 f 524 Hz T13 pv 31488 31488 T13 f 524 Hz Ti3 pva33401 33401 494 Hz 392 4 U t9 b X US CO b Q UI Y O UI UN UN A NH Q ui AP un o 09 EK KIK KKK KKK KK EA KEE KAN ll T em n n Tn em n n El n n n em n n El Tn n n n ee AERE y uU d 0 P 03 90 on ay 2 UP 99 30 UO wa 50 UP wa 16 u REEL LLL LLL LLLLLLZ T12 period value T12 period value 0 tempo 120 current tempo beats minute note length Note length tempo 120 current tempo beats minute Application Note 133 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Use any Logic Analyser LGA scope a
18. 0 1 po uci Soc Ge 12 0 6 31 TXDC1 CANT 1 2 3 4 5 6 e CANH Signal from CAN transceiver 16 CANL Signal from CAN transceiver Note For further information please refer to the XE164 UConnect Manual V 1 1 Application Note 8 V2 0 2010 04 AP16175 Infineon XE164 Playing Music CCUG Block Diagram general use Source Product Marketing address decoder dead time multi channel control control trap control output selec interrupt control capture compare input output control port control D c LN c b c LN c S a D c L c a A D e b d CCU6 Block Diagram BLDC use Source Product Marketing t channel O re T12 channel 1 trap channel channel 2 compare multi channel control ire noise compar T13 channel 3 filter capture compare input output control SA co co co D le IE 01010 181 gt 151 gt 8 alala D GIO OLI 24157 amp E 010191901009 QIOIO O port control Application Note 9 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU6 Block Diagram Source User s Manual module kernel decoder miz sera NN d channel 2 output select output select interrupt control port control ka at Lu aci P a Bd fa dl Bb al DI IS al Da ai Ia ei P un OCUS block diagram Application Note 10 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU6 Block Diagram Source XE166 User s Manu
19. 1 Timer 12 Resolution 66 MHz 256 T12PRE 1 done by software 32 8 056 64 Hz gt Resolution 124 12 us lt lt lt click here to see more information about music gt gt gt Application Note 31 V2 0 2010 04 Ce AP16175 Infineon XE164 Playing Music Note Unfortunately bit TI2PRE is not available in the DAVE dialog Source User s Manual The input clock for timer T12 can be from fccus to a maximum of fcecus 128 and is configured by bit field T12CLK In order to support higher clock frequencies an additional prescaler factor of 1 256 can be enabled for the prescaler of T12 if bit TI2PRE 1 3 Adobe Reader xe166 um v2 0 2007 12 vol2per pdf Chen ES 7 815 e TCTRO Timer Control Register 0 XSFR 2C Reset Value 0000 15 14 13 12 1 10 9 8 7 6 5 4 3 2 1 0 STE T13 T12 r rw rw rw rw rw Field Bits Type Description T12CLK Timer T12 Input Clock Select Selects the input clock for timer T12 that is derived from the peripheral clock according to the equation fr12 foce 2711200 000g fr12 foce 001g fr12 fcce 12 0105 fr42 fece 4 011g fr42 foos 8 100g fr42 fcce 16 101g fr42 fcce 132 1 108 fr12 fcce 64 1 115 fr42 fcce 128 T12PRE nw Timer T12 Prescaler Bit In order to support higher clock frequencies an additional prescaler factor of 1 256 can be enabled for the prescaler for T12 Og The additional prescaler for T12 is disabled 1g The additional prescale
20. 389 case 3 blinking ON myprintf n LED IO Port 2 7 BLINKIN 390 391 USER CODE END 392 4 Build Output Build target Target 1 assembling Start V3 66 compiling MAIN C compiling SCS C SCS C 582 warning C174 Scs lDelayByTimer unreferenced static function SCS C 551 warning C174 Scs lDelayByNops unreferenced static function compiling IO C IO C 376 warning C174 Scs EnableHighPrecOsc unreferenced static function compiling UOCO C UBDCO C 376 warning C174 Scs EnableHighPrecOsc unreferenced static function compiling USICO C USICO C 376 warning C174 Scs EnableHighPrecOsc unreferenced static function compiling CC2 C cc2 C 376 warning C174 Scs EnableHighPrecOsc unreferenced static function compiling CCU61 C CCU61 C 375 warning C174 Scs EnableHighPrecOsc unreferenced static function compiling myprintf c myprintf c 376 warning C174 Scs EnableHighPrecOsc unreferenced static function linking Program Size data 1101 near 1101 const 242 near 212 code 2790 creating hex file from XE164 XE164 O Error s 8 Warning s b d 4 Application Note 69 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Insert Change your application specific program Note DAVE doesn t change code which is inserted between USER CODE BEGIN and 4 USER CODE END Therefore whenever adding code to DAvE s generate
21. 56122 53061 50000 47278 44685 42092 39796 37500 35450 33401 275 ZS 0 c 1 cis 2 d 3 dis 4 e 5 f 6 f1s 7 g 8 g s 9 a 10 ais 11 h 12 lt Frequency for rest So we get the following values shown in the table below Note Timer 13 resolution 1 f 1x 4 1 66MHz 4 60 606 ns Octave 0 scaler for Td Period Perioc lue ue EE T13 values 1 59550 ess T13 values 2 56122 d 29a T13 values 3 53061 dis Fig values a sono er H8 Ti3 valuest 6 44688 sis mi3 values 7 423 a7 392 T13 values 8 39796 gis Tis values 91 3o am T13 values 10 35450 ais 1 rscvaluesQ2 27s fon Note If one note has a frequency of 400 Hz the note an octave above it is 800 Hz Further octaves of a note occur at 2 times the frequency of that note where n is an integer such as 2 4 8 16 LJ e g for a f 1 T13 period value x T13 resolution 1 37500 60 606 ns 440 Hz Application Note 144 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Note frequency Timer 13 octave OL Er On Se Ses Ea Far T 1 PI Ep x Ce WEE Gen Gee GE ee ee RANA fis EER UNN un AS A a Soe DE em E mu am za Ze LY 4 CLE Ce g LI 7 HA HH E GEUG DOS E EE E L i kontra Kontraoktave oktave gro e O
22. Add Ins Windows Dag AO ea DAVE XE164F Release v2 1 __ Y Capture Compare Unit 61 CCU61 2s o Module Clock Pin Control Timer 12 Timer 13 Mutti Channel Channels Trap Interrupt Configuration Interrupts ir 4 gt Control of pin CTRAP Trap Pin Control TRPPEN If input CTRAP is Disabled CTRAP 1 then trap can be CG SSES Z generated by SW by setting bit TRPF Note Available Pins are Pop PO z CTRAP c iinput CTRAR IS Enabled ETRARZO then trap can be is high generated by SW iVRPR 1 or by ClR AP oh Trap Mode Control TRPMO TRPMTj The trap state is left when a zero match of T12 while counting up is detected synchronization to T12 C The trap state is left when a zero match of T13 is detected synchronization to T13 C The trap state is left immediately after TRPF 0 without any synchronization to T12 or T13 Trap Mode Control TRPM2 Bit TRPF is automatically cleared by HW according to TRPPEN TRPM and TRPM1 C The trap state can be left as soon as bit TRFF is reset by SV according to TRPPEN TRPMO and TRPM1 Trap Interrupt Control ERR Interrupts Inerrupt Control and Inerrupt Node Pointer Configuration Enable trap interrupt ENTRPF CXXE 64XEI54 dav A Application Note 52 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Trap Interrupt Control Interrupt Configuration Interrupts Configuration drag and drop T12 Interrupts to Node 0
23. Home Country Roads song e const char songe T199O0L4DDE L2D P2L4EL8DL4EL2G P2L8AL4A L4H L2A L4EEEDL8EL4GL1GP ILADDE L2D LAEGGHLIHLAAAAAH L2A LA4EGGAL2G LAGALI HLSHALAGLI ALA4HAL1G LA4HOILADLIELAEEDOOLIHLSHAGALIHLSHALAGLIGLAGALI1G Es tanzt ein Bi ba butzemann song f const char songf J T19900L8DGGO 1DDOOHHGGAADDL4GP8L8DGGO 1DDOOHHGGAADDL4GP8L8 HAHOICOOAHOICDOOLSHAHOICOOAHOICDOODGGOIDDOOHHGGAADDLAG Ich geh mit meiner Laterne song g const char songg 2 T12000L8CLAFLSFAFAOIL4C OOLA4ALSFG L16GLS8GGAGLAF PA4OO0L8CLAFLSFA FAOILAC OOLAALSFG L16GL8GGAGLAF PA4O0L8AOILA4COOLSALAFLSAOILACOOLSALAF L8FGGGGAGL4FP4 00L8AO1L4COOL8AL4FL8AO1L4COOL8AL4FL8FGGGGAGL4FP4 The little drummer boy song h const char songh T120P200L2D L4EL2F L4F L4F L8GF L4GL2F P2L4DDEF L4F L4F L4F L8G F L4GL2F P2L4EF L4GAAAHL8AGL4F L2EP2L4EF L4GAAAHOIL8COOL8HL4AL2GL8 HAL4GL2F L8AGL4F L2EP1L2D L4EL4F F F F L8GF L4GL2F P1L8EDL4EL2D Hey Pippi Langstrumpf song 1 const char songi T1800LL4AQNOOL4DF DL2EL8GF EDL4C EOLAONOOL4C L2DF OLL4AONO OL4DF DL2EL8GF EDL4C EOLL4AONOOL4C DP4P20LL4AQONOOL4DF DL2EL8GF ED L4C EOLAONOOL4C L2DF OLL4AONOOL4DF DL2EL8GF EDL4C EOLL4AONOOL4C DP4P200L2F L4F F L2GL4GL8GF L4EL8EEL4EL8EDL4C DEP4L2F L4F F L2GL4GF EEDC DP4L2F GAH O1L4DC O0L4HAGL2A01L4C O0L4HAGF L2G L4HAGF EL2F GL 4AF GAL2H O1L4DC O0L4HAGL2A 01L4C O0L4HAGF L2G L4HAGF EL2F EDP2 Application Note 75 V2 0 2010 04 See AP16175 Infineon XE164 Playi
24. SVCS Window Help Dada majo cjen RAM E E S _ Ae ge G ligi Sie FE Tage AAA Project E MAIN c MAIN myprintf c Ej ia Target 1 066 lt i Dave Files 07 USER CODE BEGIN MAIN General 6 bes E Start_V3 A66 068 o E 063 USER CODE END B MAIN C m 5 d SCS C 071 mus IO C 072 FF FC s ovk o vk o v o v o ve o vb o ob ob vb o ob o ob ok ob ok o ok o ok ook oe ok oe ve ov v o ve o ve oe vb oe ob oe ob oe ob oe o oc oe oe ve oe oe oe ve eke ke ve o ve k oe o oe oe oo o UOCO C y3 Global Variables 074 Jf f 7 2 ek ok ve v ok v ok o o o o v b ee eke ee ok o ob ok o o o o ee v v ok ve b ok ve ob ok o ob ok ak ee ob eke oe ee ok eo oe ve e oe ve ok oe ve ok oe ok ok s i8 USICO C 3CC2 C e USER CODE BEGIN MAIN General 7 a A CCU61 C 07 const char menu 2 8 User Files OS 0793 a play Maus am Marsin E 3 myprintf c 0 b play Yesterday n 080 C play Frere Jacques Lazy John Bruder Jakobin 082 d play Happy birthdayin 03 e play Take Me Home Country Roads n 04 f play Es tanzt ein Bi ba butzemannin 05 g play Ich geh mit meiner Laterne n 088 h play The little drummer boy n i i play Hey Pippi Langstrumpf n 08 play Stille Nacht heilige Nachtin 09 k play Junge komm bald wieder n 00 l play Lili Marleenin 01 m play musical scale chromatic scale for testing purposein 02 z ba
25. Technologies Components may only be used in life support devices or systems with the express written approval of Infineon Technologies if a failure of such components can reasonably be expected to cause the failure of that life support device or system or to affect the safety or effectiveness of that device or system Life support devices or systems are intended to be implanted in the human body or to support and or maintain and sustain and or protect human life If they fail it is reasonable to assume that the health of the user or other persons may be endangered See AP16175 Infineon XE164 Playing Music AP08048 Revision History 2010 04 V2 0 Previous Version none Page Subjects major changes since last revision We Listen to Your Comments Any information within this document that you feel is wrong unclear or missing at all Your feedback will help us to continuously improve the quality of this document Please send your proposal including a reference to this document to mcdocu comments infineon com Application Note 3 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Table of Contents Page Note Table of Contents see page 12 and page 13 Introduction This Appnote is a Hands On Training Cookery Book step by step book It will help inexperienced users to get familiar with the CAPCOM 6 CCU6 module This step by step book is a follow up to AP16174 The purpose of this document is to gain k
26. Xnplaying Yesterday n 226 if next song c amp amp sizeof songc 1 lt MAX SONG LENGTH 227 strcpy song songc max sizeof songc 1 next song c 228 myprintf nplaying Frere Jacques Lazy John Bruder Jakob n 229 if next song d amp amp sizeof songd 1 lt MAX SONG LENGTH 230 strcpy song songd max sizeof songd 1 next song d 231 myprintf nplaying Happy birthday n 232 if next song e amp amp sizeof songe 1 lt MAX SONG LENGTH 233 strcpy song songe max sizeof songe 1 next song e 234 myprintf nplaying Take Me Home Country Roads n 235 if next song f amp amp sizeof songf 1 lt MAX SONG LENGTH 236 strcpy song songf max sizeof songf 1 next song f 237 myprintf Xnplaying Es tanzt ein Bi ba butzemann n 238 if next song g amp amp sizeof songg 1 lt MAX SONG LENGTH 239 strcpy song songg max sizeof songg 1 next song g 240 myprintf Xnplaying Ich geh mit meiner Laterne n Y 241 if next song h amp amp sizeof songh 1 lt MAX SONG LENGTH 242 strcpy song songh max sizeof songh 1 next song h 243 myprintf Xnplaying The little drummer boyXn 244 if next song i amp amp sizeof songi 1 lt MAX SONG LENGTH 245 strcpy song songi max sizeof songi 1 next song i 246 myprintf Xnplaying Hey Pippi Langstrumpf n 247 if next song j amp amp sizeof songj 1 MAX SONG LENGTH 248 strcpy
27. o ve o oe e oe ve v oe ak oe ve e oe veo ve e oe k k o License Management Print Setup USER CODE BEGIN CCU61 General 6 E pante Strg P USER CODE END Print Preview 1CCU61 C E Pk kkk ak ok E v o ok e o vk o eke o vk o ok v o ok o eke ok ook v o ok o ee ok ook o aka ee ok oe ee oe ve o ve oe ve o ve e oe ve oe e ke ak ok ok ok FA EA Global Variables 3 MAIN H LEER RR a ek ok ook o ok ok ok ok ok v ok v o o v oe e oe ok ook o ok o ok ob ok o v v o vb o v ak o e oe e ok o ok oe o o oe o oe o ve o ob ob ve ak ve o ve o ak ok ak oe v ur USER CODE BEGIN CCU61 General 7 5 myprintf c char mb2 500 message buffer for sprintf ENT float help USER CODE END 080 081 082 Ey FC v s v sb ok ak o ve ak ak ak ok oe aka ok oe ok ook o ok ob ok ob o ob o vb ob vb oe ve ee ee o e o o o ob ee ee oe vb oe vb ob vb ve v ve aE ve aE ve aE E aka aka k eo 03 External Prototypes Qg4 Y sk sk v ok ok ok ok ok o o o o o oo ok o ok ok ok ak ak ak ak ak ok ok ok ok ok ok o ab ob ob ob ob o o o o o ok ok ok ak ak ak ak ok ok ok ok ok ok ok o ob ob ob ob ob o ob o o o o o ak ak ok ak ok ok ok 085 086 USER CODE BEGIN CCU61_Generai 8 087 8 USER CODE END 083 030 091 Jf TC OR v kk e o o ok ok aaa ob ok v o ok o ok v o eke ee ok oo v ob eke ee ok o o ee ok v o o ob ok o ob o ok ve o ee eke oe ke oe ve ak oe ve o ak ok oe ak ok oe 02 Prototypes Of Local Functions 093 Kr FC ae sb v sb o ak o ak o ve ak e o ob o ob ee oe
28. ob ok ook ok ee ok o eke aE aE ok ee o oe ok eo veo ve o ve v ae aE ak ak ak oe ve ok veo ve t ak ok oe v demo i3 ccu61 h bo X 050 define KEIL EJ usicO h 051 re 3 uOcO h 02 define SEG func unsigned int unsigned long void far void func gt gt 16 i 3stdio h 03 define SOF func unsigned int void far void func i EA la Cty e h 054 E pes 05 USER CODE BEGIN MAIN Header 4 B ASCS C 056 define OFF 0 8 IO C o7 define ON 1 o D UOCO C 058 053 define MAX SONG LENGTH 500 BUSICO C 00 USER CODE END s CC2 C 061 063 KLEE v s ok o ok ok ok e o o o o o ok ob ok o ok ook veo v v o ob ok ob ok o ok ok ve ok ve o ve v o o ok o ok eo veo ve o ve o ve oe ak ak se oe veo veo ve ak oe ok oe v User Files 064 Typedefs 1 A myprintf c 085 A Y sk vk v ook v ak vk o ook E ak ak o o o ok ak ak o o o ak ak ak o o o E ak ak o o o o ak ak o o o o ak ak o o ob o ok ak o o o o ak ak o o oo ok ak ak o o E ak E eee eo 07 USER CODE BEGIN MAIN Header 5 063 USER CODE END 072 Jf f PCR Yo vk v s ok b ok ok e vk v p o v o vb ok ob ok ook ook ve oe ve v v pb o ob ok ob ok e ok ve o ak o o v o ob o o e o ve oe ve v ve v ve aE oc ak oe ve oe ve e ve ve t oe ok ov v on L L Oe en an ee A Jr e fe en 2 Tan en me 4 Build Output Application Note 90 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Double click Main h and change extern declarations Global
29. ok ook o ok o o ob oe o oe ob ve oe ve oe ve oe ve e ve oe se oe ve oe e oe oe ok ae 06 USER CODE BEGIN CCU61 General 7 07 char mb2 500 message buffer for sprintf 078 float help 0793 USER CODE END 082 ff T A ok e e o o ke v o o ok v ok ok o ok a o eke ee ok oo v o ka a ve o ok e o ee ok e ok v ee ake v o ve o oe E oe ve E oe ak oe ve e oe ake ok ak ok ke ve k oe 03 QExternal Prototypes 024 KR RA o ok ok v o o ok ok o o o ob ok o o ok ok eke ok o eke eke ee eke ee ok o ok v ok ok o o ak ak ok oe eee kee ve o oe ve o ve e oe ve ak aka ok ak ok oe ok 086 USER CODE BEGIN CCU61 General 8 08 USER CODE END 091 ff SOON ob ok o vb o ob ok oe ob ok ob ok v ob o o ok o vb o o oe o v eee ok o ob o b ee o b ee oe e a vb oe e ee ee ee eke o oe oe oe ok o 02 QPrototypes Of Local Functions 093 Jf f PR kk s ok o ok o o v o o o dae 05 USER CODE BEGIN CCU61 General 9 LL FELT Tisch LOL NTR cee GAZE Build Output Application Note 100 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music File New V XE164 pVision4 t Flash Debug Peripherals Tools SVCS Window Help GEB Pe n mirum A amp ec dj j a Save All ff PCR ek o sk eee ok ee v b ok o ee ok o o ok o ee eke ee ok oo ee eke ee ok oe ee ee k ee ee vb oe ve ok ve e oe ve oe ok ok ak ok ke v Device Database Imported Global Variables E Jf SOON ook o o ok oo o ob ok o o v ob ok o o o ob ok o o o ob ok v ob o ob
30. read song string void 029 030 unsigned char substr 4 0 0831 current note length old note length 03 switch song pos Application Note 117 V2 0 2010 04 Infineon Application Note AP16175 XE164 Playing Music 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 O66 067 068 069 070 071 072 073 074 075 076 077 078 073 080 081 082 083 034 085 086 087 088 089 030 091 032 093 034 095 select note case C note 0 switch song po03 case notett pos case octave note 11 post default case D note 2 switch song pos case notett pos case note pos default case E note 4 switch song pos case notett pos case note pos default case F note 5 switch song pos case notett pos case note pos default case G note 7 switch song pos case notett pos case note pos default case A note 9 switch song pos d case notett pos case note pos default case H note 11 switch song po03 case octave note 0 post case note pos default 118 break break break break break break bre
31. song songj max sizeof songj 1 next song j 249 myprintf nplaying Stille Nacht heilige Nacht n 250 if next song k amp amp sizeof songk 1 lt MAX SONG LENGTH 251 strcpy song songk max sizeof songk 1 next song k 252 myprintf nplaying Junge komm bald wieder n 253 if next song 1 amp amp sizeof songl 1 lt MAX SONG LENGTH 254 strcpy song songl max sizeof songl 1 next song 1 255 myprintf nplaying Lili Marleen n 256 if next song m amp amp sizeof songm 1 lt MAX SONG LENGTH a 257 strcpy song songm max sizeof songm 1 next song m 258 myprintf nplaying musical scale chromatic scale for testing purpose n 259 260 sprintf mbl song length 5u Byte s n max 261 myprintf mbl 262 pos 0 263 264 if max gt 0 there is something to play 265 266 start CCU61 Timer T12 ISR the first time 267 CCU61_ISS CCU61 IS 0x80 set STI2PM gt Set Timer T12Period Match Flag 268 268 while pos lt max wait until song end is reached or abort by user is done 270 271 Application Note 84 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music 272 if UOCO RBUF z myprintf Song aborted n else 278 sprintf mbl End of the song reached pos 5u of max 5u n pos max 279 myprintt mbl 280 281 282 2880 USER CODE END 284 285 286 Jf R9 A sk ek vk o pk ok oe vk o o p e ok vb e ok o o o
32. string void yu g Save All Device Database License Management Print Setup el Print Strg P Print Preview lread song string h 2 CCU61 C 30EZE 4 MAIN H 5 MAIN C 6 myprintf c Exit Build Output 4 Create an empty document Application Note 111 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Y XE164 pVision4 File Edit View Project Flash Debug Peripherals Tools SVCS Window Help Cee eae ee eo ce E JS I wor 1 ma n c Main H JE myprintfic nz DEST Texi2 vr i3 Target 1 2 6 Dave Files B Start V3 A66 a USICO C m BCC2 C ae Music Files Build Output Application Note 112 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Insert include main h include read_song_string h void SetOctaveNORMAL void OctaveLOW OFF clear Global Var able CCU6I vStopl mr CCU61 TIMER 13 Stop Timer 13 CCU61_TCTRO CCU61_TCTRO A OxFSFF prescaler factor is 4 clear TI3CLK CCU61_TCTRO CCU61_TCTRO 0x0200 prescaler factor is 4 set TI3CLK CCU61_vStartTmr CCU61_ TIMER 13 Start Timer 13 void SetOctaveLOW void OctaveLOW ON set Global Variable CCU6I vStopl mr CCU61 TIMER 13 Stop Timer 13 CCU61_TCTRO CCU61_TCTRO amp OxFSFF prescaler factor is 8 clear TI3CLK CCU61_TCTRO CCU61_TCTRO 0x0300 prescaler factor is 8 set TI3CLK CCU61_vStartImr CCU61_TIMER_13 Start Timer 1
33. 00g fr12 foce 001g fr12 fcce 12 0105 fr42 z fece 14 011g fr42 fcce 8 100g fr42 focs 16 1015 fr42 fcce 132 110g fr12 fcce 64 1 11a fr12 fcce 128 T12PRE nw Timer T12 Prescaler Bit In order to support higher clock frequencies an additional prescaler factor of 1 256 can be enabled for the prescaler for T12 Og The additional prescaler for T12 is disabled 1g The additional prescaler for T12 is enabled H 3 Wa 2900731 FS o Li m Hi Timer 12 Resolution 66 MHz 256 T12PRE 1 done by software 32 8 056 64 Hz gt Resolution 124 12 us Application Note 87 V2 0 2010 04 um AP16175 Infineon XE164 Playing Music Double click MAIN C and change the following code main function while 1 loop from myprintf menu select input switch select case 1 blinking OFF IO vResetPin IO P2 7 myprintf n LED IO_Port_2 7 ON p break case 2 blinking OFF IO vSetPin IO P2 7 myprintf n LED IO Port 2 7 OFF rt break case 3 blinking ON myprintf n LED IO Port 2 7 BLINKING n break j myprintf menu select input switch select case a next_song_a play_song break case b next_song_b play_song break case c next_song_c play_song break case d next_song_d play_song break case e next_song_e play_song break case T next_song_f play_song break case g next_song_g play song break case hr next
34. 1 Sharp edge mode v Driver of P2 12 P212 Strong driver Edge of P2 12 P2 12 XE164F CAXE164 XE164 day A Application Note 22 V2 0 2010 04 ur AP16175 Infineon XE164 Playing Music Parameters do nothing E DAVE Dis File View Options Add Ins Windows Sa DG ta 4 DAvE XE164F Release v2 1 4 Parallel Ports We M D Ports Functions Parameters Notes ea da 2 Port 2 Input Characteristic Output Characteristic Parameters D P20 0 A MO 2222 OP28 22 O P24 2 OP25 0 2 DO P26 0 2 NR lo R28 0 OP29 s L 0 b lo P210 0 lope O P212 XE164F CAXE164 XE164 day A Application Note 23 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Notes Insert Notes If you wish you can insert your comments here ed DAVE File View Options Add Ins Windows da Da 4 fos Si DAvE XE164F Release v2 1 Si Parallel Ports We BA 2 D Ports Functions Parameters Notes eta 2 Port 2 Input Characteristic Output Characteristic Parameters Notes Insert Notes XE164F CXXET64UXET64 dav A Exit and Save this dialog now by clicking Eai the close button Application Note 24 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Functions do nothing Spe BER File View Options Add Ins Windows 6 00 fus e DAvE XE164F Release v2 1 sd Parallel P
35. 1000008 TTO4WpT H8 1000098192 T110 HYP1009ZTTO HYAVOAAVDAPTOOOZ TL obuos aeyo 3suoo o buos qoyer repnig Ap T048 TAMA LOPIVYW7TV8 TAP ICS TOTTWS TAD PT TR TYST HFTOY HOODAASTSA AZTASTAIFTAHAH HITOHVETFAAZTAITTISTOOOZTL AaBuos aeyo 3suoo q Duos Aepreqsexz OHOODAAZASTAAFITO HA8 TOO IFTTOYETAFITOOSIFAITOZTYIASTOO DP TLODS8 THP 18dP dOODOTOZTIOS48 100 ITOFTYSTAFITOOOZTL ebuos aeuo 3suoo e Duos SI ue snow xxx SDUOS xxx oer oben yITm ejgou epoum e Jo yybueT jrnegeq fCLIOL e3ou aToym e Jo u3bueT Aut peubrsun YEEESSS coe pet OO WHEE MUU e noe Ser SAB gt 99Y A 218298 BHuttTomesse iT 3236181 2125181 prrng andino ping Se Jes Se SC SE DIE ege AAA det mopuifi SOAS soot sjeseydilag 6nqag ysejy pelo mal HPI eld puoisiArl p9T3X A 77 V2 0 2010 04 Application Note um AP16175 Infineon XE164 Playing Music Double click MAIN C and insert 3 3 Global Variables default values for global variables will be overwritten before use volatile unsigned int note 12 volatile unsigned int octave 1 volatile unsigned int current note length 161 13 volatile unsigned int old note length 1061 13 volatile unsigned int tempo 120 120 beats minute volatile unsigned int pos 0 current note volatile unsigned int max 0 song length song counters unsigned int next song a 0 song counter song a unsigned int next song bt
36. 3 void read song string void unsigned char substr 4 0 current_note_length old_note_length switch song pos select note case C note 0 switch song pos case note pos break case octave note 11 pos break default break break Application Note 113 V2 0 2010 04 Cinfineon AP16175 XE164 Playing Music case D note 2 switch song pos case note pos break case note pos break default break break case E note 4 switch song pos case note pos break case note pos default break break case F note 5 switch song pos case note pos break case note pos default break break case G note 7 switch song pos case note pos break case note pos default break break case A note 9 switch song pos case note pos break case note post break default break break case H note 11 switch song pos case octave note 0 pos case note pos default break break Application Note break break break break break 114 V2 0 2010 04 Cinfineon AP16175 XE164 Playing Music adjust note length case L switch song pos case 1 if song pos 6 current_note_length length_of_a_whole_note 16 els
37. 50 199 heats per minute Additional functionality OL activate octave LOW N deactivate octave LOW activate octave normal o0 01 02 03 W unsigned int T13_values 62977 59550 56122 53061 50000 47278 ff Timer T13 periods frequencies of the notes ff c I 9cis 2 2d 3 dis 4 e 5 amp ff 6 efis 7 eg 8 gis 8 sa 10 ais 11 9h f f 12 lt Frequency for rest unsigned int length of a whole note 16113 Default length of a whole note with tempo 120 USER CODE END 74 m d 44685 42092 39796 37500 35450 33401 275 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Double click MAIN C and insert 2 3 Global Variables Jj 795 Sones om Maus am Mars song a const char songa T12000L4FL8AL401C 00L8FEGL201C00P4P8L4EL8GO1L4C O0L8EFAL201CP4 PSOOLAFL8AOILAC OOLSFH OILADFLSFEDDCOOHO CDCOOH GL2F Yesterday song b const char songb T12000L8GL16FL2F P4ALSAHOIC DEFLAELSDL2D PSLSDDCOOH AGL4H L8AL4A L4GFL8AL2GL8DL4FL8AL2AAAL401DEFL8EDL4E L8DL4CEFCOOH AL8GL16FL2F P4L8AHOIC DEFL4EL8DL2D P8L8DDCOOH AGL4H L8AL4A L4GFL8AL2GL8DL4FL8AL2A Bruder Jakob song c const char songc T12000LA4FGAFFGAFAH OIL2COOLAAH OIL2CLSCDCOOLSH L4AFOIL8CDCOOLSH L4AFFCL2FL4FCL2F Happy birthday song d const char songd T12000L8DDL4EDGL2F L8DDL4EDAL2GL8DDL40 1DOOHL8GGL4F L4EO1L8C COOL4HGAL2G Take Me
38. AP16175 Infineon XE164 Playing Music CCU61 Channels Configure Channel 2 Control do nothing File View Options Add Ins Windows Dae 4 nos en WR GER Module Clock Pin Control Timer 12 Timer 13 Multi Channel Channels Trap Interrupt Configuration Interrupts Ir 4 gt 9 Configure CCU61 Channel 2 KR et M Dead Time Control Duty Cycle Required duty cycle 75 i 00 00 Enable dead time generation DTE2 Real duty cycle 26 i 00 00 Compare register 0000 CCUG1_CCEZSR Interrupt Control CC62 Interrupts Generate interrupt in compare mode if a compare match has been detected while T12 Is counting up or in capture mode if a rising edge has been detected at the pin CC62 ENCCB2R Generate interrupt in compare mode if a compare match has been detected while T12 is counting down or in capture mode if a falling edge has been detected at the pin CC62 ENCCB2F XE DAF C4xXE164 lt E164 day A Exit and Save this dialog now by clicking Es the close button Application Note 49 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Channels click Configure Channel 3 File View Options Add Ins Windows on Dau fus es ota Module Clock Pin Control Timer 12 Timer 1 3 Multi Channel Channels Trap Interrupt Configuration Interrupts Ir 4 A Cantigure Channel COBUO Configure Channel CC61 Channels Confi
39. Application Note V2 0 April 2010 AP16175 XE164 UConnect CAN XE164 Playing music Using the CAPCOM6 module Using DAvE Code Generator Using the KEIL tool chain pn VISTOn 4 IDE Compiler Utility Tools Microcontrollers en Never stop thinking Edition 2010 04 22 Published by Infineon Technologies AG 81726 M nchen Germany Infineon Technologies AG 2010 All Rights Reserved LEGAL DISCLAIMER THE INFORMATION GIVEN IN THIS APPLICATION NOTE IS GIVEN AS A HINT FOR THE IMPLEMENTATION OF THE INFINEON TECHNOLOGIES COMPONENT ONLY AND SHALL NOT BE REGARDED AS ANY DESCRIPTION OR WARRANTY OF A CERTAIN FUNCTIONALITY CONDITION OR QUALITY OF THE INFINEON TECHNOLOGIES COMPONENT THE RECIPIENT OF THIS APPLICATION NOTE MUST VERIFY ANY FUNCTION DESCRIBED HEREIN IN THE REAL APPLICATION INFINEON TECHNOLOGIES HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND LIABILITIES OF ANY KIND INCLUDING WITHOUT LIMITATION WARRANTIES OF NON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OF ANY THIRD PARTY WITH RESPECT TO ANY AND ALL INFORMATION GIVEN IN THIS APPLICATION NOTE Information For further information on technology delivery terms and conditions and prices please contact your nearest Infineon Technologies Office www infineon com Warnings Due to technical requirements components may contain dangerous substances For information on the types in question please contact your nearest Infineon Technologies Office Infineon
40. Bei je Y Start_V3 A66 MAIN C SCS C 310 C 9 UOCO C 43 USICO C 3CC2 C CCU61 C s User Files LI 2 myprintf c DA T AAA e Le CCU61 viNodelD void interrupt CCU6 Nodel0_INT ma USER CODE BEGIN NodeI0 2 USER CODE END if CCUOl IS amp 0x0080 if CCU6I1 IS T12PM Timer T12 period match detection USER CODE BEGIN Nodel0 19 if char UOCO RBUF z song aborted by user pos maxil if pos lt max read song string read next note T12 note length CCU61 T12PR float current note length float tempo i20 0 3 period value note length CCU61 CC60SR 0 not used 1003 duty cycle CCU61 CC61SR20 not used 100 duty cycle if compare value CCU6_CC625R 0 gt 100 8 duty cycle note length CCU61 CC62SR 0 CCU61 vEnableShadowTransfer CCU61 TIMER 12 T13 note frequency CCU61 T13PR T13 values note octave note frequency CCU61 _CC63ISR T13 _values note octave 2 duty cycle note frequency 50 4 El CCU61_vEnableShadowTransfer CCU61_TIMER_13 if note 0 myprintf noteec else if note 1 myprintf note cis else if note 2 myprintf notesd else if note 3 myprintf notesdis wl else if note 4 myprintf note e else if note 5 myprintf note f else if note 6 myprintf note fis else if note 7 myprintf notesg else if note 8 myprintf note gis else if note
41. C mp CCU61 vStopTmr CCUO61 TIMER 13 Stop Timer 13 2 USICO C ag 010 CCU61_TCTRO CCU61_TCTRO OxF8FF prescaler factor is 4 clear TI3CLK H CC2 C m CCU61_TCTRO CCU61 TCTRO 0x0200 prescaler factor is 4 set TI3CLK SS CCU61 C 012 g E s myprintf Files js CCU61_ vStartTmr CCU61 TIMER 13 Start Timer 13 ue 8 myprintf c m 3 Musis RR X Options for Group Music Files Alt F7 Open File BEEN Global Variable Open List File IMER 13 Stop Timer 13 Open Map File RO amp OxF8FF prescaler factor is 8 clear TI3CLK 4 RO 0x0300 prescaler factor is 8 set TI3CLK 5j Build target Ex Stop build Add Group oid Add Files to Group Music Files E Remove Group Music Files and its Files note length amp Manage Components Show Include File Dependencies 036 case C note 0 am mmm cs Le mann Fi tana A 4 Build Output vax A E MENU Simulation 1dMJll Z Application Note 123 V2 0 2010 04 Cinfineon AP16175 XE164 Playing Music Files of type select All files Mark read_song_string h and read_song_string c Add Files to Group Music Files Lookin SXE184 gier 21CC2 C 3cc2 H 3002 LST CC2 0BJ 5CCU61 C 5 CCUO61 H S CCU61 LST ICCU61 0BJ hello world ptp amp IO C 4 File name sITO H 8IO LST 110 0BJ MAIN C MAIN H MAIN LST IMAIN OBJ myprintf c myprintf LST imyprintf OBJ SISCS C 2ISCS H ISCS
42. CU61 Channels Configure Channel 1 Modulation Control for CC61 T12 Modulation Control for CC61 tick M Enable T12 modulation for CC61 File View Options Add Ins Windows let Den ftus Im ta Module Clock Pin Control Timer 12 Timer 13 Multi Channel Channels Trap Interrupt Configuration Interrupts Ir gt 112 Modulation Control for CC6 1 113 Modulation Control for CC5 1 7 Enable 112 modulation for CC61 TI2MODEN T Enable T13 modulation for CCS TI SMODEN Passive State Select CIC61PS Multi Channel Control for CC61 MCMPS e The compare output CC61 drives passive level while e CCB1ST is 0 Set ine OCG output to the passive state e The compare output CC61 drives passive level while c he 226 output can delwer ine Rih generated by COBIST is 1 112 or 113 Trap Control for CC61 Compare Output Control for CC61 PSL The passive level of CCE output is O r Enable the trap functionality of the output Pin CE6 1 TRPENJ C The passive level of CC61 output is T XE DAF CXXET64UCET64 dav 7 Application Note 42 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Channels Configure Channel 1 Modulation Control for COUT61 do nothing File View Options Add Ins Windows ou Osa sinus e m exa 2 Module Clock Pin Control Timer 12 Timer 13 Multi Channel Channels Trap Interrupt Configuration Interrupts Ir 4 A 112 Modulation Contro
43. EnableShadowTransfer CCU61_TIMER_ 13 Application Note 146 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music note length Timer 12 o va 4 S Le az 4 beats d 1 2 Nee 2 She TN J 1 4 Net 1 PETER LA 1 8 v CA Hi bed CPES 1 16 v E 1 4b ere The metronome a piece of equipment that repeats a regular beat used by musicians to help them play music at the right speed allows the exact definition of the tempo Application Note 147 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music So we get the following table for speed Beats per minute A O Largo Lento 40 60 Larghetto moderato Larghetto 60 66 Adag o moderato Adagio Adagio cantabile Andantino moderato Andantino Andante moderato Allegretto moderato ETT G O Modera Ls Allegro moderato o d O AE G O AT Presto moderato ss Prestissimo moderato 200 208 Note Our software supports 50 to 199 Beats per minute Tx Change tempo x And tempo 1s used in the following way CCU61 T12PR float current note length float tempo 120 0 period value note length Application Note 148 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music e g 7 120 means 120 beats minute 2 beats second gt 1 beat 0 5 second 3 9 west a NOS 4 1 1 0 5 0 5 s s note beat d 1 8 note 1 2 beat 1 2 0 5 0 25 S 1 16 no
44. GGL4F L4EO1L8C COOL4HGAL2G Application Note 154 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music 4 5 Song e Take Me Home Country Roads TAKE ME HOME COUNTRY ROADS 1 Al most heav en West Vir gin la Blue Ridge Moun tains Shen an do ah Riv er Life 1s old there ol der than the trees young er than the moun tains grow in like a breeze Coun try Roads take me home to the Place I be C G D EA d T A A E T Ber EA BEER Fe ELLE TR gr EE eh Pe mE a long West Vir gin ia mountain mom ma Take me C G AA AAA A AAA pm ee ren EE D RE Se Eer A BEE ee Ge BESTEN CERES ee EEE ee EAS e home Coun try Roads Take Me Home Country Roads song e code unsigned char songe T199O0L4DDE L2D P2L4EL8DL4EL2G P2L8AL4A L4H L2A L4EEEDL8EL4GL1GP ILADDE L2D LA4EGGHLIHLAAAAAH L2A LA4EGGAL2G LAGALI HLSHALAGLI ALA4HAL1G LA4HOILADLIELAEEDOOLIHLSHAGALIHLSHALAGLIGLAGALI1G Application Note 155 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music 4 6 Song f Es tanzt ein Bi ba butzemann Es tanzt ein Bi ba butzemann Volksweise HA ER DET ES E A de bb ies R tanztein Bi ba but ze mann in un sermHausher um anton KC AERE e BB 3 2 En az 5 TW nt 5 E _ EA Er r t telt sich er sch t telt sich er wirft sein S ck lein hin ter sich 1 ze NNI D LI PEN E i o O d J3 H Es tanztein Bi ba but ze mann in un se
45. ILAC OOLSFH OILADFLSFEDDCOOHO CDCOOH GLZ2F Note Thanks to Christian Perschl www perschl at The songstring above was written down by Christian while humming the melody Application Note 151 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music 4 2 Song b Yesterday Yesterday song b code unsigned char songb T12000L8GL16FL2F P4L8AHO1C DEFL4EL8DL2D P8L8DDCOOH AGL4H L8AL4A L4GFL8AL2GL8DL4FL8AL2ZAAAL401DEFL8EDL4E L8DL4CEFCOOH AL8GL16FL2F P4L8AHOIC DEFL4EL8DL2D P8L8DDCOOH AGL4H L8AL4A L4GFL8AL2GL8DL4FL8AL2A Note Thanks to Christian Perschl www perschl at The songstring above was written down by Christian while humming the melody Application Note 152 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music 4 3 Song c Bruder Jakob Bruder Jakob Franz sisches Kinderlied schl fst du noch schl fst du noch H rst du nicht die Glok ken h rst du nicht die Glok ken ding dong ding Bruder Jakob song c code unsigned char songe T12000L4FGAFFGAFAH O1L2COOL4AH O1L2CL8CDCOOL8H LA4AFOIL8CDCOOLS8H LAAFFCL2FLAFCL2F Application Note 153 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music 4 4 Song d Happy birthday Happy birthday Englisches Kinderlied you hap py birth day to birth day hap py birth day Happy birthday song d code unsigned char songd T12000L8DDL4EDGL2F L8DDL4EDAL2GL8DDL40 1DOOHL8
46. Je Ea KA Application Note 132 V2 0 2010 04 ec AP16175 Infineon XE164 Playing Music Insert select d Ka Docklight V1 7 Project Playing_Music d Maus am Mars gt Yesterday b play Maus am Mars Frere Jacques Lazy John Bruder Jakob o play Yesterday play Frere Jacques Lazy John Bruder Jakob play Happy birthday play Take Me Home Country Roads play Es tanzt ein Bi ba butzemann play Ich geh mit meiner Laterne play The little drummer bo play Hey Pippi Langstrump o play Stille Nacht heilige Nacht play Junge komm bald wieder play Lili Marleen play musical scale chromatic scale tor testing purpose back to main menu anytime pc ee your choice d playing Happy birthday isong length 70 Byte s Inote d O0 Ti2 pv 2014 T12 pz0 O0 T12 pv 2014 T12 px 0 O0 Ti2 pv 4028 T12 px0 O0 T12 pv 4028 T12 p 0 O0 T12 pv 4028 T12 pz0 notezfis O0 T12 pv 8056 TL2 p 1 notezd O0 Ti2 pv 2014 T12 pas0 OO T12 pv 2014 T12 ps0 O0 T12 pv 4028 T12 pz0 O0 T12 pv 4028 T12 pz0 O0 Ti2 pvs 4028 T12 pas0 OO T12 pv 8056 T12 p 1 O0 T12 pv 2014 T12 pz0 O0 T12 pv 2014 T12 pms0 Ol Ti2 pv 4028 T12 p 0 O0 Ti2 pv 4028 T12 p 0 00 Ti12 pv 2014 T12 pz 0 T12 pv 2014 TL2 p 0 Tl2 pv 4028 T12 p 0 Ti2 pv 4028 T12 p 0 T12 pv T12 p 0 T12 pvs T12 p 0 T12 p
47. L eingestrichene zweigestrichene dreigestrichene viergestrichene Okiave Oktave Oktave Oktave Oktave In our programming example we are going to use also the following period values for Timer 13 for octave OL unsigned int T13_values 62977 59550 56122 53061 50000 47278 44685 42092 39796 37500 35450 33401 275 ZS 0 c 1 c1s 2 d 3 dis 4 e 5 f 6 f1s 7 g 8 g1s 9 a 10 ai1s 11 H 12 lt Frequency for rest gt So we get the following values shown in the table below Note Timer 13 resolution 1 f 8 1 66MHz 8 121 21 ns IO T13 Prescaleres I13 Prescaler 4 Tp varuest 0 62977 ef SST 28 Ti vales 1 59550 vis MB rivales 2 56122 d 7 294 ria values tar 308 dis E T TI3 values 4 50000 1 5 200 ie fis E o E ee 4 5 6 T13 values T13 values Il3 values pris valves SI e Ge ELENA BE 37800 al 20 A0 frusvalues i0 a e T EEE 8 247 494 avatust m 30000 Application Note 145 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Therefore we use the following program sequence in our application T13 note frequency CCU61_T13PR T13_values note octave note frequency CCU61_CC63SR T13_values note octave 2 A duty cycle note frequency 50 CCU61_v
48. LST SCS OBJ Start V3 A66 3 Start V3 LST Start V3 OBJ UOCO C read song string h read song strinda c Ci Ely GEES ERR UOCO H Elread song string h 3 U0C0 LST JUOCO OBJ S1USICO C USICO H 3USICO LST lUSICO OBJ 1XE164 8l XE164 asm slXE164 dav HES hd E E E E E E E E E E Add Files of type All files hd Clase Click Add Click Close Application Note 124 Z V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Y XE164 pVision4 File Edit View Project Flash Debug Peripherals Tools SVCS Window Help PP FT Aca A a 8 Project EY TE read_song_string c R BE Os 00 wE include main h d pe finclude read song string h 003 04 void SetOctaveNORMAL void 0057 006 OctaveLOW OFF clear Global Variable IO 007 b me CCU61 vStopTmr CCU61 TIMER 13 Stop Timer 13 009 010 CCUO1 TCTRO E 011 CCU61 TCTRO 012 m3 CCU61 vStartTmr CCUO61 TIMER 13 Start Timer 13 214 CCU61_TCTRO OxF8FF prescaler factor is 4 clear TI3CIK CCU61_TCTRO 0x0200 prescaler factor is 4 set T13CLK OctaveLOW void 3 read_song_string h A read song string c eLOW ON set Global Variable CCU61_ vStopTmr CCUO61 TIMER 13 Stop Timer 13 CCU61 TCTRO CCU61_TCTRO OxF8FF prescaler factor is 8 clear TI3CLK CCU61 TCTRO CCU61 TCTRO 0x0300 presca
49. Music Summary In th s step by step book you have learned how to use the PWM Unit Have fun and enjoy working with microcontrollers with CCU6 modules Note There are step by step books for 8 bit microcontrollers e g XC866 XC88x and XC878 16 bit microcontrollers e g Cl6x XC16x XE16x and XC2xxx and 32 bit microcontrollers e g TC1796 and TC1130 All these step by step books use the same microcontroller resources and the same example code This means configuration steps function names and variable names are identical This should give you a good opportunity to get in contact with another Infineon microcontroller family or tool chain There are even more programming examples available using the same style e g ADC examples CAPCOM6 examples e g BLDC Motor Simulator examples C examples based on these step by step books Application Note 166 V2 0 2010 04 AP16175 Infineon XE164 Playing Music 5 Thanks To Maria Christian Hermann and Maureen for their support Application Note 167 V2 0 2010 04 eL AP16175 Infineon XE164 Playing Music 6 Feedback XE164 Playing Music Keil tools u Visiond Your opinion suggestions and or criticisms Contact Details this section may remain blank should you wish to offer feedback anonymously If you have any suggestions please send this sheet back to email mcdocu comments infineon com FAX 43 0 4242 3020 5783 Your suggestion
50. O0 01 02 03 unsigned int T13_values 62977 59550 56122 53061 50000 47278 44685 42092 39796 37500 35450 33401 275 Timer T13 periods frequencies of the notes 0 c 1 cis 2 d 3 dis 4 e 5 f 6 f1s 7 g 8 g s 9 a 10 a s 11 h 12 lt Frequency for rest gt unsigned int length_of_a_whole_note 16113 Default length of a whole note with tempo 120 Application Note 73 V2 0 2010 04 Infineon fi XE164 uVisiond AP16175 XE164 Playing Music 4 Start_V3 A66 4 MAIN C u asese 310 7 SUOCO C SUSICO C acce 4 CCU61 C User Files 3myprintf c a ha Build Output Application Note par DS PER 1m am Hr 103 304 ME 107 1 m ne m m2 Wa D I ns 116 ar 113 m3 Ghar mb1 500 ff message buffer for sprintf eng Maple ees yi Construction of the music data a EE EEE ER a ET EE EE EC EC C created by Christan Perschl www perschl at extended by Wilhelm Brezowvits CD E F G A H play note the raises jis note a semitone Cis Dis Eis Fis Gis Ais Ais the lowers Its note a semitone Cos Des Es Fes Goes As Has Lx Change note length x 1 2 4 8 16 gt Iewhols note Zehalf note quarter note PX play rest x 1 2 4 8 16 gt lsmwhole rast 2ehalf rest dequarter rest Ox Change octave x 0 1 2 3 e Extend preceding note by half of its value Tx Change tempo x
51. SES denk auch an mich Jun ge K bald wie der bald wie der nach Haus Jun ge fahr nie SS wie der nie wie der hin aus Ich wei noch wie die er ste Fahrt ver i ich Mut ter schlief Als sie er wach te war ich auf dem Im er sten Brief stand komm doch bald wie der her 2 Junge komm bald wieder Wohin die Seefahrt mich im Leben trieb ich wei noch heute was mir Mutter schrieb In jedem Hafen kam ein Brief an Bord und immer schrieb sie Bleib nicht so lange fort Junge komm bald wieder Junge komm bald wieder song k code unsigned char songk T12000L4DDL8C L8DL4EL4D OLL8HONOOL4EL4D OLL8HONOOL2C L4EEL8D LSEL4F L4E L8SEL4GL4F L4EL2D L4GGGEL2CL4GF L4EL2D L4F L4F L8EL4EL2DL4E L4D L8COLL2H ONOOL4DDL8C L8DL4EL4D OLL8HONOOL4EL4D OLL8HONOOL2C L4E ELSD LSELAF LAE LSELAGF LAAL2GPSLSDDDDDDDDDLADPSLSDLSD LSDDDDDLSD L8DL4DP8L8DL8EEEEEEL2GP8L8EL1DP8L8DL8EEEL4E P8L8GGGF L8GLIA Application Note 163 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music 4 12 Song I Lili Marleen Lili Marleen A SE Vor der Kaser ne vordem WS Tor stand ei ne La ter ne Und stehtsienoch da vor so woll nwir uns da E C SESS A wie der sehn bei der La ter ne woll n wir stehn wie einst Li li Mar leen wie einst Li li Mar leen 2 Unsre beiden Schatten 3 Schon rief der Posten 5 Aus dem stillen Raume sahn wie einer aus Sie blasen
52. T ASTA TO TAOTI H8 T3P 10002 11 7 Tuos aeuo 3suoo T buos aer 1111 JOPTIOTISOOOPT AZTAFT AF TOP TAST A THA TAg T 08 TAA PT OZ TOONOH8TTO AFTAFTOONOHSTTO AFTAFTAST DSTAAFITOOOZTL Aduos aeuo 3suoo y Duos Tepetm preq muoy obunp WPT APTOSTYOLT O8ST 8THOTT00 DSTTOYETYFT IF TOODSTIFTTO HFITOOASTAFITTO HFTOSTYITT S81 AEFTOSTYITT 98TOOZLL Puos aeuo 3suoo Duos 34O0 N ebrpreu FUN STITIS FTITOZAFAA IFTOONOYFTIOH IFTAI IISTAZTAH IA FTOONOYFTTO IAZIT IFTOONOYITOH IFTAH IISTAZTAHITFITOONOYFTITOOSTL TPuOs aeuo 3suoo r Duos jdunx3sbueg rddig Aay APIZIHZI HAF TOYS IHVVVOPI JHPIZd UIZTIOP ITJOSTITIP IFAIP IHAPIHAHOGP IZd F4Z TOP THIDS THAP TFAIP THUZ T4P T dZ 1002d0ZT1 ubuos aeuo 3suoo q Duos Aoq reuunzp e 331 ett OVeIO0OPd ZIP IDVODS IDOIT D48 TVPI00 OP TLOWAVASTAPTIOSTOOPd APTIOWOOSTOOTT OASTYP100 OP TLOWAVASTAPTOSTOOOZLLu 5buos zeuyo 3suoo 6 Duos eurezegy ToutTsu gra yeh yor SHHO0Odd 0950 0009 LOHY00D LOHWH8 10005 TOHY005 LOHWH8 1 8 dF TAC YY99HH0000 10990 81 8d DF TAD YY99HH000010990810066TL 3bu0s aeuo 3suoo 3 buos uuewmezyng eq Tg ure IzuU0I SW Vor vz HWWWYPTHTIHSSHFT AZT HAAFILTASTITOFTASTAHHH FT EZT HPT wbd OZISPICSTEPIZd AZT Hdd PTOO66TLu efuos aeyo 3suoo e Duos speoy Arno euong ew eyez ff DOZTZOHFITOOIISTTOHFT AFITODSTHOOATOFTAASTOZTYAHFTAAST AZTOAHFTAASTOOOZTL Pphuos aeuo 3suoo p Duos Aepyzrtq Addey d JZTOAPTAZTOAJAY T H8
53. TI 3MODEN Multi Channel Control for CC62 MCMPS Seine COO gitplt ta the passive state c he 2252 output Can deliver the Ei generated by 2er 11 Compare Output Control for CC62 PSL e The passive level of CC62 output is O C The passive level of CBZ output is T V2 0 2010 04 Infineon AP16175 XE164 Playing Music CCU61 Channels Configure Channel 2 Modulation Control for COUT62 do nothing File View Options Add Ins Windows n OH 403 2 Si DAVE XE164F Release v2 1 Im era 2 Module Clock Pin Control Timer 12 Timer 13 Multi Channel Channels Trap Interrupt Configuration Interrupts Ir 4 A 112 Modulation Control for CONTE Enable 112 modulation jor Cou le CT MODE Passive State Select COUTE2PS e he compare output COD T62 drives passive level while CUDZST is 0 The compare output COL be drives passive level while COOZST Is T Trap Control for COLTEZ r Enable the trapduncionalty afte output Ein TOUTES TRPE 113 Modulation Control for CONTE Enable 118 modulation jor ECUT62 1115 MODEN Multi Channel Control for COUTE2 IMCMPS Set ine EOLTBZ ouipotto the passive state c ine COUT62 output can deliver ine Bih generated By Tz or ils Compare Output Control for COUT62 FSL he passive level o HERR eet ee Ee Ek C The passie level ot COU Tbe outputis de XE DAF CXXET64UCE 164 dav A Application Note 48 V2 0 2010 04 See
54. Timer13 note frequency Playing music ZN WES at Wen oai Mi Application Note 5 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Note Port 0 pins used by our PWM module CCUOI P0 0 CCU61_CC60 100 note length Timer 12 100 note length Timer_12 50 note frequency Timer_13 e P0 6 CCU61 COUT63 50 note frequency Timer 13 Port 2 pins used as GPIO Comment User LED 2 Toggled via Software Nux DETIENE RE PEN c AES a AER Port pins used Pin CCUGI Channel Modulated by Purpose CC60 CCU61 Channel O Modulated by T12 show note length duty cycle 100 96 only for measurement PO 1 CC61 CCUOI Channel 1 Modulated by T12 show note length duty cycle 100 96 only for measurement CC62 CCU61 Channel 2 Modulated by T12 T13 Music Output note length modulated by note frequency only for measurement uud Sofwae startofnextnmote LED I __ Software rummimgsignal J Application Note 6 V2 0 2010 04 AP16175 XE164 Playing Music Using the UConnect CAN XE164 Application Note 7 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Used Pins on the On board header X400 of the UConnect CAN XE164 Source XE164 UConnect Manual On board header X400 15 13 11 7 5 3 1 16 14 12 8 6 4 2 Goud wv ren eem mo eroe T12HRC TI3HRC CCU6X 0 2 J6 TXDCO CANO 8 0 1 67 TXDCO CANO 10 0
55. Variables from extern volatile int RS232 wait extern volatile bit blinking extern volatile int RS232 wait extern unsigned int T13 values extern unsigned int length of a whole note extern char song extern volatile unsigned int note extern volatile unsigned int octave extern volatile unsigned int current note length extern volatile unsigned int old note length extern volatile unsigned int tempo extern volatile unsigned int pos extern volatile unsigned int max extern volatile bit OctaveLOW Application Note 91 V2 0 2010 04 Infineon Y XE164 pVision4 AP16175 XE164 Playing Music File Edit View Project Flash Debug Peripherals Tools SVCS Window Help amp Dave Files Start_V3 A66 B Es MAIN C i La main h Bintrins h 082 085 L 3 ctype h A SCS C DaF bed mals co es mmm IE IE IE dis a A e G ER A ff gt gt Pe e ek ek o ee ee ok o o o ok o o oe e ok v o k ok o o o o ok o o oe e ok o o v ve ok ob ve oe ve oe o ve o ve oe v ve o ve oe ve o ve oe e oe o ve oe e oe Imported Global Variables Df Ck sk v v ok ob o p o ok ob o v o ok o o oe USER CODE BEGIN MAIN Header 6 USER CODE END Lf PE PE kv ok ok o ok ook e ok v o o o o o ok o ok o ok e ok e o v o o o ok ob ok o ok ook v ok v o v vb o o ok o ok ok ve ok ve o ve o ve o oe e oe se oe ve oe ve ok ve o ak ok oe v Global Variables Jf f PR A ov
56. Window Help Da aa o EIE Ia AA Q e Sim 4 ETTET FF Tanger DA Um Project 3 vi LN MAIN H L myprintfce Dee 43 Target 1 CODE BEGIN MAIN Header 8 aa Dave Files 14 extern void myprintf const char p p A Start V3 A66 15 USER CODE END 116 s 8 MAIN C ns HB main h 118 E OOOO o oa 3 intrins h us Interrupt Vectors mu a xel6xregs h 120 E f A eR eee ook o vk o o o vb ok vb ok ob ok ob ok ok o oe v ob o ob ok ob ok ob ok ok oo Em h B Bera 122 USER CODE BEGIN MAIN Header 9 E bises 3 io h 123 cc2 h 14 USER CODE END ach E i3 usicO h 127 KLEE Re v s vk sk ok ok o vk e v o vb o o ok ob ok ob ok oe e oe v v o vb o ob ok o ok ok ve ok ve ve v v o ob oe oe e o ve oe ve v ve o ve oe e oe ve oe veo vet ve t ov ok ov ok E uOcO h 128 Project Includes 3stdio h 123 EL RER kv pk ek o o p o ok v o v ok o o v ok o o v ok o o v e ok ob o v oe ok v o v ok v o v e ok p oe o ve oe o ve o ve oe o ve o ve oe v ve o ve oe k oe o ve oe ok o actype h 181 include lt Intrins h gt RE 3 SCS C 132 E IO C 133 include XEl6xREGS H a e UOCO C 14 include SCS H 135 BUSICO C 185 include IO H 1 EC2 C 137 include CC2 H a 4 CCU61 C 133 include CCU61 H Ge User Files e include USICO H D 3 myprintf c 141 USER CODE BEGIN MAIN Header 10 142 include lt stdio h gt for sprintf for myprintf 143 include lt ctype h gt 14 Finclude
57. XE164 Playing Music The little drummer boy song h code unsigned char songh T120P200L2D L4EL2F L4F L4F L8GF L4GL2F P2L4DDEF L4F L4F L4F L8G F L4GL2F P2L4EF L4GAAAHL8AGL4F L2EP2L4EF L4GAAAHOIL8COOL8HL4AL2GL8 HAL4GL2F L8AGL4F L2EP1L2D L4EL4F F F F L8GF L4GL2F P1L8EDL4EL2D Application Note 159 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music 4 9 Song 1 Hey Pippi Langstrumpf Hey Pippi Langstrumpf 1 Zwei mal drei macht vier wi de wi de witt und drei macht neu ne Drei mal drei macht sechs wi de wi de wer wills von mir ler nen Ich mach mir die Welt wi de wi de wie sie mir ge f llt Al le gro und klein tra la la la lad ich zu mir ein Ref Hey Pip pi Lang strumpf tral le ri tral le ri tral ler hop sa sa Hey Pip pi Lang strumpf die macht was ihr ge f llt Ich hab ein Haus ein kun ter bun tes Haus ein Aff chen und ein Pferd die schau en da zum Fen ster Application Note 160 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music D G A D Seel ee El raus l hab ein Haus en ff chen und ein Pferd und Hm Em A D A D a fF 4 P TT LG IL E je der der uns mag kriegt un ser Ein mal eins ge lehrt 2 Zwei mal drei macht vier wide wide witt und drei macht neune wir machen uns die Welt wide wide wie sie uns gef llt Drei mal drei macht sechs wide wide wer will s von uns lernen
58. Zapfenstreich aus der Erde Grund Da wir so lieb uns hatten Es kann drei Tage kosten hebt mich wie im Traume das sah man gleich daraus Kamerad ich komm ja gleich dein verliebter Mund Und alle Leute solln es sehn Da sagten wir auf Wiedersehn Wenn sich die sp ten Nebel drehn wenn wir bei der Laterne stehn wie gerne wollt ich mit dir gehn werd ich bei der Laterne stehn u wie einst Lili Marleen mit dir Lili Marleen wie einst Lili Marleen o 4 Deine Schritte kennt sie deinen zieren Gang Alle Abend brennt sie doch mich verga sie lang Und sollte mir ein Leids geschehn Wer wird bei der Laterne stehn mir dir Lili Marleen Lili Marleen song code unsigned char songl T12000L4EL8E L16FL4GL4EL8F LI6FL8F O1L16COOL2HL8D L1I6DL8D LI6EL4FL 8F LI6GL8H LI6AL8G LI6FL4E L8CL4AL8H OIL1I6COOL4HL4AL4AL4GL4H L8AL4GL4FL 4A L8GL4FEL4G L8EL4G L8FL4FO1L4DL2CP400L4EL4G L8FL4FOLL4HONOOL2C Application Note 164 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music 4 13 Another song Lady Bird Lady Bird T1500NOOLAF P16F P16F P8L16C P16LSEPI16E P16L2ELSEP16LACHPL6CHP16C P16O0LLSAP16 L4HP16G P16L2EP40NOOL4F P16L8F P16L2F P4L4EP16L8E P16L2EP4L4C P16L8C P16L4C 0 LAP 16L4HP16G P16EP16L4EP16L8F P16L16F P16L1F P8L4G P16G P16G P16L8G P16F P16L1 F Note Thanks to Maureen Sturgeon She wrote down the songstring above Application Note 165 V2 0 2010 04 See AP16175 Infineon XE164 Playing
59. _song_h play_song break case 1 next_song_1 play_song break case UI next_song_j play_song break case k next_song_k play_song break case l next_song_l play_song break case m next_song_m play_song break Application Note 88 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Y XE164 uVision4 Dis File Edit View Project Flash Debug Peripherals Tools SVCS Window Help ECETIA A IEA ATL ARO EL e ES eu Ex E Target o A Project ax y X Target 1 544 lt Dave Files 545 Start V3 A66 546 enable CCU61 Timer T12 additional prescaler 1 256 prescaler of T12 m 5 CCU61 TCTRO CCU61 TCTRO 0x0008 3 MAIN C se USER CODE END e D SCS C a po 3 IO C 550 while 1 UOCO C EU qe 552 B e USICO C 553 USER CODE BEGIN Main 4 ix 5 CC2 C 554 myprintf menu a CCU61 C 555 select input 5 5 User Files h i 557 switch select myprintf c a 558 case air t next song a play song break 560 case Dir next song b play song break 561 case c next_song_c play_song break 562 case d next_song_d play song break 563 case e next_song_e play song break 564 case f tnext_song f play song break 565 case g t t next song g play song break 566 case h next_song_h play song break 567 case i next_ song i play song break 568 case j next_song_j play song
60. ak break break break break break break break break break break break break break break break break break break break break break E V2 0 2010 04 Infineon AP16175 XE164 Playing Music 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 148 149 Application Note adjust note length case L switch song pos case 1 case 2 case 4 case 3 default if song pos 6 current note length length of a whole note 16 else d pos current note length length of a whole note current note length length of a whole note 2 current note length length of a whole note 4 current note length length of a whole note 8 D F old note length current note length pos read _song_string break set rest case P switch song pos case IJ if song pos 6 break break break break break current note length length of a whole note 16 else pos current note length length of a whole note break case 2 current note length length of a whole note 2 break case 4 current note length length of a whole note 4 break case 8 current note length length of a whole note 8 break default break note 12 postt break adjust octave case O switch song pos
61. al CCU6 Module Kernel CC60 Ti2 cc61 7 channel B a MD Control uiui CC62 HEP 1 Clock olo E F 5 Control Start S ola oa T13 CC63 5 5 E E E S Compare O Interrupt 2 A2 42 3 Control SR 3 0 Input Output Control A j j j A A A A A 4 COU T60 CC60 COU T61 CC 61 COU T62 CC 62 lt a Z O O C C621N D A X e U O A O O T12HRI D A CCPOS1 D A CCPOS2 D A CTRAPID A X a ac a e C C60IN D A Port Control 4 D a 4 H H L3 4 H E h 4 E H 4 H Note Just by comparing the different sources of the CAPCOM 6 Module Block Diagrams Capture Compare Unit 6 CCU6 you should be able to get a picture of the module and to answer some of your initial questions Application Note 11 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Cookery book For your first programming example for the CCU6 Your CF Docklight V1 7 Project Docklight Settings Playing Music program File Edit Run Tools Help Stop Communication F6 Cok FS Han i EL Commmunication port open Colors8 Fonts Mode COMS Send Sequences Communication e ASCII HEX Decimal Binary Yesterday Frere Jacques Lazy Jahn Bruder Jakob Happy birthday Take Me Home Country Roads Es tanzt ein Bi ba butzernann Ich geh mit meiner Laterne The little drummer boy Hay Pippi Langstrumpf Sulle Macht heilige Macht play Maus am M
62. amp 3 CCU61 LST 3 myprintf LST 3UO0CO LST sIXE164 li Ie 7 524 2CCU61 0BJ Amyprintf OBJ AU0C0 OB sIXE164 H a A10 C ASCS C IUSICO C sIXE164 r My Network Pia Min ISCS H AUSICO H IXE164 r a File name El Save as type All Files v Cancel Build Output Application Note 103 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Insert read_song_string h Save As E su i aer eil e e o E 3O LST 3SCS LST SUSICO L Hista ry a Desktop 8CC2 C 210 0BJ SCS OB USICO C CC2 H MAIN C IGtart V3 A66 IXE164 3CC2 LST MAIN H S Start V3 LST XE164 2 CC2 0B 3 MAIN LST Start V3 0BJ sIXE164 c CCU61 C MAIN OB UOCO C 9IXE164 c CCU61 H myprintf c UOCO H IXE164 F 38 CCU61 LST 3 myprintf LST SUOCO LST sIxE164 i 21 CCU61 0BJ myprintf OBJ 2200C0 0BJ IXE164 BIO C AISCS C SIUSICO C IXE164 r IO H SCS H USICO H ZIXE164 r File name Saveastype JAI Files v Cancel My Network Pla Click Application Note 104 V2 0 2010 04 AP16175 Infineon XE164 Playing Music Mouse position Project Window Target 1 click right mouse button click Manage Components Y XE164 pVision4 File Edit View Project Flash Debug Peripherals Tools SVCS Window Help H MT IA 22 ARMARIO APN AAA d fai Target 1 Project ptions for Target Target Alt F7 string void Open List File en XE164 M66 RO AO Me F 2 Open Fi l
63. ara play Yesterday play Frere Jacques Lazy John Bruder Jakob play Happy birthday play Take Me Home Country Roads play Es tanzt ein Bi ba butzemann se play Ich geh mit meiner Laterne play The little drummer boy play Hey Pippi Langetrumpf play Stille Nacht heilige Nacht plays Junge komm bald wieder play Lili Marleen play musical scale chromatic scale for testing purpose back to main menu anytime MZ PAR Pree aan E Junge komm bald wieder Lili Marleen musical scale your choice u 3 zu m an cg SO E amp c hack to main menu Recenve Sequences Active Nare Sequence Chapter KKK i ur Step Recipes 1 Asymmetrical Edge Aligned PWM generation Single Shot Mode Timer12 Modulation Timer13 Playing music Application Note 12 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Appendix Recipes endix about music note length note frequenc endix CCUG use to create note length and note frequenc gt Tan endix songs used Feedback Thanks To Feedback Application Note 13 V2 0 2010 04 AP16175 Infineon XE164 Playing Music Do the UConnect CAN XE164 Cookery Book Note It is necessary to follow all instructions in the UConnect CAN XE164 Cookery Book AP16174 step by step as this is the basis for all instructions which will follow later Application Note v2 0 April 2010 y KE
64. ay A Application Note 18 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Ports click Configure Port 2 File View Options Add Ins Windows len Dux 4 203 2 DAVE XE164F Release v2 1 Gi Parallel Ports ea da 2 Ports Functions Parameters Notes Configure Port 0 Configure Port 1 Configure Port 4 Configure Port 5 Configure Port 6 Configure Port 7 Configure Fort 10 Configure Port 15 CXXET64AXCET64 dav A Application Note 19 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Port 2 Functionality tick M Use P2 8 as general IO Direction click Out File View Options Add Ins Windows 80 00 711003 4 DAVE XE164F Release v2 1 4 Parallel Ports We i A M D Ports Functions Parameters Notes 9 Configure Port 2 Functionality Direction Push Pull Open Drain Output Value n Out E Open drain E high C Out E Open drain E high C Out E Open drain E high C Out E Open drain F high C Out F Open drain F high Out E Open drain E high Out E Open drain FE high Out T Open drain T high Qut T Open drain M high Out E Open drain E high C Our E Open drain E high C Out E Open drain FE high C Out Open drain E high gt I Use P2 0 as general IO gt T Use P2 1 as general 10 gt I Use P2 2 as general IO 5 T Use P2 3 as general IO 5 I Use P2 4 as general IO gt Use P2 5 as general IO
65. c CCU61 Channels click Configure Channel 1 File View Options Add Ins Windows a 028 1803 r Capture Compare Unit 61 CCU61 Y Module Clock Bin Control Timer 12 Timer 13 Multi Channel Channels Trap Interrupt Configuration Interrupts Ir 4 A Channels Configure Channel CCB Configure Channel CEZ Configure Channel CCAS XE D r CAXET6AXET64 dav la Application Note 40 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Channels Configure Channel 1 Mode Selection Mode Selection for Capture Compare Channel 1 click Compare mode File View Options Add Ins Windows leta Deu alam Im a 2 Module Clock Pin Control Timer 12 Timer 13 Multi Channel Channels Trap Interrupt Configuration Interrupts Ir 4 A Mode Selection for Capture Compare Channel 1 MSELB1 C Disable capture and compare modes F Compare mode Use pins CCS and or COUT61 as outputs C Double register capture mode use pin CEST IN as Input Rising Falling edge Trigger C Double register capture mode 2 use pin CEST IN as input Rising edge Trigger Falling edge Trigger Double register capture mode use pin CC61 N as input f Double register capture mode 4 Use pin CEST IN as input Any edge Trigger C Hall sensor mode XE1 DAF CAXEIBAXE164 dar A Application Note 41 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music C
66. ck to main menu anytime n n 04 volatile int RS232 wait 2 05 char select 07 char mb1 500 message buffer for sprintf 08 USER CODE END 101 ff P Hook ak ak e pk aka aa aaa o ee o ok ob ok o ok o ok o ok o ok ook o ok o oe v o v o ak oe o o o oe o o ok ob ok o o ak oe oe oe ve oe ve o ve o ve o ve ak aka ak ok ok 102 External Prototypes ana ll 2b 2k ok 2k ok ok ok zE 2 ok ok ok 2k ok ok 2 ok ok ok 2k ok 2k ak ok ok ok zE ok zE ak zE ok ok ad ak ak ok ok ok 2 ok 2k ak o ok ok zE ok zE ak o ok ok ok ok ak ak o ok ok ad o ok ok ok ok ad oe at ok ak 2k Build Output Application Note 72 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Double click MAIN C and insert 1 3 Global Variables Music ZS Construction of the music data created by Christan Perschl www perschl at extended by Wilhelm Brezovits C D E F G A H play note the raises its note a semitone Cis Dis Eis Fis Gis Ais His the lowers its note a semitone Ces Des Es Fes Ges As Hes Lx Change note length x 1 2 4 8 16 gt 1 whole note 2 half note 4 quarter note Px play rest x 1 2 4 8 16 gt 1 whole rest 2 half rest 4 quarter rest Ox Change octave x 0 1 2 3 Extend preceding note by half of its value Tx Change tempo x 50 199 beats per minute Additional functionality OL activate octave LOW ON deactivate octave LOW activate octave normal
67. d case octave 1 break case l octave 2 break case 2 octave 4 break case 3 octave 3 break default if song pos L octave 1 SetOctaveLOW if song pos 2 N octave 1 SetOctaveNORMAL break pos read song string break 119 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music 150 tempo 151 case T pos 152 substr 3 0 string termination 153 if song pos 1 154 155 substr 0 song pos 156 substr 1 song pos 157 substr 2 song pos 158 159 else 160 161 substr 0 song pos 162 substr 1 song pos 163 substr 2 164 165 tempo atoi substr 166 pos 167 read song string break 169 default break 170 end case 172 extend note length by half 173 if song pos 174 f 175 old note length current note length 176 current note length current note length 3 0 2 0 177 pos 178 1800 if pos max pos y end read song string Build Output Application Note 120 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music File Save As Y XE164 uVision4 File Edit View Project Flash J New Strg N c Open strg O Close ll Save Strg S al Save All Device Database License Management Print Setup Print strg P Print Preview lread song string c 2 read song string h 3 CCU61 C 4 CC2 C 5 MAIN H 6 MAIN C 7 myprint
68. d code write it between USER CODE BEGIN and USER CODE END If you wish to change DAvE s generated code or add code outside these USER CODE sections you will have to insert modify your changes each time after letting DAvE regenerate code Application Note 70 V2 0 2010 04 Cinfineon AP16175 XE164 Playing Music Double click MAIN C and change Global Variables from const char menul n n n 1 LED IO Port 2 7 ON n 2 LED IO Port 2 7 OFF 3 LED IO Port 2 7 blinking n Mn volatile int RS232_wait 2 volatile bit blinking ON char select const char menul n n n a play Maus am Mars n b play Yesterday n C play Frere Jacques Lazy John Bruder Jakob n d play Happy birthday n play Take Me Home Country Roads n play Es tanzt ein Bi ba butzemann n g play Ich geh mit meiner Laterne n play The little drummer boy n play Hey Pippi Langstrumpf n play Stille Nacht heilige Nacht n play Junge komm bald wieder n play Lili Marleen n play musical scale chromatic scale for testing purpose n back to main menu anytime n n volatile int RS232 wait 2 char select char mb1 500 message buffer for sprintf Application Note 71 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Y XE164 uVision4 File Edit View Project Flash Debug Peripherals Tools
69. e pos current_note_length length_of_a_whole_note break case 2 current_note_length length_of_a_whole_note 2 break case A current_note_length length_of_a_whole_note 4 break case 8 current_note_length length_of_a_whole_note 8 break default break old_note_length current_note_length pos read_song_string break set rest case P switch song pos case 1 if song pos 6 current_note_length length_of_a_whole_note 16 else pos current_note_length length_of_a_whole_note break case 2 current_note_length length_of_a_whole_note 2 break case 4 current_note_length length_of_a_whole_note 4 break case 8 current_note_length length_of_a_whole_note 8 break default break j note 12 pos break adjust octave case OU switch song pos case 0 case 1 case 2 case 3 default Application Note octave 1 break octave 2 break octave 4 break octave 8 break if song pos L octave 1 SetOctaveLOW 115 V2 0 2010 04 AP16175 Infineon XE164 Playing Music if song pos N octave 1 SetOctaveNORMAL break pos read_song_string break tempo case T pos substr 3 0 string termination if song pos 1 substr O song pos substr 1 song pos substr 2 song pos else substr O song pos substr 1 song pos substr 2 tempo atoi substr pos read son
70. e 3 Es Build target F7 Translate File T EX Stop build Ge E H S Usi Add Group gj Add Files to Group Remove Item amp Manage Components Show Include File Dependencies Build Output 4 gt Configure file extensions books and environment Simulation Application Note 105 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Double click User Files VCS Window Help Busse are E C sn i dd ERUIT IDA 7 read_song_string h N extern void read song string void oe EN A on User Files Build Output Application Note 106 V2 0 2010 04 AP16175 Infineon XE164 Playing Music Insert myprintf Files lt ENTER gt Components Environment and Books Froject Components Folders Extensions Books Project Targets OT Groups OX Fils myprintf c myprintf Files SetasCurentTarget as Current SetasCurentTarget Add Files cancel Application Note 107 V2 0 2010 04 AP16175 Infineon XE164 Playing Music Click New Insert Components Enviro ent and Books S a x Project Components Folders Extensions Boor Project Targets KL S S Groups x44 iB New Insert myprintf Files New Insert Add Files Setas Current Target as Current Setas Current Target cancel Application Note 108 V2 0 2010 04
71. e Trigger Rising edge Trigger C Double register capture mode 3 Use pin EL6 1N as inputi Falling edge Trigger C Double register capture mode 2 use pin COO2IMN as Input C Double register capture mode 4 use pin EEG21N as inputi Any edge Trigger C Hall sensor mode XE DAF C1XE164 lt E164 day A Application Note 46 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Channels Configure Channel 2 Modulation Control for CC62 T12 Modulation Control for CC62 tick M Enable T12 modulation for CC62 CCU61 Channels Configure Channel 2 Modulation Control for CC62 T13 Modulation Control for CC62 tick M Enable T13 modulation for CC62 File View Options Add Ins Windows da Dep l Anaal DAvE XE164F Release v2 1 4 Capture Compare Unit 61 CCU61 WOR GE Module Clock Pin Control Timer 12 Timer 13 Multi Channel Channels Trap Interrupt Configuration Interrupts Ir A Si Configure CCU61 Channel 2 ea 2 112 Modulation Control for CCB2 Enable T12 modulation for CC62 T12MODEN Passive State Select CCS2FS e The compare output CCB2 drives passive level while CCBZST is 0 e The compare output CCB2 drives passive level while basis Trap Control for CCO2 Enable the trap functionality of the output Pin Cb I TRPEN XE DAF C4xXE164 lt E164 day E Application Note 47 113 Modulation Control for CCB Enable 113 modulation for CC62
72. e if note 10 myprintf note ais else if note 2 11 myprintf note h else if note 2212 myprintf note else myprintf notez if octave 1 amp amp OctaveLOW OFF myprintf O0 else if octave amp amp OctaveLOW ON myprintf OL else if octave 2 myprintf O else if octave 4 myprintf O2 else if octave 8 myprintf O3 else myprintf 2 sprintf mb2 T12 pv 5u 965u current note length CCUO61 T12PR myprintf mb2 Application Note 96 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music sprintf mb2 T12 p 1 2f 1 2f s current_note_length 124 12 1000 0 1000 0 CCU61_T12PR 124 12 1000 0 1000 0 myprintf mb2 sprintf mb2 T13 pv 5u 5u T13_values note octave CCU61_T13PR myprintf mb2 if OctaveLOW OFF help float T13_values note help help octave 60 606 1000 0 1000 0 1000 0 help 1 help sprintf mb2 T13 1 7 0f Hz n help myprintf mb2 j else if OctaveLOW ON help float T13_values note help help octave 121 21 1000 0 1000 0 1000 0 help 1 help sprintf mb2 T13 f 7 0f Hz n help myprintf mb2 j IO vTogglePin IO P2 8 Toggle P2 8 CCU61_vStartTmr CCU61_TIMER_ 12 Start next note T12 single shot j Application Note 97 V2 0 2010 04 AP16175 Infineon XE164 Playing Music Y 2558 a iy Project 3 Target 1 s Dave Files a
73. ee ok vk e o o v o pb ok ob ok o o veo veo ve o ve v ve aE oe ak oe ve oe vec ve k ve t oe ok oe v USER CODE BEGIN MAIN Header 7 extern volatile int RS232_ wait extern extern unsigned int T13 values unsigned int length of a whole note 3 IO C 00 extern char song Er UOCO C 091 E en an pi qs ee 02 extern volatile unsigned int octave 4e USICO C 03 extern volatile unsigned int current note length 8 8 LOZ 04 extern volatile unsigned int old note length E CCU61 C 05 extern volatile unsigned int tempo d User Files 06 extern volatile unsigned int pos L intf 097 extern volatile unsigned int max myprintf c 08 extern volatile bit OctaveLOW 099 100 101 102 103 104 105 40e USER CODE END KL PCR vk v v sk o b ok ook o ok o v o vb o vb ok ob ok ob ok o o o oe o ve o ob o ob ok ob o e ok o ok oe ve o ve o ob o o oe oe o oe oe ove o oe ve ob o oe e oe ve oe ve oe oe o oe t ov oe v Prototypes Of Global Functions E f PCR PE ov s ok o ok ok e o ok eo eoe ve v o o ok ob ok o ok ok e ok e o ve v o o oe o ok eo veo ve o ve v ve oe e oe ve oe veo vet ve 2k oe ok oe v 4 HL el NN Application Note 92 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Double click Main h and insert include files include lt stdlib h gt include lt string h gt include read_song_string h Y XE164 pVision4 File Edit View Project Flash Debug Peripherals Tools SVCS
74. eee ae 21 Function void MAIN vInit void on 23 24 Description This function initializes the microcontroller 2235 28 27 Returnvalue None 228 23 20 Parameters None 201 Build Output Build target Target 1 assembling Start V3 A66 Application Note 81 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Double click MAIN C and insert the function play_song void play_song void d max 0 if next song a amp amp sizeof songa 1 lt MAX SONG LENGTH strcpy song songa max sizeof songa 1 next song a myprintf nplaying Maus am Mars n if next song b amp amp s zeof songb 1 lt MAX SONG LENGTH strcpy song songb max sizeof songb 1 next song b myprintf nplaying Yesterday if next song c amp amp sizeof songc 1 lt MAX SONG LENGTH strcpy song songc max sizeof songc 1 next song c myprintf nplaying Frere Jacques Lazy John Bruder Jakob Wn if next song d amp amp sizeof songd 1 lt MAX SONG LENGTH strcpy song songd max sizeof songd 1 next song d myprintf nplaying Happy birthday WM if next song e kx sizeof songe 1 lt MAX SONG LENGTH strcpy song songe max sizeof songe 1 next song e myprintf nplaying Take Me Home Country Roads n if next song f amp amp si
75. er T12 additional prescaler 1 256 prescaler of T12 5 CCU61 TCTRO CCUG1 TCTRO 0x0008 548 USER CODE END 549 550 while 1 551 552 553 USER CODE BEGIN Main 4 554 myprintf menu 555 select input 556 557 switch select 558 559 case 1 blinking 0FF IO vResetPin IO P2 7 myprintf Xn LED IO Port_2 7 ON 560 case 2 blinking OFF IO vSetPin IO P2 7 myprintf Xn LED IO Port 2 7 OFF 561 case 3 blinking 0N myprintf Xn LED IO Port 2 7 BLINKING Xn i 562 563 USER CODE END ros 4 Build Output Build target Target 1 assembling Start_V3 A66 4 Application Note 86 V2 0 2010 04 Ce AP16175 Infineon XE164 Playing Music Remember Unfortunately bit TI2PRE is not available in the DAVE dialog Source User s Manual The input clock for timer T12 can be from fccus to a maximum of fcecus 128 and is configured by bit field TI2CLK In order to support higher clock frequencies an additional prescaler factor of 1 256 can be enabled for the prescaler of T12 if bit TI2PRE 1 3 Adobe Reader xe166 um v2 0 2007 12 vol2per pdf le ix TCTRO Timer Control Register 0 XSFR 2C Reset Value 0000 15 14 13 12 11 0 9S 8 7 6 5 4 3 2 1 0 STE T13 T12 r rw rw rw rw Field Bits Type Description T12CLK Timer T12 Input Clock Select Selects the input clock for timer T12 that is derived from the peripheral clock according to the equation fr12 foce 2711200 0
76. erenced static function compiling CCZ C CC2 C 376 warning C174 Scs EnableHighPrecOsc unreferenced static function compiling CCU61 C CCU61 C 376 warning C174 Scs EnableHighPrecOsc unreferenced static function compiling myprintf c myprintf c 376 warning C174 Scs EnableHighPrecOsc unreferenced static function compiling read song string c read song string c 376 warning C174 Scs EnableHighPrecOsc unreferenced static function linking Program Size data 2673 near 2673 const 3949 near 3759 code 8206 creating hex file from XE164 XE164 O Error s 9 Warning s Load C XE164 XE164 Erasing Erase Done Programming Done Verify OK Application running gt Simulation A Application Note 131 V2 0 2010 04 ec AP16175 Infineon XE164 Playing Music Go to Docklight and see hear enjoy the result d Docklight V1 7 Project Playing_Music play Maus am Mars play Yesterday play Frere Jacques Lazy John Bruder Jakob play Happy birthday play Take Me Home Country Roads play Es tanzt ein Bi ba butzemann play Ich geh mit meiner Laterne play The little drummer boy play Hey Pippi Langstrumpf play Stille Nacht heilige Nacht play Junge komm bald wieder play Lili Marleen play musical scale chromatic scale for testing purpose back to main menu anytime NSRPAU r TORO Oo D your choice pepe peje
77. errupt in compare mode if a compare match has been detected while T12 is counting down or in capture mode if a falling edge has been detected at the pin CC61 ENCCBITF XE DAF CXXET64UCET64 dav A Exit and Save this dialog now by clicking Es the close button Application Note 44 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Channels click Configure Channel 2 File View Options Add Ins Windows leta Dau itis Ey DAVE XE164F Releas Si Capture Compare Unit 61 CCU61 es da Module Clock Pin Control Timer 12 Timer 13 Multi Channel Channels Trap Interrupt Configuration Interrupts Ir 4 gt Configure Channel CEQ Configure Channel CCB T Channels Configure Channel CEES XE B4F CXXET64XET64 dav A Application Note 45 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Channels Configure Channel 2 Mode Selection Mode Selection for Capture Compare Channel 2 click Compare mode File View Options Add Ins Windows leta Dg 803 2 3 DAvE XE164F Release v Im a 2 Module Clock Pin Control Timer 12 Timer 13 Multi Channel Channels Trap Interrupt Configuration Interrupts Ir 4 A Mode Selection for Capture Compare Channel 2 MSEL62 C Disable capture and compare modes E Compare mode Use pins CC62 and or COUT62 as outputs Double register capture mode use pin CEBZIN as input Rising Falling edg
78. f c Exit Application Note 121 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Insert read_song_string c Save in XE164 ScBr Br 1CC2 C ZITO OBJ ISCS OBJ IXE164 nu CC2 H MAIN C siStart V3 A66 XE164 2CC2 LST MAIN H AStart_V3 LST 1XE164 up dcC2 0BJ IMAIN LST start V3 OBJ ZIXE164 log CCU61 C IMAIN OBJ UOCO C IXE164 CCU61 H myprintf c UOCO H sIXE164 Tes CCU61 LST myprintf lST U0CO LST XE164 ce CCU61 0BJ Imyprintf OBJ IUOCO OBJ sIXE164 TERES hello world ptp read song string h USICO C sXE164 l IO C SCS C USICO H ZIXE164 2 10 H 2 SCS H 3 USICO LST XE164 310 LST SSCS LST USICO OBI ZIXE164 H File name read song string c Save as type Click Save Application Note 122 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Mouse position Project Window Music Files click r ght mouse button Click Add Files to Group Music Files Y XE164 pVision4 File Edit View Project Flash Debug Peripherals Tools SYCS Window Help DS dh s aa or ceo pe m IC EE SE IE Hig ab A a e Qe 94 o er y Target 1 DA hm A Project os 7 read_song_string c 1cc2 c 1 ccus ES x Target 1 o a include main h 3 5 Dave Files 002 Binclude read song string h a Start_V3 A66 ue T MAIN C SetOctaveNORMAL void B 35C5 C 006 OctaveLOW OFF clear Global Variable BIO C 007 8 UOCO
79. g string break default break end case extend note length by half if song pos d old_note_length current_note_length current_note_length current_note_length 3 0 2 0 pos j if pos max pos end read song string Application Note 116 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Y XE164 pVision4 File Edit View Project Flash Debug Peripherals Tools SVCS Window Help DEA aa oc e jl szene rs AK Q e osea Project uS WW read_song_string c MA m MAI L3 myprin alla gt x 00 include main h P Be include read song string h 04 void SetOctaveNORMAL void o5 f 006 OctaveLOW OFF clear Global Variable oe CCU61 vStopTmr CCU6l TIMER 13 Stop Timer 13 9 USICO C mo CCU61_TCTRO CCU61_TCTRO amp OxF8FF prescaler factor is 4 clear TI3CLK e i CC2 C 0 CCU61_TCTRO CCU61 TCTRO 0x0200 prescaler factor is 4 set TI3CLK amp 8 CCU61 C 012 amp myprintf Files CCU61 vStartTmr CCU61 TIMER 13 Start Timer 13 ES 2 myprintf c ns Music Files me void SetOctaveLOW void 07 08 OctaveLOW ON set Global Variable 000 CCU6l vStopTmr CCU61 TIMER 13 Stop Timer 13 022 CCU61_TCTRO CCU61 TCTRO OxF8FF prescaler factor is 8 clear TI3CLK 023 CCU61 TCTRO CCU61_ TCTRO 0x0300 prescaler factor is 8 set TI3CLK 025 CCU61 vStartTmr CCUO61 TIMER 13 Start Timer 13 Qe 028 void
80. gure Channel Cb XE DAF C1XE164 lt E164 dav A Application Note 90 V2 0 2010 04 Infineon AP16175 XE164 Playing Music CCU61 Channels Configure Channel 3 Control Compare Timer 13 Output Control tick M Enable alternate output function COUT63 File View Options Add Ins Windows de Dem hus ei DAVE XE164F Release v2 1 OS 4 Capture Compare Unit 61 CCU61 m ota 2 Compare Timer 13 Qutput Control a ee alternate output function COUT6S for the PWM signal generated by T13 ECT130 Trap Control for COUT6S r Enable the trap functionality of the output pin COUT6S TRPENT3 Passive State Select COUTESPFS e The compare output COUT6S drives passive level while CCBSST is 0 The compare output COLT63 drives passive level while COBSST is T Compare Output Control for COUTBS3 PSLB3 The passive level of COUTES output is 0 C The passive level of COUTES output is T Duty Cycle Required duty cycle 25 UU Uu i UU Uu oxo000 Real duty cycle 25 Compare register CCLUIB CCOSSR 113 Modulation Control T131M 13 output is not inverted C 713 output is inverted for further modulation XE DAF CAE 16446164 day A Exit and Save this dialog now by clicking Bai the close button Application Note V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Trap Interrupt Control click Interrupt Configuration File View Options
81. he compere output COUT GO drives passive level c Ihe COUT6O output car deliver ine PYM generated while COSUST is 1 by 112 or 113 Trap Control for COUT60 Compare Output Control for COUT60 PSL Ihe passive level of COUT60 ouiputis 0 Enable ine irap functionality of te output Pin E NE OODUT60 TRPEN C The passive level of COD T60 outputs 1 XE164F CXXET64UXET64 dav A Application Note 38 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Channels Configure Channel 0 Control do nothing File View Options Add Ins Windows dt e al us EES Module Clock Pin Control Timer 12 Timer 13 Multi Channel Channels Trap Interrupt Configuration Interrupts Ir Dead Time Control Duty Cycle Required duty cycle 76 i 00 00 Enable dead time generation DTEO Real duty cycle 96 i 00 00 Compare register 00000 CCU81 CC60SR Interrupt Control CC60 Interrupts Generate interrupt in compare mode if a compare match has been detected while T12 is counting up or in capture mode if a rising edge has been detected at the pin CC60 ENCC60R Generate interrupt in compare mode if a compare match has been detected while T12 is counting down or in capture mode if a falling edge has been detected at the pin CC60 ENCC6OF XE164F C1XE1641XE164 dav A Exit and Save this dialog now by clicking kb the close button Application Note 39 V2 0 2010 04 See AP16175 Infineon XE164 Playing Musi
82. ile volatile volatile volatile unsigned unsigned unsigned unsigned int int int int note 12 octave 1 current note length 16113 old note length 16113 amp User Files 168 volatile myprintf c 168 volatile 10 volatile int int int unsigned unsigned unsigned tempo 120 120 beats minute pos 0 current note max 0 song length 172 song counters 173 unsigned int next song a 0 174 unsigned int next song b 0 15 unsigned int next song c 0 16 unsigned int next song d 0 17 unsigned int next song e 0 178 unsigned int next song f 0 173 unsigned int next song g 0 180 unsigned int next song h 0 181 unsigned int next song i 0 182 unsigned int next song j 0 183 unsigned int next song k 0 184 unsigned int next song 1 0 185 unsigned int next song m 0 song counter song counter song counter song counter song counter song counter song counter song counter song counter song counter song counter song counter song counter song a song b song song song song song song song song song song song SL Sei ds Bug MD aa 17 volatile bit OctaveLOW OFF 189 USER CODE END Build Output Build target Target 1 assembling Start V3 A66 4 79 V2 0 2010 04 Application Note See AP16175 Infineon XE164 Playing Music Double click MAIN C and change function char input void fro
83. ing ON myprintf Xn LED IO Port 2 7 BLINKIP V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Project Rebuild all target files Y XE164 uVisiond File Edit View Project Flash Debug Peripheral New yVision Project New Multi Project Workspace Open Project Close Project Export Manage Select Device for Target Remove Item 3 5 Dave Files 2 Translate C XE164 MAIN C dE nn Stop build Sta rt V3 A66 afb 1 C XE164 XE164 uvproj m MAI N C aff SCS C u IO C 380 UOCO C ad USICO C CC2 C 304 CCU61 C 385 Ele amp User Files Application Note 68 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Y XE164 pVision4 File Edit View Project Flash Debug Peripherals Tools SVCS Window Help DAA cad Lo o eru oe A e o o d PERA ARABE ZI 2 mam mann mointi oac i 374 ZA USER CODE BEGIN Main 3 yy amp Dave Files 35 while RS232 wait SStart V3 A66 376 USER CODE END m ge 377 MAIN C e while 1 A SCS C on Se IO C 380 33 UOCO C 381 USER CODE BEGIN Main 4 u 382 myprintf menu 1 USICO C 383 select input pe 8 CC2 C 384 N 3 CCU61 C 385 switch select amp User Files eg m ntf 387 case 1 blinking OFF IO vResetPin IO P2 7 myprintf n 4 ES 4j myprintf c 388 case 2 blinking OFF IO vSetPin IO P2 7 myprintf n I
84. ion4 File Edit Vw Project Flash Debug Peripherals Tools SVCS Window Help eda a d m mmm us js ar Q a celaya se LG 3 mE Target 1 z N A Gi 3 Target 1 550 while 1 a 3 5 Dave Files 551 3 Start_V3 A66 552 MAIN 553 if USER CODE BEGIN Main d u 554 myprintf menu 35C5 C 555 select input a e IO C 556 a 8 UOCO C 557 switch select n 558 B USICO C 559 case air next_song_a play song break 2 8 CC2 C 560 case b next song b play song break CCU61 C 561 case c ttnest song c play song break d myprintf Files 562 case ne next_song d play song break h ntf 563 case e next_song_e play song break a myprint C 564 case f next_song_f play_song break Music Files NS 565 case a next sona a nlavw sona l break be Build target Target 1 assembling Start V3 A66 compiling MAIN C compiling 5C5 C 303 C 582 warning C174 Scs lDelayByTimer unreferenced static function SCS C 551 warning C174 Scs lDelayByNops unreferenced static function compiling IO C IO C 376 warning C174 Scs EnableHighPrecOsc unreferenced static function compiling UOCO C UDOCO C 376 warning C174 Scs EnableHighPrecOsc unreferenced static function compiling USICO C USICO C 376 warning C174 Scs EnableHighPrecOsc unref
85. j Qjoecoe aa ade lx Target KAR FE 2 MAIN UE wd am ais LU oca L oe Amd m Target 1 550 while 1 a 3 5 Dave Files 551 2 Start_V3 A66 552 s 8 MAIN C 553 USER CODE BEGIN Main 4 S 554 myprintf menu SSC 555 select input 3 A IO C 556 9 UOCO C 557 switch select 558 ausIco c 559 case air next_song_a play_song break SE CC2 C 560 case b next_song_b play_song break 4 A CCU61 C 561 case c next_song_c play_song break 3 5 myprintf Files 562 case HT next_song d play song break Lm ntf 563 case e next_song_e play song break i myprint c 564 case f next_song f play song break 3 5 Music Files 565 case g next_song_g play_song break 3read song string h 566 case hir next_song_h play_song break u read song stringe case lil ttnext_song_i play_song breaks S 4 Build target Target 1 assembling Start V3 A66 compiling MAIN C compiling SCS C SCS C 582 warning C174 Scs lDelayByTimer unreferenced static function 303 C 551 warning C174 Scs lDelayByNops unreferenced static function compiling I0 C IO C 376 warning C174 Scs EnableHighPrecOsc unreferenced static function compiling UOCO C UDCO C 376 warning C174 Scs EnableHighPrecOsc unreferenced static function compiling USICO C
86. k o o ok o o o o ok p o ok v o ok o oe ok o o o o o o o o o oe ok v ve o vb ve ke b ve oe e oe o ve oe aE ve e k o v e oe ok 287 Function void MAIN vInit void 288 289 230 281 292 293 294 295 26 QParameters 237 aan 4 Build Output Build target Target 1 assembling Start_V3 A66 4 Application Note 85 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Double click MAIN C and insert the following code into the main function enable CCU61 Timer T12 additional prescaler 1 256 prescaler of T12 CCU61_TCTRO CCU61_TCTRO 0x0008 Y XE164 uVision4 File Edit View Project Flash Debug Peripherals Tools SVCS Window Help F te apro eo PS gina 24 QjoO coa citen Target 1 X K Project 0 2 ma n c MAINA 3 myprin Es s Target 1 eg 7 Dave Files Sal sk k k k ok ak ok ak ok ak ok ak ok ak ak ak ak ak ak ak ok ak ak ak ok ok ok ok ok ak ak ok ob ak ak ob ok ob ak ob ak ak ak ak ak ak ok ob ak ob o ob v ob ak ob ak ob ak ok ak E ak ak ak ak ak E obo ak ol E MAING 531 USER CODE BEGIN Main 1 LES 532 BSCS C 53 USER CODE END E amp 3 UOCO C 55 void main void ge Sc EE H USICO C 537 USER CODE BEGIN Main 2 8 amp IB CC2 C 538 amp 8 CCU61 C 59 USER CODE END User Files pA 541 MAIN vInit 4 myprintf c T 543 USER CODE BEGIN Main 3 544 while RS232 wait 545 546 enable CCU61 Tim
87. l for COLTE T13 Modulation Control for COLTS E Enable T 12 modulation for CODUTST CT 2MOIBEN Enable 113 modulation for CO T61 IT SMQDBEN Passive State Select ICOUTE1PS Multi Channel Control for COUT61 MCMPS e ne compere output COUTG dives passive level e while COSIST is 0 set ine COUT opu ia the passive state The compare output COUTET drives passive level c ine COUT output can deliver ine PM generated while COBTSTIS T by TZ or 113 Trap Control for CONTE Compare Output Control for COLIT81 PSL he passive evel ot COUTE ouiputis Ek r Enable the trap functionality of ine output Fin COUTET CERREN C The passive level of COUTET outputs XE1 DAF COUXETS4UCE 164 dav A Application Note 43 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Channels Configure Channel 1 Control do nothing File View Options Add Ins Windows leta Deu tus m ota 2 Module Clock Pin Control Timer 12 Timer 13 Multi Channel Channels Trap Interrupt Configuration Interrupts Ir 1 gt Dead Time Control Duty Cycle Required duty cycle 75 00 00 l Enable dead time generation DTET Real duty cycle 96 i 00 00 Compare register fox0000 UBI COPS Interrupt Control CCB1 Interrupts Generate interrupt in compare mode if a compare match has been detected while T12 is counting up or in capture mode if a rising edge has been detected at the pin CC61 ENCCBTR Generate int
88. ler factor is 8 set TI3CLK CCU61 vStartTmr CCU6l TIMER 13 Start Timer 13 028 void read song string void 0237 030 unsigned char substr 4 0 081 current note length old note length 032 03 switch song pos 034 05 select note 036 case C note 0 v n mum m mn oom ma on APPS CREER RA Build Output Application Note 125 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Generate your application program Project Rebuild all target files Y XE164 pVision4 File Edit View Project Flash Debug Peripherals Tools Y XE1 6 4 Vision A New uYision Project New Multi Project Workspace Open Project Close Project mu om mon E E N E TERN i eh A A Export m z um x Manage E ES T aN d Select Device for Target meng N Remove Item JE S RS Rebuild all target files 2 3 Dave Files B 002 0 mccue Rebuild all target files l Start V3 A66 d E myprintf Batch Build MAIN C Bimypri Translate C XE164 MAIN C amp Music Fil Stop build fread Il Cc WE1A4 YE1A4 veri UOCO C USICO C CC2 C CCUO1 C myprintf Files amp 8 myprintf c E amp Music Files Li read_song_string h read_song_string c Application Note 126 V2 0 2010 04 AP16175 Infineon XE164 Playing Music Y XE164 pVision4 File Edit View Project Flash Pal Peripherals Tools SVCS Window Help OS dd xn mmm ui us a Jar
89. m char input void char in do d myprintf your choice in char UOCO_ASC_uwGetData while in 1 amp amp in 2 2 amp amp in 3 return 1n j char input void char in do myprintf your choice in char UOCO_ASC_uwGetData while Gn gt a amp amp in lt m return 1n j Application Note 80 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Y XE164 uVision4 NH m x File Edit View Project Flash Debug Peripherals Tools SVCS Window Help 2 5 Dave Files 188 USER CODE END A Start_V3 A66 ae 200 3i MAIN C 201 KL PR RA Hk ak o ak ak ok ok ok ok ak ok ook e ee aka ok ak o o o ok o ok o ok ook o ok o o ak o o o o o ok o ok ob ok ook veo ve o ve o ve ak aka ee ak k k k oe ve ok ak ok oe e 1 SCS C 22 Prototypes Of Local Functions amp 8 IO C 203 Jf Ro ok ok ok ok o ok o o o e ok o o o o ok ob o o ob ok k ok ob o ob ve ok ob o vb ve ok o oe ob ve oe o oe ob ve oe s oe o ak e e oe o ak ok ok BU0CO C x USER CODE BEGIN MAIN General 9 205 neral X 3 USICO C 26 char input void 6 CC2 C am E CCU61 C 208 char in 2 85 User Files T E B myprintf c 211 myprintf your choice 212 in char UOCO ASC uwGetData 213 while in a amp amp inz 2 m 214 return in 215 216 2178 USER CODE END 218 219 220 ff A sk v v v v e o ok pk ok ok ok o ok ook ee oe ee ve
90. mation about music gt gt gt Application Note 33 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Multi Channel do nothing File View Options Add Ins Windows leta Du a Anal Multi Channel Mode Control Hall Sensor Control IT Enable Multi Channel mode MOMEN FE Enable Hall Sensor mode CCUB TT2MSEL Hall Sensor mode Trigger event Selection HSY NC ann Any edge input at CCPOSx Independent of HAM ow f Noldiager request will be generated Gn on comes eleven Switching Synchronization SWSYN Transfer on TIS period match Direct transfer C Transfer on 172 one match while counting down Synchronization on 113 zero match C Transfer on 112 channel I compare maten Transfer on 112 period match while counting up C syncnronizavon on T2 Zero match Interrupt Control Interrupt Control Enable interrupt for correct hall event ENCHE ES a automatic entering Of tne falle state Enable Multichannel Mode Shadow Tranmster Interrupt ENT Note ENCHE is CHE Interrupt ENWHE is ERR Interrupt Note ENSTR is CHE Interrupt ENIDLE is ERR Interrupt Enable interrupt for wrong hall event ENSHE CAE 16466164 dav AL Application Note 34 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Channels click Configure Channel 0 File View Options Add Ins Windows leta Omz Anal Configure Channel CCI Configure Channel CCG Configure Chan
91. n Project AE164 dav Controller AE164F 96F66 Compiler Keil Memory Model SMALL Date 17 04 2010 14 42 45 Please read this document carefully and note the red colored hints If you miss a file in the generated files list maybe you have forgotten to select the initialisation function of the related module Generated Files MAIN H MAIN C SCS H SCS C XE16XREGS H IO H IOC UOCO H U0C0 C CCU61 H CCU61 C and CCU61 H are new ww XE DAF CAE 16446164 day 4 Application Note 62 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Close DAVE File Exit E File View Options Add Ins Windows D New Ctrl N GG Open Ctrl O H Save Ctrl S Save As amp Print Ctrl P Generate Code EH Project Settings 1c xe164 xe164 dav adc 02 dav adc Ol dav Mouch Ol dav Wed Ol dav 6 Mot xc82x dave blinky dav 7 c xc8xx xc878 xc8 78 dav 8 c xc8xx xc888 xc888 dav En En A y Fb rm 2 Save changes Yes No Save changes click Yes Application Note 63 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music C166 v 00 Start Keil uVision4 and open your Keil Project If you see an open project close it Project Close Project Project Open Project V HYision4 File Edit View Project Flash Debug Peripherals Tools SVC PI New uYision Project New Multi Project Workspace Open Project Placa Praiart
92. nd see the result Note Song d Happy birthday code unsigned char songd T12000L8DDL4EDGL2F L8DDL4EDAL2GL8DDL40 1 DOOHL8GGL4F L4EO1L8C COOL4HGAL2G ti tt Agilent Technologies Application Note 134 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music ly HAPPY BIRTHDAY T12000L8DDL4EDGL2F L8DDL4EDAL2GL8DDL401DOOHL8GGL4E Agilent Technologies m H M m 0 L o Application Note 135 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music ly HAPPY BIRTHDAY T12000L8DDL4EDGL2F L8DDL4EDAL2GL8DDL401DOOHL8GGL4E E 2 Agilent Technologies J Xx 2 is xxxx oax 200 xxxx D eme XR HI IEI gt v Start play Start play Start play Start play next note next note next note next note Note Start play next note IO vTogglePin IO P2 8 A Show start of next note on Port 2 8 CCUOI vStart mr CCU61 TIMER 12 Start next note T12 single shot Application Note 136 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music 2 Appendix about music note length and note frequency Syntax used in our programming example Real Music Whole Note Semi breve 4 beats 1 2 Half note Minim 2 beats 1 4 Quarter note Crotchet 1 beat 1 8 Eighth note Quaver 1 2 beat 1 16 N Sixteenth note 16th note Semiquaver 1 4 beat Application Note 137 V2 0 2010 04
93. nel CD Channels Configure Channel CCAS CXXETO64UXET54 dav Me Application Note 35 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Channels Configure Channel 0 Mode Selection Mode Selection for Capture Compare Channel 0 click Compare mode File View Options Add Ins Windows n Dau fus a ota 9 Module Clock Pin Control Timer 12 Timer 13 Multi Channel Channels Trap Interrupt Configuration Interrupts Ir 4 9 Configure CCU61 Channel 0 x eta 9 Mode Selection for Capture Compare Channel 0 MSEL60 C Disable capture and compare modes compare mode Use pins CC60 and or COUT60 as outputs Double register capture mode 1 use pin CCB0IN as input Rising Falling edge Trigger Double register capture mode 2 use pin CC6GIN as input Rising edge Trigger Double register capture mode 3 use pin EGBOIN as input Falling edge Trigger C Double register capture mode 4 use pin CLSOIN as input Any edge Trigger Hall sensor mode XE164F CXXET64XET64 dav A Application Note 36 V2 0 2010 04 AP16175 XE164 Playing Music Infineon CCU61 Channels Configure Channel 0 Modulation Control for CC60 T12 Modulation Control for CC60 tick M Enable T12 modulation for CC60 File View Options Add Ins Windows ota Oe m f fiis m ea 2 Module Clock Pin Contro Timer 12 Timer 13 Multi Channel Channels Trap Inter
94. ng Music Stille Nacht heilige Nacht song J const char songj J T7200L8G LI6AL8GL4E L8G LI6AL8GL4E 01L4DL8DO0L4H O1L4CL8COOL4G L 4AL8AOIL8C OOLI6HL8AL8G LI6AL8GL4E L4AL8AO1L8C O0OLI6HL8AL8G L16AL8GL4 E OIL4DL8DL8F L16DOOL8HO1L4C L4E L8C O0OLI6GL8EL8 amp G LI6FL8DLIC Junge komm bald wieder song k const char songk J T12000L4DDL8C L8DL4EL4D OLL8HONOOL4EL4D OLL8HONOOL2C L4EEL8D L8EL4F L4E L8EL4GL4F L4EL2D L4GGGEL2CL4GF L4EL2D L4F L4F L8EL4EL2DL4E L4D L8COLL2H ONOOL4DDL8C L8DL4EL4D OLL8HONOOL4EL4D OLL8HONOOL2C L4E EL8D L8EL4F L4E L8EL4GF L4AL2GP8L8DDDDDDDDDL4DP8L8DL8D L8DDDDDL8D L8DL4DP8L8DL8EEEEEEL2GP8L8EL1DP8L8DL8EEEL4E P8L8GGGF L8GLIA Lili Marleen song 1 const char songl T12000L4EL8E L16FL4GL4EL8F L16FL8SF O01L16CO0L2HL8D L16DL8D L16EL4FL 8F LI6GL8H LI6AL8G LI6FL4E L8CL4AL8H O1LI6COOL4HL4AL4AL4GL4H L8AL4GL4FL 4A L8GL4FEL4G L8EL4G L8FL4FO1L4DL2CP400L4EL4G L8FL4FOLL4HONOOL2C musical scale chromatic scale for testing purpose song m const char songm 2 T600NOOL I C OLL I C char song MAX SONG LENGTH Application Note 76 V2 0 2010 04 AP16175 XE164 Playing Music neon f In em ESA QUE SES Ce EEN 4 e xu 4 ONS 3009 JASA HLONIT DNOS XW W Suos aeuo t OTITO DTIOONOO9L Jubuos aeyo 3suoo u buos esodand bur3so3 TOJ d 9TPOS OTFPMOTYO epvos peorsnu f f H8TVPIOST HPIJOILTI 58TVOIT H8T15991T1 48T14P14911 087109171 08T1HZ210009TTTO J8 1HO T
95. now how of the possibilities offered by the CAPCOM 6 module for PWM generation Note The style used in this document focuses on working through this material as fast and easily as possible Which means there are full screenshots instead of dialog window screenshots extensive use of colours and page breaks and listed source code is not formatted to ease copy amp paste Have fun and enjoy the CAPCOM 6 module Note Additionally there is a step by step book AP16109 focusing on BLDC Motors available which can be used for all 8 16 and 32 bit microcontrollers equipped with the CAPCOM 6 module To get the most out of the CAPCOM 6 module this additional Cookery Book is the icing on the cake of all available functionalities modes offered by this module e g Multi Channel Mode Hall Sensor Mode Note In case you want to start with the CCU6 from scratch generating Asymmetrical Edge Aligned PWM signals or Symmetrical Center Aligned PWM signals we suggest taking a look at APO8068 Note At the time this document was written there was no Keil simulation support for the XE164 microcontroller If you want to learn how to setup the Keil software simulated logic analyzer to view the PWM signals on the Keil simulator we also suggest taking a look at APOS068 Application Note 4 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Asymmetrical Edge Aligned PWM generation Single Shot Mode Timer12 note length Modulation
96. ob oe vb ob aka v ve aka ok ve ee ee a aka ke e 034 05 USER CODE BEGIN CCU61 General 9 096 sl e Z d rn Cnm ATM Build Output vax 4 gt Create an empty document Application Note 101 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Insert extern void read_song_ string void Y XE164 pVision4 File Edit View Project Flash Debug Peripherals Tools SVCS Window Help AAA EL aS A 9228 las e DI era e Target 1 extern void read song string void Dave Files A Start_V3 A66 8 MAIN C IO C ze a UOCO C AUSICO C E DESC CCU61 C Build Output Application Note 102 V2 0 2010 04 AP16175 Infineon XE164 Playing Music File Save As VY XE164 pVision4 File Edit View Project Flash Debug Peripherals Tools SVCS Window Help Ei ELE TG 8 Ej ES S ES Taget ET LE Project A MmancAmandH E mme PRA EE ccus e E To P AE asia Start V3 A66 MAIN C SCS C IOC 33 UOCO C Save s USICO C Save in SXE164 Bl Bee CC2 C p 3IO LST 35CS LST 3 USICO l 3i CCUe1 C mE E CC2 C 210 0BJ SCS OBJ USICO C 5 5 User Files CC2 H MAIN C lStart_V3 A66 sIXE164 E myprintf c peepee CC2 LST 5 MAIN H AStart_V3 LST 8l XE164 a ME 20c 2 08 3 MAIN LST ZStart V30BJ SXEl64c wi 5 CCU61 C ZMAIN OBJ 5 UOCO C XE164 c DEN E CCUG1 H I myprintf c 2 UOCO H IXE164 F
97. of peripheral is disabled Input Clock Input clock of CCUBT module MHz 66 000 CAXE 16446164 dav AL Application Note 29 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Pin Control Control of Pins CC6x and CC6xIN CC60 select Use pin CC60 as Output P0 0 Pin Control Control of Pins CC6x and CC6xIN CC61 select Use pin CC61 as Output PO 1 Pin Control Control of Pins CC6x and CC6xIN CC62 select Use pin CC62 as Output P0 2 CCU61 Pin Control Control of Pins COUT6x COUT63 select Use pin COUT63 as Output P0 6 File View Options Add Ins Windows leta Diu gl 12032 Note Outputs CC6x COUT6x used for Compare Multi channel Hall sensor Hysteresis like control modes Control of Pins CEs and COBxIN Control of Pins COLT Ex CC60 fUse Pin CCS0 as Output P0 0 COUTEO Pin COLTSO is Not Selected v CC6 fUse Pin CC61 as Outputi PO 1 COUTE Pin COLT61 is Not Selected Y CC62 fUse Pin CC62 as Qutput P0 2 COUTE Pin COLT62 is Not Selected Y Control of Pins CCPOSx COUT63 allze Pin COUTES as Qutputi PO 6 CCPOSO Fin CCPOSO is Not Selected 20 Control of Pins TT HB COPOS Pin CCPOS1 is Not Selected 0 T12HR T12HRA as Input CCUG0 MCM ST ad COPOS Pin CCPOS is Not Selected 0 TISHR Pin T13HR is Not Selected v Note Inputs used for Counter Timer Ext Trigger Run Note oo N are modes Available Pins T12HRB P1 2 TI2HRC PS 8 TI3HRCIPS 8 CXXETO4UCET54 dav A
98. orts les da 2 queen nnn nnn nn nnn nnn nn nnn EY Ports iFunctions Parameters Notes d Initialization Function Source File Function Library Part 1 em 0 lo_vTogglePin cop EM E EI XE164F CAXE164 XE164 day A Application Note 25 V2 0 2010 04 ur AP16175 Infineon XE164 Playing Music Parameters do nothing Spe Dis File View Options Add Ins Windows 6 00 fus Si Parallel Ports lifa BA 2 2 Header File File name IO H IXE164F CAXE164 XE164 day A Application Note 26 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Notes Insert Notes If you wish you can insert your comments here Spe Dis File View Options Add Ins Windows 6 00 fus e DAvE XE164F Release v2 1 We NZ 2 UN Insert Notes XE164F CAXE164 XE164 day 7 Exit and Save this dialog now by clicking D the close button Application Note 27 V2 0 2010 04 AP16175 XE164 Playing Music Configuration of the CCU61 module File View Options Add Ins TEUER ea LA XE DAF C4xE164 lt E164 dav 4 Application Note 28 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Module Clock click Enable module File View Options Add Ins Windows lea Du a ins CCU61 Disabled Flag CC61 DIS E Enable module the peripheral is supplied with the clock signal Disable module the clock input
99. ote and another with half or double its frequency Note If one note has a frequency of 400 Hz the note an octave above it is 800 Hz Further octaves of a note occur at 2 times the frequency of that note where n is an integer such as 2 4 8 16 Syntax used in our programming example Real Music Application Note 142 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music 3 Appendix CCU6 use to create note length and note frequency If note a is equal to 440 Hz then we get the following frequencies for the musical scale i l gro e 3 kleine eingestrichene zweigestrichene dreigestrichene viergestrichene ul Kontraoktave OU Oktave Oktave Oktave Oktave Oktave 494 524 Hz frequency note 264 Hz e 29r Hz 1 3all Hz E 3252 Hz F1 336 Hz 51 440 Hz Al 495 Hz B THT 528 Hz Ce frequency note source Sch ler Duden Die Musik 2 frequency note source http de wikipedia org wiki Tonleiter Application Note 143 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Note frequency Timer 13 octave O0 Ol O2 and O3 Pe errr rrr rrr HE EEES Le ep HE I EFF GE a Ge Ween E ee ee ee EZZZEEES Ss a P E te a a rre pete tt i rane gro e kleine 00 ZV Gkisve Oktave ine vi ie ion Kontraoktave oktave In our programming example we are going to use the following period values for Timer 13 unsigned int T13_values 162977 59550
100. oudspeaker s to the UConnect CAN XE164 Connect CCU61_CC62 P0 2 and GND VSS to your active loudspeaker s u 8 i On board header X400 PO 5 Pin number 4 Ground 2 AEN 3 P150 ADC1 CHO 4 Pan ADCO CHO 5 P59 ADCO CH9 ADCi CH9 CC2 T7IN CAPCOM2 6 P5 8 ADCO CH8 ADC8 CH8 T12HRC T13HRC CCU6x U1CO SCK TXDCO CANO U1CO DOUT TXDCO CANO P0 3 U1CO SELO COUT60 CCU61 RXDCOB CANO i U1CO DXO 11 PO 5 U1C1 SCK COUT62 CCU61 MIA uci pour COUT68 CCUBA TXDC1 CAN 13 P0 4 U1C1_SELO COUT61CCU61 RXDC1B CAN 44 PO7 U1C4 DXO U1C1 Dap CTRAPB CCU61 15 CANH Signal from CAN transceiver 16 CANL Signal from CAN transceiver Application Note 129 V2 0 2010 04 AP16175 XE164 Playing Music Docklight Now start Docklight and click d Start Communication ES Docklight V1 7 File Edit R ools Help D da jl Fr an 7003 Hr start Communication Send Sequences DIS Colors amp Fonts Mode COM12 9600 None 8 1 Communication Send Jonnsasonnanansnunsnneensen Sequence ASCII HEX Decimal Binary Name Receive Sequences Active Name Sequence Answer Application Note 130 V2 0 2010 04 AP16175 Infineon XE164 Playing Music Go to u Vision Download program your application program into the On Chip Flash L nb Click Y XE16 uVis
101. r for T12 is enabled H i Wa 2900731 P S Lid m Ha eis e x Timer 12 Resolution 66 MHz 256 T12PRE 1 done by software 32 8 056 64 Hz gt Resolution 124 12 us Application Note 32 V2 0 2010 04 AP16175 Infineon XE164 Playing Music Timer 13 note frequency CCU61 Timer T13 Input Selection Input selection select fcpu 4 Resolution 60 606 ns CCU61 Timer T13 Timer 13 Start Control tick V Start T13 after initialization T13RS File View Options Add Ins Windows leta Diu B itis Input Selection T1 SCLK Timer 13 Start Control Input selection icpus4 Resolution 0 061 us 4 Resolution 0 061 us E after initialization Timer T13 Trigger Event Control 11 STEC Timer 13 Period T1SPR Feriod ns Disable trigger control Y Us peret Period register T13PR fox0001 Timer T13 Trigger Event Direction TI STED 113 External Run Selection Start T13 while T12 is counting up DESDE Be isable external setting of T13 Y Timer 13 Single Shot Control Operating Mode T13CNT and ISCNTI3 l Enable single shot mode T13SSC e Timer Mode Interrupt Control 113 Interrupts C Counter Mode l Enable interrupt for T18 Period match ENT1SPM ISCNT12 Disable Counting Mode of TISR 7 l Enable interrupt for T13 Compare match ENTISCM CXXETO64UXET54 dav Me Note Timer 13 resolution 1 fcpu 4 1 66MHz 4 60 606 ns lt lt lt click here to see more infor
102. rmHausher um Es tanzt ein Bi ba butzemann song f code unsigned char songf T19900L8DGGO1DDOOHHGGAADDL4GP8L8DGGO1DDOOHHGGAADDL4GP8L8 HAHO1COOAHO1CDOOL8HAHO1COOAHOI1CDOODGGO1DDOOHHGGAADDL4G Application Note 156 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music 4 7 Song g Ich geh mit meiner Laterne Ich geh mit meiner Laterne Vaolksweise Ich geh mit mei ner La ter ne und mei ne La ter ne mit mir Dort o benleuch tendieSter ne hier un ten da leuch ten wir Mein Lichtist aus wirgehnnachHaus La bim mel la bam mel la bum Ich geh mit meiner Laterne song g code unsigned char songg T12000L8CLA4FLSFAFAOILA4C OO0LAALSFG L16GLS8GGAGLAF PA4O0L8CLAFLSFA FAOILAC OOLA4ALSFG L16GL8GGAGLAF PA4O0L8AOILA4COOLSALAFLSAOILA4COOLSALAF L8FGGGGAGL4FP4 00L8AO1L4COOL8AL4FL8AO 1L4COOL8AL4FL8FGGGGAGL4FP4 Application Note 157 V2 0 2010 04 AP16175 XE164 Playing Music d pl oL T N Pan ta tam tam ta tam ta ra ra la ta tam Fa ta TA la LA d cn Wwe come cc 5 W o t lt m D D we bring a x X X born king nest new 4 8 Song h The little drummer boy a ra ta ta tam ra ta ta tam ho nour H m a V2 0 2010 04 198 neon infir The little drummer boy alle klatschen Application Note See AP16175 Infineon
103. rupt Configuration Interrupts ir gt Modulation Control for COUT60 Control T12 Modulation Control for CC60 Enable T12 modulation for CC60 T12MODEN Passive State Select CC60PS The compare output CC60 drives passive level while CC60ST is 0 The compare output CC60 drives passive level while CC60ST is 1 Trap Control for CC60 m Enable the trap functionality of the output Pin CC60 TRPEN T13 Modulation Control for CC60 l Enable T13 modulation for CC60 TI3MODEN Multi Channel Control for CC60 MCMPS Set the CCO0 output to the passive state The BEER output can deliver the PWM generated by 112 or 113 Compare Output Control for CC60 PSL The passive level of CC60 output is 0 C The passive level of CC60 output is 1 XE164F CXXET64XET64 dav 7 Application Note 37 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Channels Configure Channel 0 Modulation Control for COUT60 do nothing File View Options Add Ins Windows on Oem f fus jm ota 2 Module Clock Pin Contro Timer 12 Timer 13 Multi Channel Channels Trap Interrupt Configuration Interrupts ir gt T12 Modulation Control for COUT6O T13 Modulation Control for COUT6O Enable 112 modulation for GOUTOOGTT12MODEN E Enable T 18 modulation for GOUT60 T198MODENJ Passive State Select COUT60PS Multi Channel Control for COUT60 MCMPS RE while COO05T Is 0 c T
104. s Application Note 168 V2 0 2010 04
105. tart next note T12 single shot 449 kel e s USER CODE END ei ata CCU61_ ISR 0x0080 clear flag CCU61 IS TI2PM s e ff End of function CCU61_viNodelrt md al A a j USER CODE BEGIN CCU6I General 10 ws USER CODE END Build Output LIB ICAPINUM SCRLIO z Application Note 99 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Double click CCU61 C insert Global Variables char mb2 500 message buffer for sprintf float help Y XE164 pVision4 File Edit View Project Flash Debug Peripherals Tools SVCS Window Help iD Me sam oc co mmmm Si A Qec dq Target 1 d P d Project ET a Gl aa Do mm cite y 061 KS 062 E MN 063 ff TC A v ok ok e o ok o ok aka ok o ok v ok ok o ok o o ok ook v o ok oo ook o oe ve ak oe ve ak ak ok oe ak ok or d 061 Imported Global Variables i 065 ff C HR v s ok o ak o b ok o ak o ob ok oe ob ok ob ok v ob o o ok o vb o o oe oe ob ok o oe ak o o ee ae oe oe b o ve ob oe e oe ve ob oc k ee oe ak ok oe k ee o oe oe k ok k zg SCS C n a IO C 0 USER CODE BEGIN CCU61 General 6 i micis USER CODE END E 069 USICO C m pe i CC2 C 071 a CCU61 C 072 Jf A A Ak e ak ok o ok v o ok ok ok v ok ok o a o ok ook ee ke oda o73 QGlobal Variables a DER 3 1 User Files 074 E FC ok s ok s o o o v o ak ve o e ok e ok oe ok ook o ok ob o o o ob o v o vb oe oe e o ve o e ok e
106. te 1 4 beat 1 4 0 5 0 125 s e So we get the following values shown in the table below Note Timer 12 resolution 66 MHz 256 T12PRE 1 done by software 32 8 0566 kHz gt Resolution 2 124 12 us T12 period values 16113 1 16113 16113 2 8057 16113 4 4028 16113 8 2014 P 16113 16 1007 g e g for 7 note length T12 period value 4 T12 resolution note length 16133 4 124 12 us 0 5 s Application Note 149 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music In our programming example we use the following code sequences note length case L switch song tpos 1 if song pos 6 current note length length of a whole note 16 else pos current note length length of a whole note break 2 current_note_length length_of_a_whole_note 2 break 4 current_note_length length_of_a_whole_note 4 break case 8 current_note_length length_of_a_whole_note 8 break default break old_note_length current_note_length postr read_song_string break CCU61_T12PR float current note length float tempo 120 0 period value note length Application Note 150 V2 0 2010 04 AP16175 Infineon XE164 Playing Music 4 Appendix songs used 4 1 Song a Maus am Mars Maus am Mars song a code unsigned char songa T12000L4FL8AL401C 00L8FEGL201C00P4P8L4EL8GO1L4C O0L8EFAL201CP4 PS8OOLAFL8AO
107. tf mb 1 Application Note 82 V2 0 2010 04 um AP16175 Infineon XE164 Playing Music pos 0 if max 0 there is something to play start CCU61 Timer T12 ISR the first time CCU61_ISS CCU61_IS 0x80 set STI2PM gt Set Timer T12Period Match Flag while pos lt max wait until song end is reached or abort by user is done j if UOCO_RBUF z myprintf Song aborted n j else sprintf mb1 End of the song reached pos 5u of max 5u n pos max myprintf mb 1 SSS Application Note 83 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music Y XE164 pVision4 File Edit View Project Flash Debug Peripherals Tools SVCS Window Help Oda rajo ce Pm mmu ua Qe qlo coa aja ee AA 3 8 marc main L I mee 4 0020 25 USER CODE BEGIN MAIN General 9 26 char input void 207 208 char in 208 do 210 211 myprintf your choice it 212 in char jUOCO ASC_uwGetData 213 while in gt a amp amp in lt m 214 return in 215 216 a7 void play_song void 218 219 max 0 a 220 if next song a amp amp sizeof songa 1 lt MAX SONG LENGTH 221 strcpy song songa max sizeof songa 1 next song a 222 myprintf nplaying Maus am Mars n 223 if next song b amp amp sizeof songb 1 lt MAX SONG LENGTH 224 strcpy song songb max sizeof songb 1 next song b 225 myprintf
108. up4 __ Group5 jGrop6 Group Level O noninterrupting evel 15 Note To change the level and the group of an interrupt source click on it drag it to its new position and drop it To set an interrupt source to the non interrupting level Level 0 click on it drag it to the Level Q list and drop it XE b4F CAXETDAXEIBO4 day fA Application Note 55 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 Bank Select do nothing File View Options Add Ins Windows It De A fus z 9 DAVE XE164F Release v2 1 Y Capture Compare Unit 61 CCU61 A da 2 Local Reg Bank 1 Local Reg Bank 2 Fast Interrupts P Global Register Bank Note 1 For all int s with priority gt 12 Local Reg Banks 1 or 2 can be assigned by dragging and dropping to the desired bank Note 2 Only 2 Fast Int s can be assigned with priority gt 12 at a time in the battom 2 cells of Fast Interrupt group XE164F CAXET654XET54 dav A Application Note 96 V2 0 2010 04 See AP16175 Infineon XE164 Playing Music CCU61 PEC do nothing File View Options Add Ins Windows lou De fus z Si DAVE XE164F Release v2 1 Capture Compare Unit 61 CCU61 WR Ek PEG Channels Configure PEC channel 0 Uae none y Group 0 and Level 14 12 10 8 Configure PEC channel 1 Interrupt source for Inone v Group 1 and Level 14 12 10 8 Configure PEC channel 2
109. zeof songf 1 MAX SONG LENGTH strcpy song songf max sizeof songf 1 next song f myprintf nplaying Es tanzt ein Bi ba butzemann n if next song g amp amp sizeof songg 1 lt MAX SONG LENGTH strcpy song songg max sizeof songg 1 next song o myprintf nplaying Ich geh mit meiner Laterne n if next song h amp amp sizeof songh 1 lt MAX SONG LENGTH strcpy song songh max sizeof songh 1 next song h myprintf nplaying The little drummer boy WM if next song 1 amp amp sizeof songi 1 MAX SONG LENGTH strcpy song songi max sizeof song1 1 next song i myprintf nplaying Hey Pippi Langstrumpf Wn if next song j amp amp sizeof songj 1 lt MAX SONG LENGTH strcpy song songj max sizeof song 1 next song j myprintf nplaying Stille Nacht heilige Nacht n if next song k amp amp s zeof songk 1 lt MAX SONG LENGTH strcpy song songk max sizeof songk 1 next song k myprintf nplaying Junge komm bald wieder n if next song amp amp s zeof songl 1 lt MAX_SONG_LENGTH strcpy song songl max sizeof songl 1 next song l myprintf nplaying Lili Marleen n if next_song_m amp amp sizeof songm 1 lt MAX_SONG_LENGTH strcpy song songm max sizeof songm 1 next song m myprintf nplaying musical scale chromatic scale for testing purpose sprintf mb1 song length 5u Byte s n max myprin

Download Pdf Manuals

image

Related Search

Related Contents

openFT V11.0 for Unix Systems  Teléfono de Botones Grandes    COLOR MONITOR SERVICE MANUAL - Wiki Karat  BULLETIN D`INSCRIPTION FORMATION en Médecine Traditionelle    hidden needle cover instructions for use 1 2 3 4  Gas Fired  SERVICE MANUAL Dual Camera VPC-TH1 VPC  Manual de instruções  

Copyright © All rights reserved.
Failed to retrieve file