| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
Custom Builder Emulator Debugger PD77 Programming Manual Rev
Top Searches for this datasheetCB77 V.1.00 Custom Builder Emulator Debugger PD77 Programming Manual Rev. 1.00 2003 REJ10J0095-0100Z Active Microsoft, MS-DOS, Visual Basic, Visual C++, Windows Windows either registered trademarks trademarks Microsoft Corporation United States other countries. Keep safety first your circuit designs! Renesas Technology Corporation Renesas Solutions Corporation maximum effort into making semiconductor products better more reliable, there always possibility that trouble occur with them. Trouble with semiconductors lead personal injury, fire property damage. Remember give consideration safety when making your circuit designs, with appropriate measures such placement substitutive, auxiliary circuits, (ii) nonflammable material (iii) prevention against malfunction mishap. Notes regarding these materials These materials intended reference assist customers selection Renesas Technology product best suited customer's application; they convey license under intellectual property rights, other rights, belonging Renesas Technology Corporation, Renesas Solutions Corporation third party. Renesas Technology Corporation Renesas Solutions Corporation assume responsibility damage, infringement third-party's rights, originating product data, diagrams, charts, programs, algorithms, circuit application examples contained these materials. information contained these materials, including product data, diagrams, charts, programs algorithms represents information products time publication these materials, subject change Renesas Technology Corporation Renesas Solutions Corporation without notice product improvements other reasons. therefore recommended that customers contact Renesas Technology Corporation, Renesas Solutions Corporation authorized Renesas Technology product distributor latest product information before purchasing product listed herein. information described here contain technical inaccuracies typographical errors. Renesas Technology Corporation Renesas Solutions Corporation assume responsibility damage, liability, other loss rising from these inaccuracies errors. Please also attention information published Renesas Technology Corporation Renesas Solutions Corporation various means, including Renesas home page (http://www.renesas.com). When using information contained these materials, including product data, diagrams, charts, programs, algorithms, please sure evaluate information total system before making final decision applicability information products. Renesas Technology Corporation Renesas Solutions Corporation assume responsibility damage, liability other loss resulting from information contained herein. Renesas Technology semiconductors designed manufactured device system that used under circumstances which human life potentially stake. Please contact Renesas Technology Corporation, Renesas Solutions Corporation authorized Renesas Technology product distributor when considering product contained herein specific purposes, such apparatus systems transportation, vehicular, medical, aerospace, nuclear, undersea repeater use. prior written approval Renesas Technology Corporation Renesas Solutions Corporation necessary reprint reproduce whole part these materials. these products technologies subject Japanese export control restrictions, they must exported under license from Japanese government cannot imported into country other than approved destination. diversion reexport contrary export control laws regulations Japan and/or country destination prohibited. Please contact Renesas Technology Corporation Renesas Solutions Corporation further details these materials products contained therein. inquiries about contents this document product, fill text file installer generates following directory email your local distributor. Renesas Tools Homepage http://www.renesas.com/en/tools Overview Outline this manual What CB77? What done with CB77? Features CB77. Custom Command Programming Procedure creating custom commands. Example source program simplest custom command Functions that used programming custom command. Method using standard functions 2.4.1 Using heap area manipulating functions.5 2.4.2 Using character string manipulating functions.6 2.4.3 Using input/output functions.6 2.4.4 Using file manipulating functions.7 Method using debugger operating functions 2.5.1 Using execution controlling functions.8 2.5.2 Using register manipulating functions.9 2.5.3 Using memory manipulating functions.9 2.5.4 Using software break manipulating functions.10 2.5.5 Using debug information manipulating functions.11 2.5.6 Using scrip command executing functions.12 2.5.7 Using command executing functions.12 Custom Window Programming Procedure creating custom window. Example source program simplest custom window About handle functions. About framework source file Method using handle functions. 3.5.1 Using OnCreate handle function start creating window).17 3.5.2 Using OnDestroy handle function start destroying window).17 3.5.3 Using OnDraw handle function request redrawing window).18 3.5.4 Using OnEvent handle function (for status change PD77).19 3.5.5 Using OnSize handle function change window size).22 3.5.6 Using OnCommand handle function manipulate control items (buttons)).23 3.5.7 Using OnHScroll other handle functions manipulate scroll bars).24 3.5.8 Using OnLButtonDblClk other handle functions manipulate mouse).25 3.5.9 Using OnChar other handle functions manipulate keys).26 3.5.10 Using OnTimer handle function.27 Functions that used programming custom window. Method using window manipulating functions. 3.7.1 Using drawing functions.28 3.7.2 Using functions manipulate control items (buttons).30 3.7.3 Using functions manipulate status bar.32 3.7.4 Using functions manipulate scroll bar.33 3.7.5 Using functions manipulate dialog box.35 3.7.6 Using functions manipulate window frame.36 3.7.7 Using functions operate system timer.37 Overview Outline this manual This manual describes write program when creating custom command custom window programs using CB77. details CB77, please refer "CB77 V.1.00 User's Manual." What CB77? CB77 entirely development environment that allows create your exclusive commands windows that operate PD77, emulator debugger 7700/7751 series. What done with CB77? using CB77 easily create (program) custom commands custom windows PD77. CB77 provides integrated support operations from programming custom commands windows compiling debugging them. custom commands windows thus created used readily PD77. short, CB77 lets upgrade functions PD77 customize easily yourself. Since custom commands windows created using CB77 control emulators (PC4701HS/L) directly, various debug functions wish have such those listed below easily obtained. Reference modify target memory contents Reference analyze real-time trace data Control target program execution running stopping program single-stepping source lines Build automatic target system testing environment Features CB77 window design similar that PD77 adopted operational integrity with PD77. integrated development environment programming, compiling, debugging provided. commands windows that operate PD77 created yourself. program description language supported CB77 C-language subset. Various libraries like those listed below available CB77: Standard function library (stdlib.lib) Emulator operating function library (system.lib) Window operating function library (winlib.lib) Custom Command Programming This chapter describes program custom commands PD77. Procedure creating custom commands create custom command using CB77, follow procedure described below. Creating project project source programs necessary create custom commands. Create project custom command created. details create project, refer "CB77 V.1.00 User's Manual," Section 3.1.1, "Creating Project Custom Command Program". Creating source programs Write operation custom command source file. details create source file, refer "CB77 V.1.00 User's Manual," Section 3.1.2, "Creating Source File". details source file project, refer "CB77 V.1.00 User's Manual," Section 3.1.3, "Adding Source File Project". Building command program term "build" refers creating custom command program compiling source programs created above. details about this operation, refer "CB77 V.1.00 User's Manual," Section 3.1.4, "Building Program". Debugging command program custom command program created does work intended, debug details debug, refer "CB77 V.1.00 User's Manual," Section 2.1, "CB77 Window". Adding custom command PD77 custom command thus completed, PD77. details add, refer "Customize Functions" "PD77 V.1.00 User's Manual." Described this manual method programming "Creating source programs" outlined above. other details, refer corresponding sections "CB77 V.1.00 User's Manual." This section explains method programming with CB77 using source program simplest custom command example. Example custom command Command name hello Format hello address <RET> Content Display character string "Hello CB77 World!" script window. Then input character string from script window. After entering character string, store address that specified first parameter command. error occurs during processing, terminate command. Example source program #include <stdlib.h> #include <system.h> Example source program simplest custom command main(int argc, char **argv) char str[128]; val, len; Program executed from main() function if(argc exit(1); printf("Hello CB77 if(gets(str) NULL){ Command terminated parameter nonexistent Character string output script window Character string input from script window exit(1); if(_exp_eval(argv[1], EXP_DEFAULT, EXP_LABEL, &val) FALSE){ Assembler expression analyzed value exit(1); strlen(str); for(i len; i++){ Memory contents modified if(_mem_put(val &(str[i])) FALSE){ exit(1); exit(0); Explanation source program custom command begins from main() function. programming language used C-language subset specifically designed CB77. Specifications this language detailed "CB77 V.1.00 User's Manual," Section "Programming Language Specifications". major differences with language follows: Aggregates (structures unions) supported. Real types (float double) supported. Stored argc number arguments, what stored argv address that contains pointer array that contains pointer area which character string specified argument stored. This same arguments main() function standard language handled. Note that although main() function only function used this example, multiple user-defining functions used same language. quit command middle, exit() function. Specifications this function detailed "CB77 V.1.00 User's Manual," Section 5.1.9, "exit: Terminate program execution". display character string script window, printf() function. Specifications this function detailed "CB77 V.1.00 User's Manual," Section 5.1.17, "printf: Output characters with format Script Window)". input character string from script window, gets() function. This function used almost same gets() function language. Specifications this function detailed "CB77 V.1.00 User's Manual," Section 5.1.8, "gets: Input character string (from Script Window)". analyze assembler expression value, _exp_eval() function. Labels symbols used expressions analyzed this function. Specifications this function detailed "CB77 V.1.00 User's Manual," Section 5.2.59, "_exp_eval: Analyze assembler expression". value target memory, _mem_put() function. Specifications this function detailed "CB77 V.1.00 User's Manual," Section 5.2.189, "_mem_put: memory value". Functions that used programming custom command functions that used programming custom command broadly classified into following groups. Standard functions functions similar standard C-language functions that assumed relatively frequently used supported. Debugger operating functions functions necessary operate debugger supported. Method using standard functions When using standard functions, include header file "stdlib.h" function going use. Specifications standard functions detailed "CB77 V.1.00 User's Manual," Section 5.1, "Standard Functions (stdlib.lib)". 2.4.1 Using heap area manipulating functions This section explains functions manipulating heap area using function shown below example. Function name Description malloc Allocate memory from heap area [Program example] char *regist_name(char *name) char len; if(name NULL){ strlen(name); malloc(len if(p NULL){ return NULL; strcpy(p, name); return This line processed only when "name" NULL length character string Allocate area bytes Memory allocation failed NULL Error Shown above program example used create user-defined function that stores character string specified argument "name" heap area using malloc() function. return NULL; Duplicate character string Return stored area Error 2.4.2 Using character string manipulating functions This section explains functions manipulating character strings using functions shown below example. Function name Description strcmp Compare character strings strtoi Convert character string into value sprintf Output character string with format memory) [Program example] eval_str(char *str1, char *str2, char *str3) value; if(strcmp(str1, "go") When str1 "go" if(strtoi(str2, &value) TRUE){ When str2 converted into value Output str3 with format included sprintf(str3, value, value); return TRUE; Succeeded return FALSE; Error Shown above program example used create user-defined function that when argument "str1" "go," converts numeral-representing character string specified argument "str2" into numeric value outputs area specified argument "str3" with format included. 2.4.3 Using input/output functions This section explains input/output functions using functions shown below example. Function name Description gets Input character string (from Script Window) printf Output character string with format Script Window) [Program example] echo_str() char str[1024]; if(gets(str) NULL){ Character string obtained printf("Your input str); Output with format included return TRUE; Succeeded return FALSE; Error Shown above program example used create user-defined function that outputs character string entered input area Script Window window's display area with format included. 2.4.4 Using file manipulating functions This section explains file manipulating functions using functions shown below example. Function name Description fopen Open file fclose Close file fprintf Output data with format file) [Program example] put_file(char *filename, data1, data2, data3, data4) if((fd fopen(filename, NULL){ return FALSE; fprintf(fd, "Data1 data1); fprintf(fd, "Data2 data2); fprintf(fd, "Data3 data3); fprintf(fd, "Data4 data4); fclose(fd); return TRUE; Open file Error Output data1 Output data2 Output data3 Output data4 Close file Succeeded Shown above program example used create user-defined function that creates file specified argument "filename" outputs data specified arguments "data1" through "data4" file with format included. Method using debugger operating functions When using debugger operating functions, include header file system.h function going use. Specifications debugger operating functions detailed "CB77 V.1.00 User's Manual," Section 5.2, "System Call Functions Debugger Operation (system.lib)". 2.5.1 Using execution controlling functions This section explains functions controlling program execution using functions shown below example. Function name Description _cpu_go Execute program free-run _cpu_stop Stop program execution _cpu_reset Reset target system [Program example] go_stop_10() for(i i++){ if(_cpu_go() FALSE){ return FALSE; if(_cpu_stop() FALSE){ return FALSE; Repeat times Execute program free-run mode Error above Stop program execution Error above Reset target Error above Succeeded Shown above program example used create user-defined function that repeats program execution stopping free-run mode times before resetting target system. if(_cpu_reset() FALSE){ return FALSE; return TRUE; 2.5.2 Using register manipulating functions This section explains functions manipulating registers using functions shown below example. Function name Description _reg_get_pc program counter value _reg_put_reg register value [Program example] pc_inc_intb() reg; if(_reg_get_pc(®) FALSE){ return FALSE; (reg 0xff) if(_reg_put_reg(reg, IN1_REG_1_A) FALSE){ return FALSE; return TRUE; value Error above Low-order bits value table Error above Succeeded Shown above program example used create user-defined function that sets current value program counter table register after incrementing value low-order bits 2.5.3 Using memory manipulating functions This section explains memory manipulating functions using functions shown below example. Function name Description _mem_get memory value _mem_put memory value [Program example] inc_1000H() char data[128]; if(_mem_get(0x1000, 128, data) FALSE){ return FALSE; for(i 128; i++){ (data[i])++; if(_mem_put(0x1000, 128, data) FALSE){ return FALSE; return TRUE; bytes beginning with address 1000H Error above Repeat times Increment data bytes beginning with address 1000H Error above Succeeded Shown above program example used create user-defined function that increments bytes memory values beginning with address 1000H 2.5.4 Using software break manipulating functions This section explains functions manipulating software breaks using functions shown below example. Function name Description _break_set Set/enable software break _break_reset Clear software break [Program example] Shown above program example used create user-defined function that executes program until stopped address F000H. go_F000H() if(_break_set(0xF000) FALSE){ return FALSE; if(_cpu_gb() FALSE){ return FALSE; _cpu_wait(); if(_break_reset(0xF000) FALSE){ F000H return FALSE; return TRUE; software break address F000H Error above Execute program with break Error above Wait until target execution stopped Clear software break address Error above Succeeded 2.5.5 Using debug information manipulating functions This section explains functions manipulating debug information using functions shown below example. Function name Description _line_addr2line source line indicated address _exp_eval Analyze assembler expression _c_exp_eval Analyze C-language expression [Program example] str_eval(char *str, *is_c, char *filename, *line, *find_line) value, val; char s1[128], s2[128], s3[128]; if(_exp_eval(str, EXP_DEFAULT, EXP_LABEL, &value) TRUE){ *is_c FALSE; Assembler expression }else if(_c_exp_eval(str, &value, &val, TRUE){ *is_c TRUE; C-language expression }else{ return FALSE; Error analyzing expression if(_line_addr2line(value, line, filename) TRUE){ *find_line TRUE; Source file name line number }else{ found *find_line FALSE; Source file name line number nonexistent Shown above program example used create user-defined function that determines whether character string specified argument assembler C-language expression gets source file name line number that corresponds address obtained analyzing expression. return TRUE; 2.5.6 Using scrip command executing functions This section explains functions executing script commands using functions shown below example. Function name Description _syscom Execute PD77's script command [Program example] DB(int addr) char str[128]; sprintf(str, addr); if(_syscom(str) FALSE){ return FALSE; return TRUE; Create script command character string Execute script command Error above Succeeded Shown above program example used create user-defined function that executes DumpByte script command using address specified argument addr first argument. 2.5.7 Using command executing functions This section explains functions executing commands using functions shown below example. Function name Description _doscom Execute command [Program example] CP(char *src, char *dest) char str[256]; sprintf(str, "copy src, dest); Create command character string if(_doscom(str) FALSE) Execute command return FALSE; Error above return TRUE; Succeeded Shown above program example used create user-defined function that executes command copy file from directory specified argument directory specified argument dest. Custom Window Programming This chapter explains program custom windows PD77. Procedure creating custom window create custom window using CB77, follow procedure described below. 1.Creating project project source programs necessary create custom windows. Create project custom window created. details create project, refer "CB77 V.1.00 User's Manual," Section 3.2.1, "Creating Project Custom Window Program". 2.Creating source programs Write operation custom window framework source file that automatically generated CB77 when creating project. details edit framework source file, refer "CB77 V.1.00 User's Manual," Section 3.2.2, "Editing Automatically Created Framework Source File". 3.Building window program term "build" refers creating custom window program compiling source programs created above. details about this operation, refer "CB77 V.1.00 User's Manual," Section 3.1.4, "Building Program". 4.Debugging window program custom window program created does work intended, debug details debug, refer "CB77 V.1.00 User's Manual," Section 2.1, "CB77 Window". 5.Adding custom window PD77 custom window thus completed, PD77. details add, refer "Customize Functions" "PD77 V.1.00 User's Manual." Described this manual method programming "Creating source programs" outlined above. other details, refer corresponding sections "CB77 V.1.00 User's Manual." This section explains method programming with CB77 using source program simplest custom window example. Example custom window Window name Hello Window Content Display "Hello Window" title Window size pixels Display characters "Hello CB77 World!" start line current value display after Example source program (excerpt from framework source file) Example source program simplest custom window OnCreate() OnCreate() function framework source file Write message handler code here, please. Display "Hello Window" title _win_set_window_title("H ello Window"); window size pixels) _win_set_window_size(300, 200); OnDraw() OnDraw() function framework source file Write message handler code here, please. drawing start position (cursor coordinates) _win_set_cursor(0, Display "Hello CB77 World!" window _win_printf("Hello CB77 _reg_get_pc(&pc); Display value window _win_printf("PC pc); lines printed plain style codes automatically generated framework source file CB77. lines printed bold face codes added user. Execution example Explanation source file (called "framework source file") automatically generated CB77 when creating custom window project contains several functions written beforehand. These functions special ones that automatically called PD77 when operation performed custom window. These functions called "handle functions." OnCreate() handle function called immediately before creating window order initialize window frame size, title, necessary variables. This handle function executed first functions when start custom window program. Specifications this function detailed "CB77 V.1.00 User's Manual," Section 5.4.4, "OnCreate Handle Function". title custom window, _win_set_window_title() function. Specifications this function detailed "CB77 V.1.00 User's Manual," Section 5.3.23, "_win_set_window_title: custom window title". size custom window, _win_set_window_size() function. Specifications this function detailed "CB77 V.1.00 User's Manual," Section 5.3.38, "_win_set_window_size: custom window size". OnDraw() handle function called when, example, displaying part whole) window that hidden behind some other window order redraw window. Specifications this function detailed "CB77 V.1.00 User's Manual," Section 5.4.6, "OnDraw Handle Function". cursor position, _win_set_cursor() function. Specifications this function detailed "CB77 V.1.00 User's Manual," Section 5.3.3, "_win_set_cursor: cursor position". output character string current cursor position window, _win_printf() function. this case, cursor moved position next last character that output. Specifications this function detailed "CB77 V.1.00 User's Manual," Section 5.3.1, "_win_printf: Output character string with format Custom Window)". About handle functions custom window functions PD77 windows. Therefore, custom window exchanges information with PD77 goes operating. When operation performed custom window elapsed time notified system timer, PD77 calls corresponding handle function custom window program operation performed notification received. processing written handle function executed when such operation performed custom window that requires calling handle function. handle functions have argument. their returned values evaluated PD77. OnMouseMove() handle function that called when mouse moved, OnSize() handle function that called when window size changed, example, data showing current mouse position window size before change stored area indicated global variable _HandleMsgBlock located library immediately before calling handle function. referencing data stored _HandleMsgBlock within handle function, possible information associated with operation performed notification received. procedure getting such information automatically written framework source file. details about handle functions, refer "CB77 V.1.00 User's Manual," Section 5.4, "Handle Functions Custom Window". [Precaution] Since handle functions special functions called PD77, call them freely like user-defined function. This because such operation could make impossible PD77 call them correctly. CB77 automatically generates source file (i.e., framework source file) when creating project. handle functions called PD77 procedures acquiring data written this file. Among such procedures written framework source file codes information associated with operation performed custom window received notification from _HandleMsgBlock copy local variable(s) handle function. processing operations performed custom window wanted, write each corresponding handle function framework source file after comment shown below. Write message handler code here, please. [Precaution] delete handle functions written framework source file. CB77 will become unable build correctly. modify local variable setup procedures written handle functions either. custom window program become unable operate correctly. About framework source file Method using handle functions This section describes handle functions written framework source file. [Precaution] Since handle functions special functions called PD77, call them freely like user-defined function. This because such operation could make impossible PD77 call them correctly. 3.5.1 Using OnCreate handle function start creating window) When PD77 starts executing custom window program, OnCreate() function called only once immediately before creating custom window. this function, position which window opens, window size when opened, window title, well generate control items (e.g., buttons). OnCreate handle function that automatically created shown below. (There information associated with it.) OnCreate() Write message handler code here, please. OnCreate() handle function first function executed among functions custom window program source file. When creating window, handle functions called order OnCreate OnSize OnDraw. 3.5.2 Using OnDestroy handle function start destroying window) When system menu selected close custom window that open, OnDestroy() handle function called only once immediately before destroying custom window. this function, free heap area system timer perform related other operations. control items automatically destroyed after this function executed. OnDestroy handle function that automatically created shown below. (There information associated with it.) OnDestroy() Write message handler code here, please. OnDestroy() handle function last function executed among functions custom window program source file. After processing OnDestroy() handle function terminated, PD77 frees control items used destroys custom window before finishes executing custom window program. 3.5.3 Using OnDraw handle function request redrawing window) OnDraw() handle function called cases described below. this function, PD77 draws window window drawing area. When part whole) custom window hidden behind some other window hidden part exposed this case, window drawing area cleared immediately before calling OnDraw() handle function. When window manipulating functions redraw window called There following redraw functions: _win_redraw_clear() this function called, window drawing area cleared immediately before calling OnDraw() handle function. _win_redraw() this function called, window drawing area cleared immediately before calling OnDraw() handle function. OnDraw handle function that automatically created shown below. (There information associated with it.) OnDraw() Write message handler code here, please. Since OnDraw() handle function called rather frequently, Mitsubishi recommends that this function used only drawing window, that OnEvent() handle function, etc. used process data required drawing (e.g., memory register values) that takes time. 3.5.4 Using OnEvent handle function (for status change PD77) OnEvent() handle function called when status PD77 changed. this function, processing performed that corresponds change PD77 status. change PD77 status refers following events: When target program downloaded When target program single-stepped When register value modified When information displayed PD77 modified type change that occurred status PD77 passed local variable nEventID. Types status detailed "CB77 V.1.00 User's Manual," Section 5.4.7, "OnEvent Handle Function". Since processing need performed multiple status changes handle function, procedure that taken normally that switch statement, etc. used beginning function determine type change indicated local variable nEventID control made branch processing that corresponds status change that occurred. OnEvent handle function that automatically created shown below. (The information associated with nEventID.) OnEvent() nEventID; nEventID ((int *)_HandleMsgBlock)[0]; Write message handler code here, please. target memory value modified PD77's dump window, etc., OnEvent() handle function called nEventID EVENT_PUT_MEM. custom window where memory values displayed, memory values reacquired update display. Note that when target program executing, OnEvent() handle function periodically called nEventID EVENT_TIME_10MS. recommended that processing which need performed periodically only when target program executing (e.g., processing based sampling) written place which control branches nEventID EVENT_TIME_10MS. [About window drawing processing] following explains processing performed draw window using OnDraw() OnEvent() handle functions described above. There following ways which OnDraw() handle function normally used: Drawing processing performed this function; instead, some other function that performs entire drawing processing called. (The OnDraw() handle function works merely that receives redrawing request. drawing processing performed calling some other function.) Drawing processing performed this function. some cases, "subcontract" function called.) (The OnDraw() function must always executed perform processing draw window.) following explains difference between these methods each method used. Drawing processing need performed times other than when OnDraw() function called. example, assume window (e.g., PD77's memory window) which specific memory content displayed successively. such window, every time target memory value modified, window display must updated with memory value. such case, OnEvent() handle function used target memory value which then stored global variable drawn window drawing function. method used drawing window, memory value OnEvent() handle function then call function directly from that performs drawing processing. Thus, method that when drawing required, function perform drawing processing called directly after acquiring data necessary drawing. This procedure schematically shown below. OnDraw() draw(); OnEvent() process data; data global variable; draw(); draw() Update window display using global variable; method used drawing window, memory value OnEvent() handle function then call _win_redraw() _win_redraw_clear() function order request PD77 call OnDraw() handle function. Thus, method that when drawing required, OnDraw() function called indirectly requesting from PD77 after acquiring data necessary perform drawing processing. This procedure schematically shown below. OnDraw() Update window display using global variable; PD30 requested call OnDraw() handle function. OnEvent() process data; data global variable; _win_redraw(); OnDraw() handle function frequently called, even unintended occasion such when some other window crosses front window. Therefore, desirable that OnDraw() handle function used only drawing, that timeconsuming processing (e.g., acquiring processing data) performed other timing. 3.5.5 Using OnSize handle function change window size) OnSize() handle function called when size custom window changed. this function, PD77 performs processing that corresponds change customer window size. type size change (e.g., maximize iconify) width height client area passed local variables nType, respectively. Types size changes detailed "CB77 V.1.00 User's Manual," Section 5.4.18, "OnSize Handle Function". OnSize handle function that automatically created shown below. (The information associated with nType, cy.) OnSize() nType; nType ((int *)_HandleMsgBlock)[0]; ((int *)_HandleMsgBlock)[1]; ((int *)_HandleMsgBlock)[2]; Write message handler code here, please. custom window programs that change drawing, etc. using window's size information, global variables hold window sizes (cx, acquired OnSize() handle function. Since OnSize() handle function called following OnCreate() handle function when creating window, also used window size when created. 3.5.6 Using OnCommand handle function manipulate control items (buttons)) OnCommand() handle function called when generated control items (buttons) operated this function, perform processing that corresponds control item that operated control item's command notification code, handle respectively passed local variables nID, nMsg, hHandle. OnCommand() handle function detailed "CB77 V.1.00 User's Manual," Section 5.4.3, "OnCommand Handle Function". OnSize handle function that automatically created shown below. (The information associated with nId, nMsg, hHandle.) OnCommand() nId; nMsg; nHandle; ((int *)_HandleMsgBlock)[0]; nMsg ((int *)_HandleMsgBlock)[1]; nHandle ((int *)_HandleMsgBlock)[2]; Write message handler code here, please. Buttons only control item supported CB77 V.1.00. local variable nMsg used buttons; nMsg reserved future versions CB77. 3.5.7 Using OnHScroll other handle functions manipulate scroll bars) OnHScroll() handle function called when horizontal scroll operated Similarly, OnVScroll() handle function called when vertical scroll operated these functions, perform processing that corresponds scroll that operated operation code scroll (e.g., drag, page scroll) scroll thumb (slider) position respectively passed local variables "nSBCode" "nPos". operation code scroll thumb position detailed "CB77 V.1.00 User's Manual," Section 5.4.8, "OnHScroll Handle Function". OnHScroll handle function that automatically created shown below. (The information associated with nSBCode nPos.) OnHScroll() nSBCode; nPos; nSBCode ((int *)_HandleMsgBlock)[0]; nPos ((int *)_HandleMsgBlock)[1]; Write message handler code here, please. local variable nPos used only when nSBCode SB_THUMBPOSITION SB_THUMBTRACK. When scroll operation completed, these functions called nSBCode SB_ENDSCROLL notify scroll operation window. 3.5.8 Using OnLButtonDblClk other handle functions manipulate mouse) Following handle functions called when mouse operated Handle function Cases where function called OnLButtonDblClk When left mouse button double-clicked. OnLButtonDown When left mouse button pressed. OnLButtonUp When left mouse button released. OnMouseMove When mouse cursor moved. OnRButtonDblClk When right mouse button double-clicked. OnRButtonDown When right mouse button pressed. OnRButtonUp When right mouse button released. these functions, perform processing that corresponds kind operation performed mouse. code that pressed same time mouse operated mouse cursor's coordinates respectively passed local variables nFlags, code detailed "CB77 V.1.00 User's Manual," Section 5.4.11, "OnLButtonDblClk Handle Function". OnHScroll handle function that automatically created shown below. (The information associated with nFlags, OnLButtonDblClk() nFlags; nFlags ((int *)_HandleMsgBlock)[0]; ((int *)_HandleMsgBlock)[1]; ((int *)_HandleMsgBlock)[2]; Write message handler code here, please. When mouse button double-clicked, above handle functions called order OnXButtonDown OnXButtonUp OnXButtonDblClik OnXButtonUp. when left button concerned when right button concerned.) 3.5.9 Using OnChar other handle functions manipulate keys) Following handle functions called when operated keyboard. Handle function Cases where function called OnChar When WM_KEYDOWN message converted into character code. Stored code converted ASCII code. OnKeyDown When other than system pressed. Stored code virtual code pressed key. OnKeyUp When other than system released. Stored code virtual code released key. these functions, perform processing that corresponds kind operation performed keyboard. code, repeat count value, scan code value pressed passed local variables nChar, nRepCnt, nFlags, respectively. code repeat count scan code values detailed "CB77 V.1.00 User's Manual," Section 5.4.9, "OnKeyDown Handle Function". OnChar handle function that automatically created shown below. (The information associated with nChar, nRepCnt, nFlags.) OnChar() nChar; nRepCnt; nFlags; nChar ((int *)_HandleMsgBlock)[0]; nRepCnt ((int *)_HandleMsgBlock)[1]; nFlags ((int *)_HandleMsgBlock)[2]; Write message handler code here, please. When that converted into character code pressed, above handle functions called order OnKeyDown OnChar OnKeyUp. held down, handle functions called order OnKeyDown (OnChar) OnKeyDown (OnChar) OnKeyUp. (The OnChar handle function called only when pressed that converted into character code.) pressed corresponds ASCII characters, corresponding ASCII code stored nChar. keys that correspond ASCII characters such case function keys, corresponding virtual code value stored nChar. details about virtual code, refer "CB77 V.1.00 User's Manual," Section 5.4.9, "OnKeyDown Handle Function". 3.5.10 Using OnTimer handle function OnTimer() handle function called preset intervals when system timer provided Windows used. this function, write processing that executed preset intervals. timer's identification number passed local variable nIDEvent. This identification number desired user when using Windows' system timer. Since processing need performed multiple timer-related processing handle function, procedure that taken normally that switch statement, etc. used beginning function determine type timer indicated local variable nIDEvent control made branch processing that corresponds timer concerned. OnTimer handle function that automatically created shown below. (The information associated with nIDEvent.) OnTimer() nIDEvent; nIDEvent ((int *)_HandleMsgBlock)[0]; Write message handler code here, please. Note that when target program executing, OnEvent() handle function periodically called nEventID EVENT_TIME_10MS. recommended that processing which need performed periodically only when target program executing (e.g., processing based sampling) serviced OnEvent() handle function. [Precaution] total number system timers limited used. many system timers than necessary could affect operation other applications. Functions that used programming custom window functions that used programming custom window broadly classified into following three groups: Standard functions functions similar standard C-language functions that assumed relatively frequently used supported. Debugger operating functions functions necessary operate debugger supported. Window manipulating functions functions necessary manipulate window supported. When using window manipulating functions, include header file "winlib.h" function going use. Specifications window manipulating functions detailed "CB77 V.1.00 User's Manual," Section 5.3, "System Call Functions Window Operation (winlib.lib)". 3.7.1 Using drawing functions This section explains drawing functions using functions shown below example. Function name Description _win_printf Output text with format _win_set_cursor cursor position _win_set_color text color _win_set_bkcolor background color _draw_frame_rect Draw rectangle functions whose name begins with _win draw object cursor coordinates (the coordinate system specified column). character system font output column cursor coordinate. functions whose name begins with _draw draw object pixel coordinates (the coordinate system specified position). following shows example where character strings "Hello world" output custom window. OnDraw() Write message handler code here, please. _win_set_cursor(3, cursor position _win_printf("Hello World."); Output character string Method using window manipulating functions lines printed plain style codes automatically generated framework source file CB77. lines printed bold face codes added user. (The same applies examples that follow.) Display example following shows example where "Hello world" output inverse video. OnDraw() Write message handler code here, please. old_color; Variable used save text color before change old_bkcolor; Variable used save background color before change _win_set_cursor(3, cursor position text color white old_color _win_set_color(COLOR_WHITE) background color black old_bkcolor _win_set_bkcolor(COLOR_BLACK); _win_printf("Hello World."); Output character string _win_set_color(old_color); Restore text color _win_set_bkcolor(old_bkcolor); Restore background color Display example following shows example where rectangular area drawn. OnDraw() Write message handler code here, please. Draw rectangle whose upper left coordinate (10, lower right coordinate (150, _draw_frame_rect(10, 150, COLOR_RED); Display example 3.7.2 Using functions manipulate control items (buttons) Buttons supported control item that attached custom window created CB77. This section explains control item manipulating functions using functions shown below example. Function name Description _win_button_create Create button _win_button_set_text Change button text following shows example where button assigned label "button" when created label changed between uppercase lowercase each time button entered. #define IDB_BUTTON hButton; count; (1000) Define button number Variable store button handle Variable store button-pressed count OnCommand() nId; nMsg; nHandle; ((int *)_HandleMsgBlock)[0]; nMsg ((int *)_HandleMsgBlock)[1]; nHandle ((int *)_HandleMsgBlock)[2]; Write message handler code here, please. switch(nId){ case IDB_BUTTON: button IDB_BUTTON if(++count button-pressed count number Change label "BUTTON" _win_button_set_text(hButton, "BUTTON"); }else{ button-pressed count even number Change label "button" _win_button_set_text(hButton, "button"); break; OnCreate() Write message handler code here, please. count Initialize button-pressed count Create button whose upper left coordinate (10, lower right coordinate (100, that label "button" IDB_BUTTON hold button's handle hButton hButton _win_button_create(10, 100, "button", IDB_BUTTON); Display example (when created) Display example (when button entered) 3.7.3 Using functions manipulate status This section explains status manipulating functions using functions shown below example. Function name Description _win_statusbar_create Create status _win_statusbar_set_pane items status _win_statusbar_set_text text status following shows example status that five items. OnCreate() Write message handler code here, please. _win_statusbar_create(5);/* Create status that five items item (leftmost item) SBPS_NOBORDER style size pixels _win_statusbar_set_pane(0, SBPS_NOBORDERS, 20); Draw item _win_statusbar_set_text(0, "0"); item SBPS_POPOUT style size pixels _win_statusbar_set_pane(1, SBPS_POPO 20); Draw item _win_statusbar_set_text(1, "1"); item SBPS_DISABLED style size pixels _win_statusbar_set_pane(2, SBPS_DISABLED, 20); item SBPS_NORMAL style size pixels _win_statusbar_set_pane(3, SBPS_NORMAL, 20); Draw item _win_statusbar_set_text(3, "3"); item SBPS_STRETCH SBPS_NORMAL style Since SBPS_STRETCH style set, item stretches window expanded reduced _win_statusbar_set_pane(4, SBPS_STRETCH SBPS_NORMAL, Draw item _win_statusbar_set_text(4, "4"); Specify style status item third argument _win_statusbar_set_pane() function. Styles detailed "CB77 V.1.00 User's Manual," Section 5.3.32, "_win_statusbar_set_pane: status items". Display example 3.7.4 Using functions manipulate scroll This section explains scroll manipulating functions using functions shown below example. Function name Description _win_vscroll_range scroll range vertical scroll _win_vscroll_pos position vertical scroll following shows example displaying vertical scroll window. OnCreate() Write message handler code here, please. _win_vscroll_range(0, 100); scroll range through Display example Shown below example OnVScroll() handle function which processing written that corresponds up/down operation scroll bar. VScrollPageSize; VScrollPos; Contain number lines page Store thumb position OnVScroll() nSBCode; nPos; nSBCode ((int *)_HandleMsgBlock)[0]; nPos ((int *)_HandleMsgBlock)[1]; Write message handler code here, please. switch(nSBCode){ case SB_BOTTOM: Scroll bottom VScrollPos 100; break; case SB_ENDSCROLL: Finish scrolling break; case SB_LINEDOWN: Scroll line down VScrollPos++; break; case SB_LINEUP: Scroll line VScrollPos-; break; case SB_PAGEDOWN: Scroll page down VScrollPos VScrollPageSize; break; case SB_PAGEUP: Scroll page VScrollPos VScrollPageSize; break; case SB_THUMBPOSITION: Scroll absolute position (Current position specified nPos) case SB_THUMBTRACK: Drag scroll specified position (Current position specified nPos) VScrollPos nPos; break; case SB_TOP: Scroll default: VScrollPos if(VScrollPos Processing performed when output scroll VScrollPos if(VScrollPos 100) VScrollPos 100; _win_vscroll_pos(VScrollPos); _win_redraw _clear(); range scroll thumb position Redraw custom window 3.7.5 Using functions manipulate dialog This section explains dialog manipulating functions using functions shown below example. Function name Description _win_dialog Create input dialog _win_message_box Create message following shows example where input dialog used value. This function opens input dialog box, asking user input value, when "eisuke" input, returns TRUE; otherwise, returns FALSE after displaying error message box. check_name() char name[100]; Open input dialog box, asking input if(_win_dialog("Please input your name.", name) TRUE){ button input if(strc p(name, "eisuke") Character string "eisuke" return TRUE; Display error message _win_message_box(" Name incorrect "Error!", MB_ICONEXCLAMATION MB_OK); return FALSE; Display example Input dialog Message 3.7.6 Using functions manipulate window frame This section explains window frame manipulating functions using functions shown below example. Function name Description _win_redraw Redraw custom window _win_redraw_clear Redraw custom window (with area clear) _win_set_window_title title custom window _win_set_window_pos position custom window _win_set_window_size size custom window following shows example where custom window titled Window" size when opened (300 200) pixels window opened position window position referenced upper left corner PD77 window's client area origin with pixels rightward direction defined those downward direction defined OnCreate() Write message handler code here, please. _win_set_window_title("My Window"); _win_set_window_size(300, 200); _win_set_window_pos(0, window title window size window position Display example 3.7.7 Using functions operate system timer This section explains system timer operating functions using functions shown below example. Function name Description _win_timer_set system timer _win_timer_kill Clear system timer following shows example where system timer used increment counter every #define IDT_1 count; (10) Define timer number Counter OnCreate() Write message handler code here, please. _win_timer_set(IDT_1, 200); count OnDestroy() Write message handler code here, please. _win_timer_kill(IDT_1); OnTimer() system timer Initialize counter Clear system timer nIDEvent; nIDEvent ((int *)_HandleMsgBlock)[0]; Write message handler code here, please. if(nIDEvent IDT_1){ count++; system timer IDT_1 Increment counter Note that when target program executing, OnEvent() handle function periodically called nEventID EVENT_TIME_10MS. recommended that processing which need performed periodically only when target program executing (e.g., processing based sampling) serviced OnEvent() handle function. [Precaution] total number system timers limited used. many system timers than necessary could affect operation other applications. CB77 V.1.00 Programming Manual Rev. 1.00 2003 REJ10J0095-0100Z COPYRIGHT ©2003 RENESAS TECHNOLOGY CORPORATION RENESAS SOLUTIONS CORPORATION RIGHTS RESERVED Other recent searchesZL40813 - ZL40813 ZL40813 Datasheet ZL40813 - ZL40813 ZL40813 Datasheet ZL40813 - ZL40813 ZL40813 Datasheet ZL40814 - ZL40814 ZL40814 Datasheet ZL40814 - ZL40814 ZL40814 Datasheet ZL40818 - ZL40818 ZL40818 Datasheet ZL40818 - ZL40818 ZL40818 Datasheet U2102B - U2102B U2102B Datasheet PBSS5140T - PBSS5140T PBSS5140T Datasheet LDD511 - LDD511 LDD511 Datasheet 2DBK-XX - 2DBK-XX 2DBK-XX Datasheet RP4-PF - RP4-PF RP4-PF Datasheet KSR1108 - KSR1108 KSR1108 Datasheet KSR2108 - KSR2108 KSR2108 Datasheet GPAF1601 - GPAF1601 GPAF1601 Datasheet GPAF1607 - GPAF1607 GPAF1607 Datasheet DS14C335 - DS14C335 DS14C335 Datasheet BA00DD0WCP-V5 - BA00DD0WCP-V5 BA00DD0WCP-V5 Datasheet BA00DD0WHFP - BA00DD0WHFP BA00DD0WHFP Datasheet BA00DD0WT - BA00DD0WT BA00DD0WT Datasheet BA00CC0WT - BA00CC0WT BA00CC0WT Datasheet BA00CC0WT-V5 - BA00CC0WT-V5 BA00CC0WT-V5 Datasheet BA00CC0WCP-V5 - BA00CC0WCP-V5 BA00CC0WCP-V5 Datasheet BA00CC0WFP - BA00CC0WFP BA00CC0WFP Datasheet 1712120000 - 1712120000 1712120000 Datasheet
Privacy Policy | Disclaimer |