0
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心
发布
  • 发文章

  • 发资料

  • 发帖

  • 提问

  • 发视频

创作活动
M16C26A-C

M16C26A-C

  • 厂商:

    RENESAS(瑞萨)

  • 封装:

  • 描述:

    M16C26A-C - Sample Program (Calendar) - Renesas Technology Corp

  • 数据手册
  • 价格&库存
M16C26A-C 数据手册
Application Notes M16C/26A Group Sample Program (Calendar) 1. Summary This sample program provides the functionality of a calendar by using the Renesas Starter Kit for M16C/26A (R0K33026AS000BE) and an extension board. Specifically, it creates a calendar that shows a date of the day on liquid crystal display. (Dates from January 1, 2000 to December 31, 2099, including leap years, are supported.) Switches on the extension board (SW1–SW16) are used to set a date (year, month and day) and a day of the week. Calendar display The extension board used here is a product from PI System Co., Ltd. 2. Introduction Microcomputers: M16C26A The example described in this document applies to the microcomputers listed below: This sample program runs on the Renesas Starter Kit for M16C/26A (R0K33026AS000BE). Prepare an extension board available for the Renesas Starter Kit or create a circuit similar to the one shown in the example circuit on page 14 and then connect it to the Starter Kit. This program uses RSK_LIB. For details about RSK_LIB, see the RSK_LIB reference manual. (RSK_LIB is the library software provided for use with the Renesas Starter Kit for M16C/26A.) REJ05B0813-0120 Rev.1.20 2007.11 Page 1 of 17 M16C/26A Group Sample Program (Calendar) 3. Port Arrangement The key matrix is the facility mounted on an extension board for the Renesas Starter Kit. To use this facility, connect an extension board to the Starter Kit. LCD P74 KEY P75 P76 P77 P104 P105 P106 P107 10MHz Xin P91 P90 P63 P62 P61 P60 LCD E LCD_RS LCD_D7 LCD_D6 LCD D5 LCD_D4 - - - - M30260F8AGP Figure 1 Port Assignment REJ05B0813-0120 Rev.1.20 2007.11 Page 2 of 17 M16C/26A Group Sample Program (Calendar) 4. Operational Outline A calendar is created that shows a date of the day on liquid crystal display. (Dates from January 1, 2000 to December 31, 2099, including leap years, are supported.) Press the decision switch (SW16) to enter the setup mode. First, fix a “year” using the UP switch (SW13), DOWN switch (SW14) and numeric switches 0 through 9. Next, change a “month” and “day” using the UP switch (SW13) and DOWN switch (SW14). When a “day” is fixed, a “day of the week” is automatically displayed, by which the setup mode is exited. Pressing the UP switch changes the date to a date of the next day. Pressing the DOWN switch reverts the date to a date of the preceding day. Pressing the CLR switch initializes the display and date. LCD SW1 7 SW2 4 SW3 1 SW4 0 SW5 8 SW6 5 SW7 2 SW8 SW9 9 SW10 6 SW11 3 SW12 CLR SW16 PRESS SW13 UP SW14 DOWN SW15 Note: In this program, pressing two or more switches at the same time has no effect (i.e., ignored). • Timer A0 (timer mode, main 2 ms cycle) This timer counts 2 milliseconds using the main clock of the microcomputer as the count source. It is used as the basic timer of RSK_LIB. Time management, key scan, and LCD display management are performed using this timer. REJ05B0813-0120 Rev.1.20 2007.11 Page 3 of 17 M16C/26A Group Sample Program (Calendar) 5. Operational Specification (1) Immediately after the reset switch is pressed, the upper row shows “----” and the lower row shows “----- --.” (2) Pressing the decision switch (SW16) puts the program into the “year” setup mode. While setting is in progress, the “year” displayed on LCD flashes at 1 Hz. (3) The UP switch (SW13) increments by 1 and the DOWN switch (SW14) decrements by 1. The numeric switches input a numeral directly, which is shown on LCD. The “year” is designated by only 2 lower digits of the calendar year. [Operational specification of the UP and DOWN switches] When a maximum value is reached, a minimum value returns. (2099 - 2000) When a minimum value is reached, a maximum value returns. (2000 - 2099) If either switch is held down for 1 second or more, the numeral continuously goes UP (or DOWN) every 100 ms. [Operational specification of the numeric switches] The LCD display shifts to the left each time a switch is nput. Numerals can be input in the range 0 to 99. If any value is decided outside the input range, it reverts to the minimum value (2000). (4) Pressing the decision switch (SW16) fixes the “year,” by which the program is placed into the “month” setup mode *While setting is in progress, the “month” displayed on LCD flashes at 1 Hz. (5) The UP switch (SW13) increments by 1 and the DOWN switch (SW14) decrements by 1. The numeric switches have no effect. The month is shown by Jan through Dec. (6) Pressing the decision switch (SW16) fixes the “month,” by which the program is placed into the “day” setup mode. *While setting is in progress, the “day” displayed on LCD flashes at 1. (7) The UP switch (SW13) increments by 1 and the DOWN switch (SW14) decrements by 1. The numeric switches have no effect. Numerals are displayed by 01 through 31. (8) Pressing the decision switch (SW16) fixes the “day” and at the same time shows a day of the week on LCD. The program goes to calendar mode. (9) In calendar mode, the UP switch (SW13) increments the date by 1 and the DOWN switch (SW14) decrements the date by 1. (10) The CLR switch (SW12) moves the program to the initial setup screen. (10) CLR switch (6) Decision switch depressed, with “day” setup mode entered (4) Decision switch depressed, with “month” setup mode (2) Decision switch depressed, with “year” (1) Reset switch depressed - - - - 2000 00 - (3) UP/DOWN and numeric 2006 JanJan - (5) UP/DOWN switch 2006 (7) UP/DOWN Apr01 01 - - switch (8) Decision switch depressed, with calendar d t d (9) UP/DOWN 2006 Apr01 Sa switch - - - - Note: The displayable range is January 1, 2000 to December 31, 2099. REJ05B0813-0120 Rev.1.20 2007.11 Page 4 of 17 M16C/26A Group Sample Program (Calendar) 6. Definition of the RSK Functionality and the RSK_LIB APIs and Common Functions Used by the Calendar 6.1 Definition of the RSK Functionality RSKdefine.h file In this application, the following functionalities (those shown in red) are set. /********************************************************* The boot information on CPU is defined Usually, this mode is used *********************************************************/ #define _CPU_M16C26A_NORMAL_MOD /* Use in low power mode can be performed. */ //#define _CPU_M16C26A_32KHZ_MOD /* Use of access of a flash can be performed. */ //#define _CPU_M16C26A_DATAFLASF_USE /******************************************************** The hardware function which RSK supports is chosen /********************************************************/ #define _USE_KEY //#define _USE_BUZZER //#define _OPTION_USE_AD //#define _OPTION_USE_COM_RX //#define _OPTION_USE_COM_TX //#define _OPTION_USE_INFRAEDRX //#define _OPTION_USE_INFRAEDTX //#define _OPTION_USE_SW //#define _OPTION_USE_LED //#define _OPTION_USE_IO Individual definition of each selected functionality #if defined _USE_KEY /* A key matrix continues pushing and existence is defined.*/ /*When not using -USE_KEY_CONTINU is made a comment. */ #define _USE_KEY_CONTINU #if defined _USE_KEY_CONTINU #define _KEY_CONTEINU_ON (( char ) 1 ) #define _CONTINU_SW1 _KEY_CONTEINU_OFF #define _CONTINU_SW2 _KEY_CONTEINU_OFF #define _CONTINU_SW3 _KEY_CONTEINU_OFF #define _CONTINU_SW4 _KEY_CONTEINU_OFF #define _CONTINU_SW5 _KEY_CONTEINU_OFF #define _CONTINU_SW6 _KEY_CONTEINU_OFF #define _CONTINU_SW7 _KEY_CONTEINU_OFF #define _CONTINU_SW8 _KEY_CONTEINU_OFF #define _CONTINU_SW9 _KEY_CONTEINU_OFF #define _CONTINU_SW10 _KEY_CONTEINU_OFF #define _CONTINU_SW11 _KEY_CONTEINU_OFF #define _CONTINU_SW12 _KEY_CONTEINU_OFF #define _CONTINU_SW13 _KEY_CONTEINU_ON Continuous UP/DOWN key depressions are accepted. #define _CONTINU_SW14 _KEY_CONTEINU_ON #define _CONTINU_SW15 _KEY_CONTEINU_OFF #define _CONTINU_SW16 _KEY_CONTEINU_OFF #else REJ05B0813-0120 Rev.1.20 2007.11 Page 5 of 17 M16C/26A Group Sample Program (Calendar) 6.2 APIs and Common Functions Used ApiStatusType RL_SetTimerReq( unsigned int TimerValue, char TimerMode, int *TimerNo, int *ERcode ); ApiStatusType RL_StartTimer( int TimerNo, int *ERcode ); ApiStatusType RL_CheckTimer( int TimerNo, int *ERcode ); ApiStatusType RL_Get_Key( int *Inkey, int *ERcode ); ApiStatusType RL_Putc_Lcd( char Ylocation, char outc, int *ERcode ); ApiStatusType RL_Puts_LcdLoc( char Xlocation, char Ylocation, char RvTime, const char far* outc, int *ERcode ); void RL_ibytetoa( char Val, char *Str ); void RL_ErrorHook( int FuncNo, int ErrorNo ); For details about the APIs and common functions used by the sample program (calendar), see the Renesas Starter Kit Library V.1.00 Reference Manual. REJ05B0813-0120 Rev.1.20 2007.11 Page 6 of 17 M16C/26A Group Sample Program (Calendar) 7. Flowchart Calendar Clear display on LCD Request timer setup Start timers Show the initial screen Input keys Process date setup Function call by a state transition Process display REJ05B0813-0120 Rev.1.20 2007.11 Page 7 of 17 M16C/26A Group Sample Program (Calendar) 8. 1 Tutorial Launch the HEW by double-clicking its icon. 2 Change the session name from “default Session” to “SessionM16C_E8_System.” REJ05B0813-0120 Rev.1.20 2007.11 Page 8 of 17 M16C/26A Group Sample Program (Calendar) 3 Select “M30260F8A” for Device. Select “Download emulator firmware” for Mode. REJ05B0813-0120 Rev.1.20 2007.11 Page 9 of 17 M16C/26A Group Sample Program (Calendar) Check the box labeled “Power supply is carried out. (MAX 300mA)” and then select “5.0V.” REJ05B0813-0120 Rev.1.20 2007.11 Page 10 of 17 M16C/26A Group Sample Program (Calendar) 4 In the program and the work RAM text boxes of Firmware Location Address, enter. “FA0” and “0B8” respectively. Leave the box labeled “Debug a program using the WDT” unchecked. REJ05B0813-0120 Rev.1.20 2007.11 Page 11 of 17 M16C/26A Group Sample Program (Calendar) 5 Choose Download from the Debug tab and download a module. The upper-side choices for Download show the location from which a project was downloaded. REJ05B0813-0120 Rev.1.20 2007.11 Page 12 of 17 M16C/26A Group Sample Program (Calendar) 6 Click “Start after Reset” to start program execution. 7 Please do "Cancellation" when "The file is opened" window opens. REJ05B0813-0120 Rev.1.20 2007.11 Page 13 of 17 M16C/26A Group Sample Program (Calendar) 9. Example Circuit 10. Part List Part name Tact switch Switching diode PCB header Part No. SW1 - SW16 D2 - D5 JA1,JA2 Q’ty 16 4 2 Manufacturer OMRON ROHM Molex Type number B3FS-1000P 1SS355TE-17 10-88-1261 26-pin Male, 2-row, vertical type Value Remark REJ05B0813-0120 Rev.1.20 2007.11 Page 14 of 17 M16C/26A Group Sample Program (Calendar) 11. Web Sitet Renesas Technology Web site http://www.renesas.com/ REJ05B0813-0120 Rev.1.20 2007.11 Page 15 of 17 M16C/26A Group Sample Program (Calendar) Revision History Rev. 1.00 1.10 1.20 Date of issue 2006.06.30 2007.07.12 2007.11.29 Content of revision Page First revision issued Contents of presentation improved RSK_LIB APIs supported Points REJ05B0813-0120 Rev.1.20 2007.11 Page 16 of 17 M16C/26A Group Sample Program (Calendar) REJ05B0813-0120 Rev.1.20 2007.11 Page 17 of 17
M16C26A-C 价格&库存

很抱歉,暂时无法提供与“M16C26A-C”相匹配的价格&库存,您可以联系我们找货

免费人工找货