Home
H8-Tiny SDK+
Contents
1. H8 Tiny SDK System Developmentkit for Hitachi H8 3664F User Manual ssue 0 2 Page 1 05 2002 MSC TEB1 User manual PREFACE Product Warranty The warranty period against defects in materials and workmanship are as set out in the accompanying Customer Information sheet Limitation of Warranty The foregoing warranty does not cover damage caused by fair wear and tear abnormal storage conditions incorrect use accidental misuse neglect corruption misapplication addition or modification or by the use with other hardware or software as the case may be with witch the product is incompatible No warranty of fitness for a particular purpose is offered The user assumes the entire risk of using the product Any liability of MSC Vertriebs GmbH is limited exclusively to the replacement of defective material or workmanship Trademarks All brand or product names used in this manual are trademarks or registered trademarks of their respective companies or organisations Microsoft is a registered trademark and Windows and Windows NT are trademarks of Microsoft Corporation IBM is a registered trademark of International Business Machines Corporation Cautions This document may be wholly or partially subject to change without notice All rights reserved No one is permitted to reproduce or duplicate in any form a part or this entire document without MSC Vertriebs GmbH written permission Restrictions Please refer to
2. EE 00e Display On kunua Ed nk o d LCDReadStatus LCDWriteCmd 0x06 Enter Mode AutoIncrement LCDReadStatus LCDWriteCmd 0x14 MoveCursor right LCDReadStatus LCDWriteCmd 0x80 Set DD RAM Address 0x00 LCDReadStatus writesomedata from 1st position in line 0 1 void LCDWriteLine u8 line const char data LCDWriteCmd 0x80 line 0x40 select line while data LCDWriteData data data Issue 0 2 Page 48 05 2002 MSC TEB1 User manual define cKEYCLK 0x40 7 BLE IRQ 2 define cKEYDATA 0x80 P PII define cKeyBufSize 16 input keycode buffsize ul6 KeyCodeBuf cKeyBufSize input code buffer u8 keyWriteIndex keyReadIndex buffer write read index ulg Bowie El ue DDE SE check for odd parity and stopbit u8 OddParStopCheck ul6 data Us emis ul6 mask 0x0080 if data amp 0x0200 return FALSE check for stopbit while mask if data amp mask pcnt mask gt gt 1 ic pent EE daca 0x0100 EE TRUE ET ABS neer rupt Vect 6 vore INT TRO oc Star e oS E statie ulo val VOB Edo some outour it utval amp 0x000 TO EDRI BYTE 7 CKEYDATA else IO PDR1 BYTE amp cKEYDATA outval 1 if outval IO PDR1 BYTE cKEYDATA set out HIGH 1 IO PCR1 amp cKEYDATA set portpin as input 0 outact 0 j else process input data val gt gt 15 if RO PDR Bc val 00200 CHE LE
3. SE ft C4 9 02 Dn cima ZLA K 3 EH C13 sui 18 PROG RUN om ACE o MD ac E leeeoeoeo99 UL SE ar T Issue 0 2 Page 57 05 2002 MSC TEB1 User manual NOTES Issue 0 2 Page 58 05 2002 MSC TEB1 User manual NOTES Issue 0 2 Page 59 05 2002 embesso embedded software solutions This product was developed by embesso If you have any questions about it don t hesitate to contact us via e mail under support embesso com Other products by embesso Tiny Modules CPU Modules with Hitachi H8 Tiny Controller Basicboard with wirewrap field and a connector for Tiny Modules also available as complete kit H8 3048B Evaluation Board with wirewrap fleld integrated LCD with 2 16 char and connector for external display Integrated small Control Board with all usual connectors kbd RS232 fully programmable H8 Tiny onboard etc and even more at our website embesso Hinter der Bahn 1a D 31162 Bad Salzdetfurth http www embesso com
4. Hew Project Step 7 The following source files will be d generated Ext Description Setting af HH Section Program of sbrk Definition of YO Regis Interrupt Pragram Reset Program Mam Program Header file of brk file Selling af Stack area dbsct zbrk lodefine intprg rezetprg May Tiny brk stacksct 72 3 10 CC aon Finish Cancel In step 9 click Finish and a project report will be displayed Issue 0 2 Page 20 05 2002 MSC TEB1 User manual Project MM PROJECT GENERATOR PROJECT NAME HyTinyT est PROJECT DIRECTOR LHHEWAAMulmulestMulmule CPU SERIES Tiny LPU TYPE 3664F TOOLCHAIN NAME Hitachi HE Tiny SLF TOOLCHAIN VERSION 1 0 0 GENERATION FILES CAHE ZM u Ting T es MuT inu Testsdbsct c Selling af B H Section SHE Ww ZM u Ting T estu Tiny Testssbrk c Program of sbrk LANE SAM Inu T est My Tini T estiadefine h Definition of 170 Register CARE ZM u Tina es Mu inyT estyintprg c Interrupt Program SHE We Sy Tina T eh Mu Tiny T est resetorg c Reset Program Click OK to generate the project or Cancel to abort Generate Readme txt as a summary file in the project directory Cancel Click ok and the new workspace is well prepared At the left side you can see the structure of your project with all files A double click on C source file AMyTinyTest c will open the file to the right window Issu
5. adval AD DRB read A D value else adval AD DRA return adval gt gt 6 ucc A m PU 0 me ue bast YA EE NO convert int to ASCII HEX void ShowHexValue ul6 code u8 line d Ee Ee KEE ccs if line 0 text Line0 0 last digit start address else text amp Linel 0 data text 14 des while d d olse Ol 2 default 0 c code amp 0x000f check digit iE YE if gt 0 chk for value if le lt 10 data ME LO else data E EINE DEN T data next digit code gt gt 4 d LCDWriteLine line text show result void Delay void manual delay long z 0x0 10000 while 2 ue olavalj2 ul6 Average u8 channel ul6 adval calculate av of last 15 values d if abs oldval channel adval gt 10 oldval channel adval else oldval channel oldval channel 15 adval gt gt 4 return oldval channel KKK KK kk kk AS no eS setup CLK 8 lus 8MHz PWM Output at TMOV P76 kk ok Hk kk kK KK KK KK KK ok k ck ck ck ck kc kc kck ck ck ck kc kc KK A void Test Timer V void TSR VOB LE E 0 01 Clear by CompMatchA IntClk 8 NOR NE ENEE Clk 2 no external Trigger TV IS SS I ECKE O onCompMatchA l lt onCompMatchB output on P76 Issue 0 2 Page 45 05 2002 MSC TEB1 User manual TV TCORA 100 set periode to 100 gt 10 000Hz CORE 5 Se init cucyoycle to 75 void main void d ule yal L DTALT 2 R00 and L D
6. Break Make Break Make Break Make Break Make Break Make Break Make Break Typematic Make Break Make Break Make Break Make Break Typematic Typematic Typematic Typematic 05 2002 MSC TEB1 User manual Appendix A CD R content Programs HEW with Hitachi MCS tool chain programs hew FDT flash development toolkit programs fdt CodeLines Hitachi code generator for device drivers programs CodeLines Examples examples demoapp Demo examples flashdemo Datasheets Tiny Hitachi H8 3664F hardware manual H8 programming manual Tiny Application notes LCD Module datasheets Documentation This manual as pdf documentation MSC TEB1 board schematic documentation schematic Issue 0 2 Page 55 05 2002 MSC TEB1 User manual El i Hp Cro Qro Bp T rtr x MESS MaS 199 432 132 i Ta pi L m A z TACA HI SHR as q ka m Hg vu 1 IL uz AU C La mmm pm mmm iii K d pk ee eee iki 1 UL Ce JE ud d LI Wa ossa osang nauabuj L ating iM C aze TIL Issue 0 2 Page 56 05 2002 MSC TEB1 User manual Appendix C Board layout LC Display LCD 0000000000000000 OOOOBOBBO wo B B B Base x A Ia LI gt 1 1 2 3 4 Sys CON SI H18 ES E ue RS 2 54 SU3 18 e 6666668 8 C amp ge c CY 1 EE OH C1 KE H8 366 rog D D 2 D C5 1
7. Es Image successfully written to device IAE Dependencies A TinyTestt j lai FI For Help press F1 Not Connected First press the reset button at the target board hold it down and move Prog Run switch to prog position left After that release the reset button With Image Download image Ctrl P you one can start the connection setup to target board and start downloading image file Now press Ctrl P Download on FDT and the download process will start Watch on progress bar while download When the download is finished press Alt C to disconnect the PC connection On target board move Prog Run switch to run position right press down the reset button and release reset button Congratulations Now your first program is running You will see the LED s flickering Issue 0 2 Page 30 05 2002 MSC TEB1 User manual Now you can do some additional functions in HEW After compiling and linking only go to FDT update your download file with the command Freshen all Target files Ctrl T reconnect the link and repeat the download process Issue 0 2 Page 31 05 2002 MSC TEB1 User manual 2 3 Workflow Start HEW write change program code buid project compiling linking OK I ssue 0 2 Start FDT load refresh download file Press and hold reset button Switch S PROG RUN to PROG Position release reset button start download with Ctrl D wait until download finished pr
8. Setup Communications Port The FLASH Development Toolkit supports connection through the standard PL Serial port and the HMSE JTAG Development System Use this page to select pour desired communications port All settings may be changed after the project is created rar oC is i m Ii er mi d ui Azin ILI ma ith Controle ci Ir Pelr bh T Ji A N ardet file The Baud rate setting specifies a suitable speed for the connection based on the device characteristics and the Target Select part S Matari Idi E azil LT mai 5 BRENT ma o ka e AKTE s clack l eph HAMASA Sequencer The default baud rate is set up for use with a standard HMSE Device Imag Evaluation Board IF vau have a different clock an your Target you M Target He may need select a different speed al agM up nicl l rel JE rie 21 seqAbort mo LI 11 zur ck Welte gt Abbrechen Issue 0 2 Page 27 05 2002 MSC TEB1 User manual Project Wizard Setup Connection Type The FLASH Development Toolkit may connect ta pour device in a number of different ways All the options an this page may be changed after the Project has been created Select Connector 1 WW 0 m Ps E NI AE LA Zim tH fie Pau 4 LJE holle fe BOOT Mode C USER Program Mode Del Mia T A aide ilg Si K be For BOOT Program mode the Target device erases its FLASH E D prior to connection The Toolkit downloads pr
9. Stra Alt Stra Alt Strg Alt Right Win DC DC E0 27 EO F0 27 E7 Menu 5D DD EO 2F EO FO 2F 65 gt I 1 owoo n nm 0 O E e 10 SO a S d T g h k left ZSZO lt oXNAmz gt D Ki Table 1 Scan Codes of MFII keyboard Main Keypad Issue 0 2 Page 53 05 2002 MSC TEB1 User manual Function and other keys Scan Code Set 3 Scan Code Scan Code Set 1 Set 2 Make Break Make Break Code Code Code Code Code Key Typ Esc Fl F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 E12 Print Scroll Pause Ins Del Posl End PgUp PgDn Arrow left Arrow up Arrow down Arrow right I ssue 0 2 01 3B 3C 3D 3E 3F 40 41 42 43 44 57 58 E0 2A E0 37 46 E1 1D 45 E1 9D C5 E0 52 E0 53 E0 47 EO 4F E0 49 EO 51 EO 4B E0 48 E0 50 EO 4D AA C6 Not avallable E0 D2 EO D3 EO C 7 EO CF EO C9 EO D1 EO CB E0 C8 EO DO EO CD EO B7 E0 E0 12 E0 7C 7E E1 14 77 E1 FO 14 F0 77 E0 70 E0 71 E0 6C E0 69 E0 7D E0 7A E0 6B E0 75 E0 72 E0 74 F0 76 F0 05 F0 06 F0 04 F0 0C F0 03 FO 0B F0 83 F0 0A F0 01 F0 09 F0 78 F0 07 E0 F0 7C EO FO 12 FO 7E Not available EO FO 70 EO FO 71 EO FO 6C EO FO 69 EO FO 7D EO FO 7A EO FO 6B EO FO 75 EO FO 72 EO FO 74 Page 54 Make Break Make Break Make Break Make Break Make Break Make Break Make Break Make Break Make Break Make Break Make
10. Test Timer V for PWM Output while 1 do forever val Average 0 Read AD 0 ShowHexValue val 0 val Average 1 Read AD 1 ShowHexValue val 1 val 10 maz 1023 10 102 TV TCORB unsigned char val amp Oxff set PWM output Delay VOLUME OOB ou d Issue 0 2 Page 46 05 2002 MSC TEB1 User manual 3 5 AT Keyboard l nterface This demo shows the usage of the PS2 mini DIN interface on MSC TEB1 Please connect an AT keyboard MF102 to this port You will see the keycodes provided by the keyboard on the LCD Please refer to the code table for keycode translation in your own projects KK KK k kk kk k kk kk kk He HH He He He He kk kk Ck Ck Ck Ck Ck Ck k kA kckck ck kk Ck kc kc kk ck ck ck kk kk yee sij FILE SAT evo c ay DATE Sun ume Le 2002 a DESCRIPTION Main Program 5i fo GRU TYPE H8 3664F ao Wa x This file is generated by Hitachi Project Generator Ver 2 1 i Jess x KK KKK Ck kk Ck I kk kk kk Ck kk kk kk kk A A ifdef _ cplusplus extern C endif vota FOOTE vob ifdef _ cplusplus endif EE AT Keyb shows the PS2 Interface to an AT Keyboard TN A a a EE x include 2 mydets hT with further includes since oe Mos ine JM include machine h void wait ul6 wastetime local LCD port delay while wastetime Je LCD Port Bits on TinyEvalBoard RS P75 R W P74 EN P20 DATA P5 s some defin
11. crystal obese eee I es type should be a HC49 HC49U type Eventually W a vm 2 change the capacitors C6 C7 if necessary If you is change the crystal frequency take care on possible E changes by flash download tool see FDT manual Figure 1 5 crystal socket Issue 0 2 Page 8 05 2002 MSC TEB1 User manual 1 6 Connectors X1 Serial communication SubD 9 female X2 Power connector for cable connection X4 MiniDIN PS2 X2 Pin Operation 2 DC power supply 7 5 9 VDC approx 180mA with LED backlight X1 SubD9 Pin Operation Remark Connected to X1 8 Connected to X1 7 Not connected Connected to X1 1 X1 4 Pin rr pi CC can be Data or Clk 3 GND Re vv dna O Issue 0 2 Page 9 05 2002 MSC TEB1 User manual OnBoard LCD ICA X3 external LCD connector 057 016 1 X5 E10T debug connector Sys Con LCD Modul X3 LCD CON uC Operation 1C4 pin 057 016 1 pin pin 2 UI GND 4 D2 JNGE 5 B contrast P3 6 4 CC P75 RS register select 8 6 X po EN enable 9 27 BO DO lo 8 A P51 JDL apo P52 D2 P53 P54 D 2 16 GND J e GND gin Debug pin 8 INep 3 1 2 4 6 10 12 14 Not connected Issue 0 2 Page 10 X3 pinout X5 pinout 13 14 05 2002 MSC TEB1 User manual SV1 SV2 SV3 SV4 connectors with microcontroller signals PIN Operation PIN Operat
12. ent gt ll if OddParStopCheck val TRUE KeyCodeBuf keyWriteIndex val keyWritelndex 1f keyWritelndex gt cKeyBufSize keyWritelndex 0 cnt 07 val 0 j j IRRI BIT IRRI2 0 clear IRO Flag j void SendKeyBoard u8 data send data to keyboard us pent 0 u8 mask 0x80 Surcwal data 0x06005 tophit elkbit inser ad Issue 0 2 Page 49 05 2002 MSC TEB1 User manual while mask Ee ele Penas d Mass daa pene mask gt gt 1 A OZGL a Ose Loe set pexxty Jodie IO PDRI BYTE amp CKEYDATA set data LOW IO PCR1 cKEYDATA set as output 1 EE start output action u8 kbhit void if keyReadIndex keyWriteIndex return TRUE else return FALSE j ul6 GetKey void ul6 KeyCode KeyCode KeyCodeBuf keyReadIndex keyReadindextt if keyReadIndex gt cKeyBufSize keyReadIndex lt 0 return KeyCode char buffer 17 KeyCode QUOD E NE msg buffer convert int to ASCII HEX void ShowCode ul6 code d char Cla data butter 141 last digit start address while code Solos cp NOU YA MS 0 c Coce amp 0x000F If Check digit LE e F i gt 0 chak ror value iE e a O E else dara USC be d s f data next digit code gt gt 4 BOD telas CL EE show result void KeyTest void ug cz ul6 KeyCode OP MR EE C bate aue IO PMR1 BYTE amp cKEYDATA IEGRI BYTE am
13. for H8 Tiny microcontrollers from HMSE included For create new project please follow the next Steps Start HEW and create a new workspaces Uptions DK ko Browse to another project workspace select create a new project workspace click OK and type in the project name Issue 0 2 Page 15 05 2002 MSC TEB1 User manual Hew Project Workspace E p E 3 x Workspace Mame UK M V Tin Test Project Name M V Tin Test Browse Directory P SHE My Tiny est CPU family Ha Ting Super Low Power Tool chair Hitachi H8 Tiny SLF x Project type Cancel nr mz ee Es Assembly Application T Empty Application del Library Here the project name is MyTinyTest A project directory will be added automatically but can be changed manually please use the defaults here CPU family is H8 Tiny Super Low Power Click OK when ready Issue 0 2 Page 16 05 2002 MSC TEB1 User manual Hew Project 5tep 1 Which CPU do vau want ta use For A this project CPU Series SLP Super Low Power CPU Type 3660 3661 J662 J663 3bb4 BEC Wa Aio E Address space Met of Library Code Size y Stack calculator Medium Change number of parameter regis Treat double as float Pass struct parameter via register Pass 4 byte parameter return walu Use try throw and catch of C
14. the restrictions of all components and tool suppliers Hardware Considerations Grounding This hardware is designed for use with equipment that is fully grounded Ensure that all equipment used is appropriately grounded Failure to do so could lead to danger for the operator or damage the equipment Electrostatic Discharge Precautions This hardware contains devices that are sensitive to electrostatic discharge Ensure appropriate precautions are observed during handling and accessing connections Failure to do so could result in damage to the equipment Electromagnetic Compatibility This product can cause radio frequency noise when used in the residential area In such cases the user of the equipment my be required to take appropriate countermeasures under his responsibility Support Support by MSC Vertriebs GmbH is provided only for the supplied hardware Any software tools are supported from their supplier Please notice that maybe some software tools coming with this kit are only unsupported freeware and no support will be given For MSC support please contact TinyHelpeMSC oe com Issue 0 2 Page 2 05 2002 MSC TEB1 User manual Table of Contents REENEN nd ENEE IRR PIU RE RUN sks 2 Table of CONTEM cura eee autoru ua OFEN ER 3 T OVON O 4 1 1 System Development Kit content 4 1 2 Hardware description 4 1 3 POU O aara en A 5 1 4 Board overvlew ce nr rr 6 1 5 Jumpers and ewitches ce e n n 7
15. u8 V24Write char s simple Write string via V24 while s 0 while not end of string if V24PutChar s TRUE stt PutChar return TRUE u8 V24WriteLn char s simple WriteLine string CR LF d u8 ret FALSE ret V24Write s ret V2Z4Write m rc return ret void ShowUse void simple menu V24WriteLn n n rV24 DemoProgram ZN edm Line 1w s V24Writeln 2 Line 2 V24Write make your choise E void main void char V24Init 9600 init sci with 9600Baud 8N1 ShowUse display start msg while 1 OOP d if V24GetChar amp c TRUE d Le less TL U VZ4Weitelm n n rGrtear This vas 91 else if c 2 d V24WriteLn n n rSuper 2 Issue 0 2 Page 41 05 2002 MSC TEB1 User manual else V24Writeln YnInYrSorry Only l or 2 are supported Jj ShowUse void abort void Issue 0 2 Page 42 05 2002 MSC TEB1 User manual 3 4 A D PWM This sample shows the usage of the A D converter We sample the voltage of P1 P2 filter it and show the result on the LCD On D A Con you will see a reversed voltage at P2 built with a RC filter from TOW P76 KKK KK Ck kk Ck kk kk kk Ck Ck kk kk kk kk Ck Ck Ck Ck kk Ck k ske kk Ck Ck X XK k Ck Ck Ck kk KKK ck kckckckckckck k kk A E x AE mm AD PWM c s DATE ZS une OO SCH 7 DESCRIP NON V Meine Program Sy LE CPU TYPE H8 3664F x A
16. void RunningLightInit void prepare LED port and vars PrepKeyPort IO PDR8 BYTE Oxff Kp smi dB BID S E KO PORE are 7 oe US LED Out 00 SE values BED U O0 dL c aka LED Dir 0x00 dir left LED Speed LED SPEED INIT start speed kk KIK KA kk K K k kk Ck kk kk I kk kk kk kk ck ck kc kk kk TimerA Interrupt 1s increments var c and output EE GE ok ok ok Hk Ck kckck kk KK KK ck k ck kc ke KK A interrupt vect 19 void INT_TimerA void d statie ug Es KeyCheck check for key pressed RunningLightUpdate Issue 0 2 Page 35 05 2002 MSC TEB1 User manual RISE E PEE Z esse ice esse L to KK KK KK RAR RARA kk kk kk KK KK KK KKK TimerA Test setup CLK 8 1us 8MHz at P10 TMOW 1s Irq intervall SubClock 32 678 Hz KCkCkCkckckckckckckckckck ck kckckckckck kc kckckckck ck kck ckck ck kckckck ck Ke d void Timer A Init void TO PCR Orff P8 output RE TEE Reset PrescalerW TA TMA BYTE 0x4b CLK 8 on P10 1 32s interval Clk Prescaler W OD REN set TMOW P10 Output IENR1 BIT IENTA 1 enable TimerA Interrupt set imask cer 0 enable all interrupts void main void d Run mg kiona O Init key s and LEDs Timer A init P inic amp start cimer A while 1 just wait Noel coo EN ou d Issue 0 2 Page 36 05 2002 MSC TEB1 User manual 3 2 LCD One of the highlights of the MSC TEBI is the 2 16 character LCD wi
17. 0x80 line 0x40 selec lime while data LCDWriteData data Issue 0 2 Page 38 05 2002 MSC TEB1 User manual data void Delay void manual delay long z 0x200000 while 2 const US Desc MSC SBE EE EE Sass Wo const u8 Text3 17 LowCostEvalBoard const us KOTEL i7 Yr Compiler iic qu void LCDLoopMsg void while 1 do forever LCDWriteLine 0 amp Text1 0 display msgs LCDWriteLine 1 amp Text2 0 Delay LCDWriteLine 0 amp Text3 0 LCDWriteLine 1 amp Text4 0 Delay void main void Ree O init ports and LCD LCDLoopMsg go to LoopMsg j yale aoe vord j Issue 0 2 Page 39 05 2002 MSC TEB1 User manual 3 3 SCI SCI is used here for a simple RS232 V24 terminal connection Please use a terminal program like HyperTerm included in Windows select Baudrate 9600 Baud 8 Databits No Parity and 1 Stopbit 8N1 After connection and setup hit some keys and you will see a message responding on every keycode sent KKK KKK kk kk kk I KK KK kk kk X XK kk skok k ske KK ske Ck Ck k k ske Kk k k sk CK kk k sk ck ck kCkckckckckckckckckck kk s FILE SCIDemo c 2 DATE sta a dec 2002 SCH EIERE Program Sy ZEM CPU TYDE SEO OG SE os no This file is generated by Hitachi Project Generator Ver 2 1 S 2 SE KK KK KK RR k kk kk kk kk Ck Ck Ck kk kk kk kk CKCKCKCKCKCKCKCkCkCkCkCkCk k ck kk kk KK KK KK KK ck ck KK
18. 25m8 variables u8 KeyCode 0 u8 LED Out LED Dir LED Run LED Speed MS COS void KeyCheck void if IO PDR1 BYTE s KEY ALL KEY ALL is any key pressed 7 if d IOSPDRICBYUBN S KEY 1 Keylode KEY i else if IO PDR1 BYTE amp KEY 4 KeyCode KEY 21 else if IO PDR1 BYTE amp KEY 3 KeyCode ES Issue 0 2 Page 34 05 2002 MSC TEB1 User manual else at V TO PODRU BYTE amp KEY 2 KeyCode REXY 25 else KeyCode KEY RELEASED no mark key_released void RunningLightUpdate void check for keypresse and update LEDs u8 dummy ulo adval if KeyCode amp KEY RELEASED LE KeyCode s KEY ol KEY ol LED Dir 1 else if KeyCode amp KEY_4 KEY_4 LED_Dir 0 else if KeyCode amp KEY_2 KEY_2 LED Run 0 else if KeyCode amp KEY 3 KEY 3 LED Run 1 KeyCode KEY RELEASED if LED Speed LED Speed decrement speed counter Le ERM pe al V 1E zero LEDUSpeead LED SPEED INTI re init speed counter if LED_Run if LED Dir Eer LED Oue gt 5 is YA T EE it LED Out MED Our 0x80 LA empty set to 0x30 i else LD QUE lt 1 A SALTE dene LE IBD Out LEAD Out 0x01 in empty Ser vo 001 j j j pP YR LED Out o invert j void PrepKeyPort void prepare key port bits TOSTEMP LB SIE Ne WA 1 0 00 em Bb Weve IO PCRl KEY ALL Portl lt input 0 for all keys POV ue SY E EE j
19. DO Crystal female socket K e E U di AT PS2 Power 7 5 V keyboard OV DC connector IB dt BA Ka P1 ADC 0 fe P E ME Bo d EI T T TENA NE ME SE P2 ADC 1 4 user keys Reset button Prog Run Figure 1 Board overview switch Issue 0 2 Page 6 05 2002 MSC TEB1 User manual 1 5 Jumpers and switches JP1 is used for switching the serial interface from 1 1 to crossed connection If you connect a 1 1 cable like the cable that comes with the kit use the default setting If you connect a crossed cable set the jumper to alternate setting JP3 is used for the LCD LED backlight If the jumper is closed 1 2 the backlight will be ON Remove the jumper open if backlight operation is not necessary JP2 is used for 12C interface JP4 is used as an output for the DAC or for PWM JPI X Operation 2 4 1 3 2 4 00 1 2 3 4 jP3 Operation LED backlight ON LED backlight OFF P2 I2C CON oo vamo 4202 HE P4 DI A CON D A Output PWM A Issue 0 2 Page 7 05 2002 MSC TEB1 User manual S PROG RUN switches between RUN and pr pe PROG PROGRAMMING mode 2 KEY 1 T1 to KEY 4 TA are user keys meia RESET KEY T7 is for reset LEFT PROG programming mode RIGHT RUN mode Main crystal Q1 can be changed to another frequency Therefore a crystal socket is provided I Please refer to the microcontroller hardware e a documentation for recommended devices The
20. Device Image Jj Target files Eso ARO l JET Dependencies A For Help p press Fi Nat Connected Now a workspace is created and you can add your target file to TargetFiles Select Project Add new files to project and search for file c hew2 mytinytest mytinytest release mytinytest mot Add files to Project Suchen in Ta Release x m Ai cf Ei muytinutest Dateiname i mutinutest Dateityp Abbrechen Issue 0 2 Page 29 05 2002 MSC TEB1 User manual Now make a double click on targetfiles mytinytest and the file content of mytinytest mot will appear in hex format in the right window rad FLASH Development Toolkit mptinytest IS File Edit View Project Device Image Tools Window Help a x eag xi tin Workspace T inw T est 1 Projec EME TinyTestt Ba Device Image ay Target files Ja leddemo a37 5 keusleds a37 scidemo a37 j ad pwm a37 tinptestl as ig sends KEE E 0000016c 68 ab Ob 72 40 4 fa 00 id 01 47 04 be hec r06 6 1 d 00000179 Ya 40 8 54 70 fe 01 54 70 40 fe fe ff aTpb Tpibbi j mptinptest ad 00000186 6a ae 00 00 f eb 18 ee ba ae 00 00 ff 38 y8 ij8 9 00000193 db 19 55 79 De 00 01 47 De 1b 55 46 fc jus G UF 00000130 Ge 01 Ba ae 00 00 f db 40 ec 54 70 38 y iTpy 00000150 00000 1 ha 00000167 00000194 00000121 re ET s tinytesti 5 allas Bytes programmed in 3 seconds
21. E OE Typematic 82 16 F0 16 16 Typematic 83 IE FO 1E lE Typematic 88 3D FO 3D 3D Typematic 89 3E FO 3E 3E Typematic 8A 46 F0 46 46 Typematic 8B 45 F0 45 45 Typematic 8C AE FO 4E 4E Typematic 8D 55 F0 55 55 Typematic Backspace 8E 66 FO 66 66 Typematic gt Tab OF OD FO OD OD Typematic 90 15 FO 16 15 Typematic 91 1D FO 1D 1D Typematic 92 24 F0 25 24 Typematic 93 2D FO 2D 2D Typematic 94 2C F0 2C 2C Typematic 95 35 F0 36 35 Typematic 96 3C F0 3C 3C Typematic 97 43 F0 43 43 Typematic 98 44 F0 44 44 Typematic 99 AD FO 4D 4D Typematic 9A 54 F0 55 54 Typematic 9B 5B F0 5B 5B Typematic Return 9C 5A F0 5A 5A Typematic CAPS Lock BA 58 F0 58 58 Make Break 9E 1C FO 1C 1C Typematic 9F 1B FO 1B 1B Typematic AO 23 FO 23 23 Typematic Al 2B FO 2B 2B Typematic A2 34 F0 34 34 Typematic A3 33 F0 33 33 Typematic A4 3B FO 3B 3B Typematic A5 42 FO 42 42 Typematic Ap 4B FO 4B 4B Typematic A7 4C FO 4C 4C Typematic A8 52 F0 52 52 Typematic AB 5D FO 5D 5D Typematic hift AA 12 FO 12 12 Make Break D6 61 FO 61 13 Typematic AC lA FO 1A LA Typematic AD 22 F0 22 22 Typematic AE 21 FO 21 21 Typematic AF 2A F0 2A 2A Typematic BO 32 F0 32 32 Typematic Bl 31 FO 31 31 Typematic B2 3A F0 3A 3A Typematic B3 41 FO 41 EN Typematic B4 49 F0 49 49 Typematic B5 4A FO 4A 4A Typematic right Shift B6 59 F0 59 59 Make Ctrl 9D 14 FO 14 11 Make Left Win DB EO 1F EO FO 1F E3 Make AIt B8 11 FO 11 19 Make Space B9 29 F0 29 29 Typematic AltGr Strg Alt Strg Alt
22. I MEE CON Sire EE EES 9 1 7 Start Up D let e aide LEE 12 2 Development Environment 15 2 1 Create a program using HEW cece cece eee eeeeeeeeees 15 2 2 Download the code using FDT 24 Za ee lt n Te UE ER gt EXSITIDIGS narrar EE 23 3 1 Key s and M KEE 34 22 ED ree ee ee ee AR 37 LE o PP o ee eer err nere 40 E AR ae PV EE 43 3 AT Keyboard I nterface 47 Appendix A CD R content 55 Appendix B SCNEMAUC ENEE 56 Appendix C Board layout cnn rra rr 57 Issue 0 2 Page 3 05 2002 MSC TEB1 User manual 1 Overview 1 1 System Development Kit content Thank you for purchasing our product If you take care on the different hints in this manual you will have great success in software development with this microcontroller Please refer to the documents listed in appendix The System Development Kit contains the following parts Evaluation Board MSC TEB1 CD ROM User manual this document RS232 cable 1 8m DSub9 male female 4 plastic feet for the MSC TEBI Carefully remove the board from the shipping carton Check first if there are any damages before power on the evaluation board 1 2 Hardware description The Hitachi Tiny Eval Board MSC TEB1 is a low cost multifunctional evaluation board for the Hitachi Tiny H8 3664F microcontroller It can be used stand alone for software development and testing or as a simpl
23. JEnable dizable runtime type inform Back Ve Finish Cancel Issue 0 2 Page 17 05 2002 MSC TEB1 User manual Hew Project Step 3 What kind of initialization routine A would pou like to create Uzel Library H mber ahi Steams ZE Heap Size JH 20 Generate maini Function IC source file v M 120 Register Definition Files Generate Hardware Setup Function None v New Project Step 4 ES E EO x Library E runtime routines o new Performs memory allocation and ctype h Handles and checks charac math h Performs numerical calculatia mathf h Perfarms numerical calculatic stdarg h Supports access ta variable wl stdio h Performs inputzlautput handlir wl stdlib h Performs C program standard string h Performs string comparison ios EC Performs input output prac complet EC Performs complex nu stringlE C Performs string manipule i D Enable all Disable all Back Ne Finish Cancel Issue 0 2 Page 18 05 2002 MSC TEB1 User manual Hew Project Step 5 Stack Pointer Address power on reset Stack Size H 100 Hew Project Step 6 What supporting files would you Alike to create Handler a Bau PowerON Reset O Power ES Finish Cancel Issue 0 2 Page 19 05 2002 MSC TEB1 User manual
24. N LCD DATA PORT data LCD WAIT CLEAR LCD EN LCD WAIT u8 LCDReadStatus void get the LCD status register u8 status SE SET LCD RW LCD DATA CTRL LCD IN SET LCD EN status LCD DATA PORT CLEAR RGB LCD DATA CTRL LCD OUT return status VOL ED 4 dou LCD ule cnt 0 CLEAR LCD RS CLEAR LCD RW CLEAR LCD EN TO PCR OS 0 Set RS RW Output TO PER SOT Set EN Output LED DATA CTRL LCD OUT Set DDR Eo Output LCDWriteCmd waLLe enu LCDWriteCmd while cnt LED nea e H pe ITEM lines 5x characvrer fone where EE 0x36 T MESE im 2 Lines 5x7 character Lone 02368 EI 2 Lines 5 7 character Font vu SS LCDWriteCmd 0x38 8Bit IF 2 Lines 5x7 character font walles ent ODW ESC OOS iv VDusplav On Our so t SJ sic S LCDReadStatus LCDWriteCmd 0x06 Enter Mode AutoIncrement LCDReadStatus LCDWriteCmd 0x14 MoveCursor right LCDReadStatus LCDWriteCmd 0x80 Set DD RAM Address 0x00 LCDReadStatus writesomedata from 1st position in line 0 1 void LCDWriteLine u8 line const u8 data LCDWriteCmd 0x80 line 0x40 select line while data LCDWriteData data DEE Issue 0 2 Page 44 05 2002 MSC TEB1 User manual ul6 Read AD u8 channel u8 dummy ulo adval dummy AD CSR BYTE dummy read DISSE reset A D ADS SRB EE VANE LAD SE VE EVE DE DI wait conversion end LE Channel 0x01
25. R si This file is generated by Hitachi Project Generator Ver 2 1 K ge ui KK KK KK kk k kk kk kk k kA kA KKK ck kk Ck Ck kCKkCKCKCKCKCKCKCkCkCkCkCk k ck ck ckckck ck kck KK KK ck ck ck ck KK KK ck k A ifdef _ cplusplus extern C endif OBA ZOO ifdef _ cplusplus tendif A O EE AD PWM Demo shows some funcions of the A D converter and the use of PWM inverse output from P2 at D A Con U V x include mydefs h east Teese bre includes include lt stdlib h gt zo cio sire Liner Wi ere Sar qne Jal void wait ul6 wastetime local LCD port delay while wastetime j LCDPorr Bits on TinyivalBoare RS P75 R W P74 EN P20 DATA P5 sv some defines for easy access define CLEAR LCD RS IO PDETCBILD BS 0 define SET LCD RS IO PDR7 BIT B5 1 define CLEAR LCD RW E EE TSI JD define SET LCD RW TO PDR7 BET BA 1 define CLEAR LCD EN LO PDRZ BIT BO 0 define SET LCD EN LOEB BLE BO 1 define LCD DATA PORT IO PDR5 BYTE Fdefine LCD DATA CTRL IO PCR5 define LCD OUT OS EE idetine LCD IN 0x00 define LCD WAIT Twat 10000 void LCDWriteCmd u8 cmd V ESC ce HCD joer CLEAR LCD RS CLEAR LCD RW SET LCD EN LCD DATA PORT cmd Issue 0 2 Page 43 05 2002 MSC TEB1 User manual LCD WAIT CLEAR LCD EN LCD WAIT void LCDWriteData u8 data write data eo LOD poru Se Eat EE CLEAR LCD RW SET TD JE
26. e target board You can use the Flash Download Tool FDT for programming the target code or work with a debug system E10T at the provided connector The board allows the designer immediately to start with the software development before his own final target system is available This eval kit provides some additional hardware e g 8 LED s a 2 16 Character LCD 4 key s a PC AT keyboard connector an 2C connector and more for hard and software evaluation All peripherals are used by some software application notes Please refer chapter 3 Issue 0 2 Page 4 05 2002 MSC TEB1 User manual 1 3 Features me oi De GN NI Contains H8 3664F microcontroller n Circuit serial Flash programming All resources available for evaluation All pins routed to connectors 9 8304 MHz main crystal 32 768 kHz sub crystal UART interface with MAX232 level converter and SubD 9 female connector 8 User LEDs 2 16 characters LCD with LED backlight switchable Additional connector for external LCD 4 user keys PC AT Keyboard interface 2 potentiometer connected to A D channel 0 1 Reset button 1 switch user prog programming E10T debug connector 5V voltage regulator on board Issue 0 2 Page 5 05 2002 MSC TEB1 User manual 1 4 Board overview 2 16 char LCD with LED backlight Ext LCD connector Contrast 8 user LEDs 2C connector AA KULALA ETC EECHER DA connector E10T connector RS232 x connector Sub
27. e 0 2 Page 2l 05 2002 MSC TEB1 User manual ED My T nmr es Hitech Embedded W prs EE elma T est oj 2 He Edt view Project Options Quid Tools winds Hp lgl sl suas neo s zl sr lo ms ee a Le EN nica SB pro aaa reme dx ou PE A A AAA EAS d B K Sy Mine WALZ op FILE KvTinyTest c m 7 0 MeTingl est ep DATE Sat Jun 22 2002 di IE C 1 e Ma a LEECFIFIIOH Main Frogj ak 7 14 tatr CEI TYPE HB a b4F R ep Hai im Je This file iz generated by Hitachi Project GCenarator ier 2 1 SA i Da R Ej ez c KRENN EEEE NR NK RNK O ENEE ee 1 rkc a Dreperdenpes Lo ja ditdet _ cplusplus am Hkh extern CR fendif void abort waid Bifde cplusplus H fare Ll void nainl vcidi A E abort vold Pescht Base TAT i Me HUN Please first save your project with file save Now type in the following program KKK KKK kk kk kk kk k kk kk kk kk Ck Ck A A kk Ck kk CKCKCKCKCKCKCKCkCkCkCkCkCk Ck ck ck ck ck ck ck k ck kck ck kck ck ck ck ck Ak kc kc kc kk us SEH FILE MyTinyTest c CH DATE Sat Jun 22 2002 pu RIBU S CRITERION E Mae O quen PVA CPU TYDE H8 3664F A CH This file is generated by Hitachi Project Generator Ver 2 1 rd ES u i KK KK KK k k k k k k k k k k k k k k k k kk kk k kk KK KK KK KK KK KK AAA AAA include be exa nu void main void unsigned int x 0 ES Counter unsigned char c 0 holds port output BOS R stan Js all w
28. es for easy access define CLEAR LCD RS CILOMEDR EE EE define SET LCD RS MOP BBS fdefine CLEAR LCD RW CIOFEDRI BET EE define SET LCD RW IE R STET EME Lo define CLEAR LCD EN GROSSETO S define SET LCD EN Oe BPR ME TIME OR V detine LCD DATA PORI MO BDRS BYTE pdetune LCD DATA CIRELO TO PERS define LCD OUT Oxff define LCD_IN 0x00 define LCD_WAIT wait 100 void LCDWriteCmd u8 cmd EE EE CLEAR HOD S CLEAR LCD RW Issue 0 2 Page 47 05 2002 MSC TEB1 User manual SET LCD EN LCD DATA PORT cmd LCD WAIT CLEAR LCD EN LCD WAIT void LCDWriteData u8 data Z write data EE SET LLC RS CLEAR LCD RW SET TAD JEN gt LCD DATA PORT data LCD WAIT ChEABChODSEN LCD WAIT u8 LCDReadStatus void geni ne LED status register u8 status TR EE E RS SET LCD RW LCD DATA CTRE LCD TN SET LCD EN Status LED DATA FORT CLEAR LCD EN LCD DATA CTRL LCD OUT return status vold LCDInit void Z init LCD ul6 cnt 0 CLEAR LCD RS CLEAR LCD RW CLEAR LCD EN ISP Sr NEU Set RS RW Output IO PCR2 0x01 Set EN Output LCD DATA CTRL LCD OUT Set DDR to Output LCDWriteCmd while cnt LCDWriteCmd while cnt LCDWriteCmd while cnt 023812 7 SIS 2 Lines 5 7 character Font 0225007 I SIS 2 Lines 5 7 character Lone OxS58 EE 2 limes 5x7 Character Lone S e LCDWriteCmd 0x38 8Bit IF 2 Lines 5x7 character font while cnt
29. ess Ctrl C for disconnect press and hold reset button move S PROG RUN to RUN Position ready release reset button Page 32 05 2002 MSC TEB1 User manual 3 Examples MSC TEB1 is provided with some demonstration code On the supplied CD R you should find a complete prepared workspace for HEW examples demoapp demoapp hws Please copy the complete directory to your hard disk in a directory c H8TinySDK so you will finally have the following directory per example c H8TinySDK examples demoapp with all application notes included Then start HEW and select open existing workspace Select one of the projects and do your exercises For all projects we need the same header file containing some definitions and the include file for the target microcontroller H8 3664F So if you want to work with these files don t forget to include the file mydefs h first in your project file ifndef MYDEFS H define MYDEFS H define CPU CLK 9830400 select celk Tor diii cale ifndef NULL define NULL 0x00 endif ifndef FALSE define FALSE 0x00 endif ifndef TRUE define TRUE 0x01 endif typedef unsigned char u8 typedef unsigned int ul6 endif Issue 0 2 Page 33 05 2002 MSC TEB1 User manual 3 1 Key s and LED s The first demo program shows the usage of LEDs and keys on MSC TEB1 For time controlling we use TIMER A as an periodic interval timer The interrupt service routi
30. h a short demo application when delivered If you power up the eval board for the first time you will see a start up message and some LEDs lighting If no message appear please set the switch Prog Run to Run Mode right position and power up the board or if already done press the reset button The demo application contains a small Running Light application The keys can be used for control the state P2 is used as speed control First press the key T3 RUN for starting demo application Then you can check the functionality by pressing the keys KEY T1 to KEY T4 or change the value of potentiometer P2 Figure of the Demo application Running Light Any time you want to reset the application press the reset button If you want to reload the demo application later after reprogrammed the eval board you can find the code on CD R in the directory X Demo Flashdemo runlight a37 For X use the appropriate char from your CD ROM Issue 0 2 Page 13 05 2002 MSC TEB1 User manual 1 7 4 Software Installation Software development on MSC TEB1 requires some software tools to be installed on your PC All tools can be found on CD R Some of them must be installed separately Please refer on installation setup reguirements You will find the following necessary tools HEW Hitachi Embedded Workbench with a full version of the MSC C C compiler for all Hitachi Tiny controllers assembler and linker and library genera
31. he first step is to specify the name of your Project A Project Zk Controle name must be no more than 100 characters in length and contain d Devicedma Je only valid filename characters Ar Target file Si hiato Cartii l had UT jm s Project Name B azEA T mol I yTinyT est l SN Launch Sequences Device Imag CN Target tile TOU may also add some comments to the project 5 A r me Comments may be edited after creation and serve as a useful ET mot means to fully describe the purpose of a Project LS Add Comments LI 41 Abbrechen Issue 0 2 Page 26 05 2002 MSC TEB1 User manual Project Wizard Choose Device The FLASH Development Toolkit supports a number of Hitachi FLASH devices Select the device you wish to use with this project from the list ent d e Azimuth i z tau EI E Wi ul Dac E Vu Ontrolles E Uevicadina e Select Device W Target files H Motor Contr FLASH Size 32 K d el LIT mo RAM Size 1 75K B azEVT mol i SN Launch Ge Meri et Device Image IF uou wish to use an alternative set of Kernels with this Project MOU may specify their location below This option is useful if you d argattile e bh are developing Kernel for use with the Toolkit EN sab iii rect s tegEWT met f Default path Si sega bore mo User specified path I5 on 9 PU ESPROGRAMMENFLASH DEVELOPMENT TOOLKIT 1 5 c zur ck Welte Abbrechen Project Wizard
32. ie TS YA JO PDRS ps all BED on inverse while 1 forever loop while q EE C increment c EE BYTE C one tO pore Issue 0 2 Page 22 05 2002 MSC TEB1 User manual em du Tong Dee Hisia Embedded Workshop Hel my T esto E i x Dosega mou ro Ja RA chea II a la m ner rl Lise we Hd 9 pra Ta ce E S ERA A Ponce Sl A Te m e E xa ai 4 AA i B 5 A TA TRR TT RT NK HT R TT T T ENR TE R TIT RI R HNR RY E ER ENR R TRR ERN LIS s FILE KyTinvTezst c m ba Z GN Mines dal My ir est DATE Sat Jun 22 2002 ue C sours ka Je DESCRIPTION Hain Progra k la gange ce CEN TEPE HB 36b4F ne s at E alli do Je This file iz generated by Hitachi Project Genarator ier 2 1 SA D a E ee c LE sh c Ee Deperdennkes EI odaimeh am cbr b Ra NR NN RENE AAA AAA AAA CR Binoclude icdgsEine h void nain woid 1 B sa kocih unsigned int as counter Ra rnziqneed char c 0 e holds port output IO PCRH lati e all outis ar IO FDEH HTTE c k all LED s m inverze tr ubile 1 e forever loop gei while zx2 e wait 2 E 8 inrrammnt z B IO OR BYTE c Ja write c to pori sr xf iras Tiny 5LP Cat Compiler finished R ftmes Ting SELE Optlinker starting Lupp W Cannar find C specified in optim staer tlre ae Tiny 3LP prLinker finished Wild Finished Errnrs 1 War
33. ie kc kc kc KKK ifdef _ cplusplus extern C fendif vala abort vole ifdef _ cplusplus fendif include 2 myders a see tile for further include finclude iodefine h some defines define TIE 0x80 define RIE 0x40 define TE 0x20 define RE 0x10 define MPIE 0x08 define TEIE 0x04 jderine GIK ONE 0x00 define CK INT OUT 0x01 define CK EXT 0x02 define IS_SCI_RDF SS ESBE define CLEAR SCI RDF SOL SRB DE B RO deste IS SCT TX FREE SCE SSR IT DEIR 1 define V24_BRR x unsigned char CPU_CLK 16 x 32 x 1 void V24Init ul6 Baudrate SCI3 SCR3 BYTE 0x00 disable all SETS SSR BY IE X00 clear all errorbits SETS SMR BYTE 0x00 PE ONL c SCI3 BRR V24 BRR Baudrate set baud TO ML wu L 222 ude Ole ple Seis SCRS BYTE DE PE Ee Ince und Data disabled internal clock u8 V24NewChar void check for new char on V24 if 1S SCI RDE Receive buffer full return TRUE Issue 0 2 Page 40 05 2002 MSC TEB1 User manual j return FALSE j u8 V24GetChar char data simple GetChar via V24 ug sebe IS CUIDE Receive buffer full data SCI3 RDR yes get data CLEAR SCI RDF clear RDRF Bit return TRUE j return FALSE j udg VZ4Purehar US simple PutChar via V24 if IS SCI IX FREE Tx register free SO Se DP yes put data in tx register return TRUE return FALSE
34. ion PIN Operation PIN Operation 4 ne AA ne 3 ne X 4 P50 6 j Pl5 Ip P21 Jo mmm je ne 8 P17 Je PBZ 8 P57 8 nc 9 AN 9 P8606 X 9 P56 9 ne SV3 TI DEI E 00 00 18 17 1 2 OQ 00 OQ 00 SV2 o SV 00 00 OQ 00 00700 2 18 00 00r Issue 0 2 Page 11 05 2002 MSC TEB1 User manual 1 7 Start Up instructions 1 7 1 Installing the MSC TEB1 Installing the MSC TEB1 requires a power supply and a serial connection to a host computer common PC The serial communications cable for connecting the MSC TEB1 to a host computer is supplied and has 1 1 connectivity PC with COM1 2 Power supply R wa n 7 5 9V DC e d LJ rw Figure 1 8 shows how to connect the MSC TEB1 to a PC and to a power supply 1 7 2 Power Supply The MSC TEB1 hardware requires a power supply of 7 5V DC at minimum Please don t use a power supply with more the 9V DC because the on board voltage regulator becomes very hot The MSC TEB1 power consumption is about 180mA with LCD backlight ON Since total power consumption can vary widely due to external connectors H8 3664F port state use a power supply capable of providing at least 300mA at 7 5V DC The design includes circuitry for reversed polarity protection Please watch on GND ground connection between power supply eval board and PC Issue 0 2 Page 12 05 2002 MSC TEB1 User manual 1 7 3 Test program The MSC TEB1 is supplied wit
35. ire cmd Lo LCD pore Issue 0 2 Page 37 05 2002 MSC TEB1 User manual CLEAR LCD RS CLEAR LCD RW SET LCD EN LCD DATA PORT cmd LCD WAIT CLEAR LCD EN LCD WAIT void LCDWriteData u8 data write data to LCD port SET CD IRIS 9 CLEAR LCD RW Si EC Ne LCD DATA PORT data LCD WAIT CLEAR CD R LCD WAIT u8 LCDReadStatus void get the LCD status register u8 status CLEAR GD SET_LCD_RW LCD_DATA CTRL LCD_IN SET_LCD_EN Status LCD DATA PORT CLEAR LCD EN BCD DATA CTRL LCD OUT return Status void LCDInit void ZM Une ME E ul6 cnt 0 CLEAR LCD RS CLEAR LCD RW CLEAR LCD EN TOPR 00 Set RS RW Output IG PER lle Oda Set EN Output LCD pada OD OU Set DDR to Output LCDWriteCmd 0x38 8Bit IF 2 Lines 5x7 character font while cnt LCDWriteCmd 0x38 8Bit IF 2 Lines 5x7 character font waLLle cone e LCDWriteCmd 0x38 gt 8Bit IF 2 Lines 5x7 character font while cnt LCDWriteCmd 0x38 8Bit IF 2 Lines 5x7 character font while cnt LeDWritecmd 00e MDP O CursoroFE blinking Ort LCDReadStatus LCDWriteCmd 0x06 Enter Mode AutoIncrement LCDReadStatus LCDWriteCmd 0x14 MoveCursor right LCDReadStatus LCDWriteCmd 0x80 Set DD RAM Address 0x00 LCDReadStatus writesomedata from 1st position in line 0 1 void LCDWriteLine u8 line const u8 data LCDWriteCmd
36. ne isr is checking the state of the keys actualising the LED port and reading out the AD1 channel to determine the running light speed If you want to do some experiments first check out to find if other LED pattern maybe in form of a table read out or calculate them by functions developed by yourself If speed control should be changed first change the calculation of the A D conversion value to timer ticks KKK KK kk kk kk k kk kk kk kk Ck kk Ck A A Ck kk kk CKCKCKCKCKCKCKCkCkCkCkCkCk k ck ck ckckckckckckckck kc kck ck ck ck KK ie ie ie e ck kk A Lee GE FILE KeysLEDs c s s pelje 2 Sua wie 16 2002 si DESCRIPTION Main Program 3 CPU TYPE H8 3664F x s i This file is generated by Hitachi Project Generator Ver 2 1 S E e KK KK KK kk kk kk kk k kk kk kk KK KK KK KK KK kk kk kk kk k ck ck ckck ck ck KK KK KK KK ck ck KK KK KK KKK ifdef _ cplusplus extern C 4 endif void abort void ifdef _ cplusplus endif KeysLEDs c contains some sample code for using LEDs and Key s xx on TinyEvalBoard in addition Timer A is used for timer tick with irq include mydefs h tor all nec includes finclude iodefine h finclude lt machine h gt eo ecerines Ey define KEY 1 u8 0x10 define KEY 2 u8 0x20 detine KEY 3 us 0 04 define KEY 4 u8 0x02 define KEY ALL da A EE define KEY RELEASED u8 0x40 define KEY PROCESSED u8 0x80 define LED SPEED INIT u8 4 ff 4 32 1 83 1
37. ning eech Faad 11 28 n lid NUM Now select release With Build All or F7 Build the project will be compiled and linked If there are no errors the message window shows Building MyTinyTest Release Phase Tiny SLP C C Library Generator starting Nocning cto Co Skipping Phase Tiny SLP C C Library Generator finished Phase Tiny SLP C C Compiler starting Nothing t do skipping BRM Slr se Ca OMP LS Sec Phase Tiny SLP OptLinker starting Nothing to do skipping Phase Tiny SLP OptLinker finished Build Finished 0 Errors 0 Warnings Please follow the steps in the next section Download the target file in the controller flash Issue 0 2 Page 23 05 2002 MSC TEB1 User manual 2 2 Download the code using FDT After compiling and linking error free the target code mytinytest d37 should be downloaded to target board Therefore we use a freeware tool from HMSE FDT Even FDT must be prepared for a new workspace varen mur Min rac aaen Deb Rahe e Seat D s Tomat Patras Tabele Ester i Jp Wen cmv e Ww HDI ET B m rialaren 010 JE KU zm m m D lt S A s LI dn FLASH L lt Aor restorer au ek SECHS BIR MAS Y prtu Fh F rn d ra rn Ft F Fi ERU Fh Fh F Fh Fh ra rh bb ra rn kt i Fh Fh HER Fh Fk Fh ER KA PA Fh EI bem br F pri pr F pa pr Pa rr br Ci mie bb NN NU EE E Ci Pm Pr PU En FE PL FE FT PR orn EF KI bh bh
38. ogramming kernels cp S8 UT mot to the device as required 5 amp zEN ma i SN Launch Ge dence li At E Image Select Interface HEIE y T argat We i A Taget Kernel already resident S GOM airn mol i reis T me TA segbenane The Target device must be waiting in BOOT SCI made the Toolkit will perform the remainder of the boot sequence c Zuruck Weller gt Abbrechen 9 30 automatically Project Wizard Setup Programming Options The FLASH Development Toolkit offers a device protection system and an advanced messaging level for use with hardware and kernel development Te m I i m ES Es Le Rai m i 5 pra Azimuth v Wien What level of device protection would you like B Cevicedinane C Automatic fe interactive L None Ar Target file Glas UT mat When Programming the device vou will be asked for confirmation R prior to Erasing any previously written blacks 5 azi mol SN Launch Ge ende L Device Imag What level of messaging would you like Standard C Advanced zy Taget tiles GOM ain mol reis T mol The Toolkit will display messages pertaining to general purpose at 1 wort mic Et j i USE LI 31 c Zuruck Fertig stellen Abbrechen Issue 0 2 Page 28 05 2002 MSC TEB1 User manual FLASH Development Toolkit MyTinyTest je Edit Saj Device Image Tools Window Help TFT m Wibrkspiase MyTinyT est 1 Pro EMEA ex E Jj
39. p 0x04 TENR1 BYTE 0x04 set imask ccr 0 LCDWriteLine 0 FP 21 man IRQ 2 on falling edge enable TRO 2 enable all interrupts PC Keyboard Iest LCDWriteLine 1 press any key while 1 if kbhit if new key KeyCode GetKey get codes Issue 0 2 Page 50 05 2002 MSC TEB1 User manual ShowCode KeyCode If display code void main void BSD E ports and LCD KeyTest go to keyboard test void abort void Issue 0 2 Page 51 05 2002 MSC TEB1 User manual Table Scan Codes MFII Keyboard Scan Code Set 3 Typ Make Break Make Break Scan Code Set 2 Scan Code Set 1 Make Break Make Break Code Code Code Code 45 C5 77 F0 77 47 C7 6C F0 6C Numeric Keypad Code m I ssue 0 2 u 7 4 d 8 5 2 0 gt 9 6 3 48 4F E0 35 48 4C 50 E0 1C C8 CF EO B5 C8 CC DO D2 E0 9C 6B 69 EO 4A EO F0 4A 75 73 72 70 E0 5A EO F0 5A Page 52 FO 6B F0 69 F0 75 F0 73 F0 72 F0 70 F0 7C FO 7D F0 74 F0 7A F0 71 FO 7B F0 79 Make Make Make Make Make Make Make Make Make Make Make Make Make Make Break Break Break Break Break Break Break Break Break Break Break Break Break Break Tvpematic 05 2002 MSC TEB1 User manual Scan Code Scan Code Scan Code Set 1 Set 2 Set 3 Break Break Make Code Code Make Code Code Code Typ A9 OE FO O
40. ru rn F ra rn F ra rn EB Ci PF muU nm i7i2 Se b baki Tn 14014701 G DIGOLLIO Gebei BEDER 6000 DRO URL OO Kaali p i Fielies e cba reed JH DION Lad ane tied LmimUNLE ifHd czelb bose 00 Issue 0 2 Page 24 05 2002 MSC TEB1 User manual Please start FDT and select New Workspace Here we use the project name MyTinyTest Hew Workspace El Workspace Name DK L iny T est Cancel Location CAMMY Ting ezt hd T my T est l j M Create workspace directory Workspace file KAME ing eshi u Ting T esT M u Tiny T est My Tim est f You can choose a location for all workspace files Select on subdirectory from MyTinyTest Select Directory Folders DK D C mulinEestsmulinytest Esch gt MyTinyT est Cancel Help dl 5 Debug EJ Release Drives E c SYSTEM Network i Click ok and a further window will appear FLASH Workspace Manager Do you want to close all document windows E Nein Abbrechen Select Yes Issue 0 2 Page 25 05 2002 MSC TEB1 User manual FLASH Workspace Manager First time users should use the wizard Fill in the following things Project Wizard Project Details Welcome to the FLASH Development Toolkit Project Wizard The Project Wizard will quide uou through the steps necessary to create a new project Sl Wi in sa lan LJ rey cop MA z Y Tap ol Lau T
41. th backlight Simple functions are provided here to demonstrate the usage of the LCD Please refer to the LCD manual for further information e g commands other character sets etc The demo source contains some definitions to reset and initialise the display Then we make some simple write outs KO kk kk k KK k kk K Ak k kk KK KK AA A A kk kk kk kk Kk kk RRA ck ck ck kc kc k kc kc k kk e si FILE LCDDemo c a DATE SU iin 20 02 ui DESCRIPTION Main Program i CPU TYPE H8 3664F s za x This file is generated by Hitachi Project Generator Ver 2 1 iv AR o kk kk kk kk kk kk kk Ck kk kk Kk A A include mydets n include iodefine h ifdef _ cplusplus extern C endif OLO SUE DILO ifdef _ cplusplus fendif LCDDemo shows some funcions of the LCD on the TinyEvalBoard Please refer to LCD datasheet for further details void wait ul6 wastetime local LCD port delay while wastetime j Js IB pou Bices Ree RS P75 R W P74 EN P20 DATA P5 5 some defines for easy access define CLEAR LCD RS IOS PDR seit Eo define SET LCD RS DEE Eeer define CLEAR LCD RW TO PDR7 BIT B4 0 define SET LCD RW LOL Dn E define CLEAR LCD EN NGT SEDE ZB B 000 define SET LCD EN EE v define LCD DATA PORT IO PDR5 BYTE define LCD DATA CTRL IO PCR5 define LCD OUT BESSER idetine LCD IN 0x00 define LCD WAIT wale 100 void LCDWriteCmd u8 cmd W
42. tor FDT A powerful freeware flash tool flash writer from HMSE CodeLines Code generator tool for device driver generation from HMSE Installation hints HEW First install HEW setup exe in directory HEW Follow the instructions in setup and look at the readme txt file FDT Next install ftd15 exe Then the plugin fdt3664f exe must be installed Follow the setup instructions A documentation will be found in fdt man pdf CodeLines Optionally CodeLines can be installed setup exe in directory CodeLines If you have installed these tools please refer to the next lessons for workflow NOTE Most freeware tools are unsupported versions Please refer to manuals or hints on website for FAQ s It is strongly recommended to refer all additional documents like H8 3664F hardware manual and H8 programming manual Please see the application notes and several readme files on CD R Sometimes you should watch on the Hitachi HMSE and IAR websites for tool upgrading news and latest versions of all tools Hitachi www hitachi eu com semiconductors HMSE www hmse com Issue 0 2 Page 14 05 2002 MSC TEB1 User manual 2 Development Environment 2 1 Create a program using HEW Software development can be done with the integrated embedded workbench like HEW This software contains an editor some tools for organisation and a tool chain for compiling assembling and linking programs There is a full version of the HEW tool chain
Download Pdf Manuals
Related Search
Related Contents
www.philips.com/welcome ES Manual de usuario 1 Atención al INTELLIGENCE MODE D`EMPLOI W E B FOCUS N EWSLETTER XFX GF FX4000 AGP8X DELL Precision R7610 SLT USER GUIDE.DOC PDF/380KB Jandy® underwater pool and Spa White lights Copyright © All rights reserved.
Failed to retrieve file