Home

SM850 System Simulator Ver. 2.00 or Later External Part User Open

image

Contents

1. 4 20 0 21 3 2 1 Customization via Parts windOwW ccccccccesseseeceeeeceasesseeeceeeseeaseeeeceesaueeseeeessesseaeeeeeseseeaeaeeeseeeess 21 3 2 2 Customization via user 11 111 21 3 3 Basic A 23 3 3 1 User 23 3 3 2 External variables unice tee rer eet ee eC V teen one ER EE d WE a Pa a ea a ETC Y 23 3 3 3 Function names ue cet HEEL re Leo POETE 23 9 34 Active EE REESE ERRARE REN ERES 23 3 3 5 Piles 24 3 3 6 Include file SouUfrce flle erts Got dete Let ENDS OS ftev iet EP Gente 24 3 4 Module Definition DEF nennen nnne nnne nnn nennen nnn nnns 25 3 4 1 EXPORTS declaratiOr 3 arret rar a rc rr oaa ea cu pei ra a rd 25 CHAPTER 4 FUNCTION REFERENCE 0 ooo ee ee nuin AR RR RR AR RR RR RR KE RR ERR RR RAN RR nannan a A 26 4 1 Customization via Parts 26 4 2 Customization via User Window eeeeeeeeeeeeee eene sra 48 CHAPTER 5 OPERATIONS DURING CPU RESET
2. 91 3 Definition UOadda00 def 99 4 Make file 00 100 APPENDIX A ERROR MESSAGES eene dies devedenadelotdecatensescscucudeeedsestvestuccdecenetas 104 Ertor Processing recette de mre a ou re ce Ike ia orar Redi TERRE PATER RR DTE 104 A 2 Error and Warning Messages nene eee KKK KKK inne nnne 104 A 2 1 Error MessageS eee ae c epi i ee T Ep ee i a eel 105 A2 2 WarningiMessages e belio tq ie Redes ic 107 10 User s Manual U14873EJ2VOUM LIST OF FIGURES Figure No Title Page 1 1 Configuration Diagram of V850 14 2 1 SM850 Simulator Parts WindOW ccccccccceeeeceeeeeeeeeeeeeeaeeeeeeaeeeeseaeeeeeecaeeeesecaeeeeecneeeeseseeeeeteseeeeeees 16 2 2 Open Dialog BOX fo he es o agi ab Ged ae eau a e de 17 3 1 Programming Configuration and Processing Flow for Customization via Parts Window 18 3 2 Programming Configuration and Processing Flow for Customization via User Window 20 3 3 Creation coved ceeds 22 4 1 Push Buttons In tec tie i
3. wsprintf UParts Rect str wRect right wRect left wRect bottom wRect top break case WM DESTROY UpCloseUserWnd hWnd default return DefWindowProc hWnd iMessage wParam lParam return OL BORK RR k k RR RK k k KR k k KR KK KR k k k k k k k KR RR RRR RR k k RR RRR k k k k k ke ke ke ke x UParts adda00Call ULONG BORK K K k KR KR k k RK KK k k RRR RR RK RRR RR RR RR k k k k k ke ke ke ke KKK void UParts adda00Call ULONG time return BORK K K k k k k KK k k KR KR k k KR KR ROK k k k k RR RR RR k k k k k k k k ke ke ke UParts_adda00Reset void BORK k k ke KR k k k k k k KK RR k k k k k k RR k k k k k k RR RR k k k k k k k k e ke ke ke void UParts_adda00Reset void adval 0 0 InvalidateRect hUParts adda00Wnd NULL TRUE daval d wRect left wRect top User s Manual U14873EJ2VOUM 97 CHAPTER 6 PROGRAMMING EXAMPLES 8 8 UOadda00 c BORK KR KK RK k k k k RR KK RR Sk k k k k k k k k k RRR k k k k k k k k k k k k RR k k k k k k k k e ke ke ke ke KK KK UParts adda00LoadProj char S EEK K k KK k k k k k k k k k k k k k k k k k k k k k k RRR k k k k k k k RRR RR RR KKK k k kk k ke ke ke ke ke e x void UParts adda00LoadProj char fname next WORD X y WX GetPrivateProfileString UOadda00 Window Hide UParts Veiw
4. 27 4 2 709916 Ege ert eoe e e Mi o ed 28 4 3 Group Select B ttons 5 ERE RET IM ED IH 30 4 4 Bitmap Images for Inactive LED Left and Active LED 33 4 5 Pictures for Inactive LED Left and Active LED 33 4 6 LED Function Set Per Port estere te ee ore cue ee leet tta ste Hee un tetu 34 4 7 Matrix Le AeA rr Po def 35 4 8 Active LED Left and Inactive LED 36 4 9 Stepping MOITOF teu e be E us 37 4 10 Vertical Scroll Bar Analog 38 6 1 Example of Parts Customized via Parts Window 78 6 2 Example of Parts Customized via User Window 89 User s Manual U14873EJ2VOUM 11 12 LIST OF TABLES Table No Title Page 4 1 Customization Functions Used in Parts Window 2 00 0 11 26 4 2 Customization Functions Used in User Window ssssssssssssssseseneneeeeenneee nennen nnne 48 5 1 Parts Customized via Parts Window During CPU 76 A 1 The Function Names For Which The Error 104 User s Manual U14873EJ2VOUM CHAPTER 1 G
5. Return value Normal end 1 Abnormal end 0 Remarks This function is supported only for devices that include USB function 72 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Function for receiving packets from Function using USB function void UpGetUSBPack total data unsigned char total Number of data arrays unsigned char data Pointer to packet data array Function This function uses the USB function to receive packet data from Function Parameters total Specifies the number of packet data arrays data Specifies a pointer to the packet data array to be transmitted Return value None Remarks This function is supported only for devices that include USB function User s Manual U14873EJ2VOUM 73 CHAPTER 4 FUNCTION REFERENCE Function for transmitting signals from HOST using USB function void UpSetUSBSig sig unsigned char Sig Transmit signal ID Function This function uses the USB function to transmit a signal from the HOST Parameter sig Specifies the transmit signal ID 0 USBreset 1 Resume Return value None Remarks This function is supported only for devices that include USB function 74 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Function for receiving signals from Function using USB function void UpGetUSBSig sig unsigned char sig Receive signal ID Function This function uses the USB func
6. WNDCLASS wndclass switch ul reason for 11 case DLL PROCESS ATTACH hModele lpszClassName hInstance lpfnWndProc hCursor hIcon 0 0 UParts adda00Win lpszMenuName style cbClsExtra cbWndExtra hbrBackground define STR UP TITLE User Open I F Panel addaoo char strbuf 2 ANIO BORK RR KK KR k k k k k k k k KK k k KK k k k k k k k RR ke KK KK BRR KR KR KK k k k k k k k k k k k k k k k k e k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k kk kk kk RK KKK BOOL APIENTRY DllMain HANDLE hModele LPSTR cnUParts_adda00 hrinst WNDPROC UParts adda00WndProc NULL NULL NULL HBRUSH COLOR WINDOW 1 CS HREDRAW CS VREDRAW 0 DLGWINDOWEXTRA RegisterClass amp wndclass DWORD ul reason for call LPVOID lpReserved 92 User s Manual U14873EJ2VOUM CHAPTER 6 PROGRAMMING EXAMPLES 3 8 UOadda00 c case DLL THREAD ATTACH break case DLL THREAD DETACH break case DLL PROCESS DETACH break return TRUE else BOOL LibMain HANDLE hInstance WORD wDataSeg WORD cbHeapSize LPSTR lpszCmdLine WNDCLASS wndclass if cbHeapSize gt 0 UnlockData 0 UnlockSegment wDataSeg wndclass lpszClassName LPSTR cnUParts adda00 wndclass hInstance hInstance wndclass lpfnWndProc WNDPROC UParts adda00WndProc wndclass hCursor NULL wndcl
7. upsw00 Win32 Debug OUTDIR Debug INTDIR Debug Begin Custom Macros OutDir Debug End Custom Macros ALL OUTDIR upsw00 d11 CLEAN erase INTDIR Upsw00 obj erase S INTDIR vc60 idb erase INTDIR vc60 pdb erase S OUTDIR upsw00 d11 erase S OUTDIR erase OUTDIR upsw00 ilk erase S OUTDIR upsw00 1ib erase OUTDIR upsw00 pdb upsw00 exp 86 User s Manual U14873EJ2VOUM CHAPTER 6 PROGRAMMING EXAMPLES 4 5 UPsw00 mak S OUTDIR if not exist OUTDIR S NULL mkdir OUTDIR CPP cl exe CPP PROJ nologo Gd Zp1 W3 Gm GX Zi Od D WIN32 D DEBUG D WINDOWS D MBCS D USRDLL D UPSW00 EXPORTS Fp INTDIR Nupsw00 pch DIR Fd INTDIR FD c c INTDIR obj S CPP lt lt PROJ lt cpp INTDIR obj S CPP lt lt CPP_PROJ S lt cxx INTDIR obj S CPP lt lt CPP_PROJ S lt c INTDIR sbr S CPP lt lt PROJ lt lt lt cpp INTDIR sbr lt lt 5 S lt cxx INTDIR sbr S CPP lt lt CPP_PROJ S lt MTL midl exe MTL PROJ nologo D RSC rc exe BSC32 bscmake exe BSC32_FLAGS nologo BSC32 SBRS DEBUG mktyplib203 win32 o S OUTDIR upsw00 bsc YX Fo S INT User s Manual U14873EJ2VOUM 87 CHAPTER 6 PROGRAMMING EX
8. P60 P61 P62 P63 P64 P65 P66 P67 Sample Program 0 0 0 0 0 0 0 0 UCHAR USHORT ULONG UPsw00 c LE LE LE LE LE LE LE LE UU E E UE U 1 U F o Specify 0 for 16 bit version BOOL LibMain HANDLE WORD WORD LPSTR int int void UParts sw00 void 80 User s Manual U14873EJ2VOUM CHAPTER 6 PROGRAMMING EXAMPLES 2 3 UPsw00 c BORK RR KR k k RK RR RR k k RR k k KR RK RRR RR RR RRR RR RR RK k k k k k k k k ke ke KKK DLL Main S EEK ke RR RR k k RR KR RK k k RR RR k k KR RR RR KK k k RR ke ke ke ke ke KK ifdef WIN32 BOOL APIENTRY DllMain HANDLE hModele DWORD ul reason for call LPVOID lpReserved return TRUE else BOOL LibMain HANDLE hInstance WORD wDataSeg WORD cbHeapSize LPSTR lpszCmdLine if cbHeapSize gt 0 UnlockData 0 return TRUE ifndef WIN32 S EEK K KR k k RK RR k k RR Sk Sk ke KK RR k k k k k k KR RK k k k k k RR RR RK RRR k k k k ke ke ke ke kx WEP S EEK RR ke KR RR KR k k KR RR k k k k k k RRR RR RRR RRR ke ke k ke ke ke k int WEP int nParameter switch nParameter case SYSTEM EXIT break case WEP_FREE DLL break return 1 User s Manual U14873EJ2VOUM 81 CHAPTER 6 PROGRAMMING EXAMPLES
9. b Customization via user window Always use UO as the first two characters of the user created DLL file name Example UOusr dll UParts usr 5 Use void type with no parameters for user functions 6 Enter an EXPORTS declaration in the module definition file for user functions Note See 3 4 1 EXPORTS declaration 3 3 2 External variables When using external variables always add UP to the start Example int UPglobal 3 3 3 Function names Function names are the names that are given to user created external parts If you do not wish to use a function name as the part name enter a NULL string as the parameter of the function used to create the part 3 3 4 Active high low The active high low designation specifies the relation between a pin s value and its active state when a part connected to a pin is operating If the function used to create a part includes a parameter for specifying active high low specify one of the following macros the macros HIGH and LOW are defined in uparts32 h Operation using 1 high HIGH Operation using 0 low LOW User s Manual U14873EJ2VOUM 23 CHAPTER 3 PROGRAMMING 3 3 5 Pin names Some of the parameters in functions used to create parts are for specifying pin names or port names In such cases each pin name or port name is specified as a character string and its name should be as described in the target device s User s Manual Specifications are not case sensitiv
10. HIGH is described and the pin P31 is reported as active high the description shown below sets the active high input to be held for 50 pulses of the main system clock char val 1 UpSetPin p31 val 501 66 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Data setting function for ports void UpSetPort portname data time char portname Port name unsigned char data Data unsigned long time Hold time Function This function sets the data for one port Parameters portname Specifies the port name as a character string data Specifies values set to the port time Sets a time for holding data The time measurement unit is the main system clock Return value None Remarks When using this function call the port active value notification function UplnitPort from within a user function so that pin names are reported in advance If the active value of the port s pins that is reported by UplnitPort was Set as active high 1 is set bitwise and if it was set as active low O is set bitwise If pins belonging to this port are set to active mode by this UpSetPort function the data s bit values for the corresponding pins should be the same as the bit values corresponding to the pins whose active values were set by UpSetPort If 0 is set as the hold time the active value is held Example If UplnitPort p4 0x03 is described and the port P4 s pins P40 an
11. if not exist OUTDIR S NULL mkdir OUTDIR CPP cl exe CPP PROJ nologo Zp1 MT W3 GX O2 D WIN32 D NDEBUG D WINDOWS D MBCS D USRDLL D UPSW00 EXPORTS Fp INTDIR upsw00 pch YX Fo S INTDIR Fd INTDIR FD c c S INTDIR obj S CPP lt lt CPP PROJ 5 INTDIR obj S CPP lt lt CPP PROJ cxx INTDIR obj S CPP lt lt CPP_PROJ lt c INTDIR sbr S CPP lt lt CPP_PROJ lt cpp INTDIR sbr S CPP lt lt CPP PROJ cxx INTDIR sbr S CPP lt lt CPP PROJ User s Manual U14873EJ2VOUM 85 CHAPTER 6 PROGRAMMING EXAMPLES 3 5 UPsw00 mak MTL midl exe MTL PROJ nologo D NDEBUG mktyplib203 win32 RSC rc exe BSC32 bscmake exe BSC32 FLAGS nologo o OUTDIR upsw00 bsc BSC32 SBRS LINK32 link exe LINK32 FLAGS kernel32 lib user32 lib gdi32 lib winspool lib comdlg32 lib advapi32 lib shell32 1ib ole32 lib oleaut32 lib uuid lib odbc32 1ib odbccp32 lib nologo dll in cremental no pdb OUTDIR Nupsw00 pdb machine I386 def Upsw00 def out OU TDIR Nupsw00 dll 11 OUTDIR upsw00 1lib DEF FILE NUpsw00 def LINK32 OBJS 5 INTDIR Upsw00 obj X NS8185032 1lib OUTDIR Nupsw00 dll OUTDIR DEF FILE LINK32 OBJS LINK32 lt lt LINK32 FLAGS LINK32 OBJS lt lt IELSEIF CFG
12. Oxfc Number 1 Figure 4 6 LED Function Set Per Port P30 P31 P32 P33 P34 P35 P36 7 umber Left pin name is not shown 34 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Matrix LED function void UpMtxLed pnames1 pnames2 1 pnum2 actype1 actype2 char 51 Output 1 pin names char bnames2 Output 2 pin names int 1 Output 1 pin number int 2 Output 2 number int actype7 Active high low for output 1 int actype2 Active high low for output 2 Function This function creates an LED on a matrix When any intersection is active on the matrix of the output 1 and output 2 pins a matrix LED showing the active bitmap is created the active bitmap is fixed and cannot be specified Parameters pnames1 Specifies the output 1 pin names character strings for all output 1 pins only pnames2 Specifies the output 2 pin names character strings for all output 2 pins only pnum1 Specifies the number of output 1 pins pnum2 Specifies the number of output 2 pins actype1 Specifies the value for displaying output 1 Specify 1 for active high status or 0 for active low status The active status for output 1 is the same for all output 1 pins actype2 Specifies the value for displaying output 2 Specify HIGH for active high status or LOW for active low status The active status for output 2 is the same for all o
13. Pin name Function This function zero clears the active time of the specified motor connected pin Parameter pname Specifies the motor connected pin name as a character string Return value None Remarks When using this function call the motor pin notification function UplnitMtrPin from within a user function so that the pin name is reported in advance Example UpClrMtrAcClk p41 64 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Stepping motor information capture function int char int unsigned long unsigned long unsigned long Function UpGetStpingMtr pnames num posrev negrev angle onames Pin names num Number of pins per channel specify 4 or 8 posrev Area for storing the number of positive revolutions negrev Area for storing the number of negative revolutions angle Area for storing angle This function captures the number of positive negative revolutions and current angle of the stepping motor that is connected to the pin names previously reported by the stepping motor notification function UplnitStpingMtr Parameters pnames num posrev negrev angle Return value Specifies pin names character strings for all pins Specifies the number of pins per channel 4 or 8 Specifies the area where the number of positive revolutions is stored Specifies the area where the number of negative revolutions is stored
14. Specifies the area where the angle is stored If successfully captured 1 If not successfully captured 0 Example char mtrpin 4 p00 p01 p02 p03 unsigned long posrev unsigned long negrev unsigned long angle UplnitStpingMtr char mtrpin 4 HIGH 1 10 UpGetStpingMtr char mtrpin 4 amp posrev amp negrev amp angle User s Manual U14873EJ2VOUM 65 CHAPTER 4 FUNCTION REFERENCE Value setting function for pins void UpSetPin pname val time char pname Pin name char val Active value unsigned long time Hold time Function This function sets a pin value Parameters pname Specifies the pin name as a character string val Sets value when pin is active time Sets a time for holding data The time measurement unit is the main system clock Return value None Remarks When using this function call the pin active value notification function UplnitPin from within a user function so that the pin name is reported in advance If the pin active value that is reported by UplnitPin was set as macro HIGH setting 1 as the active value for this UpSetPin function sets the pin to active mode Similarly if the pin active value that is reported by UplnitPin was set as macro LOW setting O as the active value for this UpSetPin function sets the pin to active mode If 0 is set as the hold time the active value is held Example If UplnitPin p31
15. The bitmap file should be stored in the same directory as the simulator or its name should be specified with the full path Parameters actbmp Specifies a character string for the bitmap file name displayed when active nactbmp Specifies a character string for the bitmap file name displayed when inactive Return value None Remarks If a button function is described without describing this function first the standard button s bitmap is displayed see the image shown in Figure 4 1 The button name is not shown when setting this function Example UpSetBtmBmp on bmp off bmp UpPushBtm p21 LOW START 40 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Bitmap setup function for LED void UpSetLedBmp actbmp nactbmp char actbmp Active bitmap name character string char nactbmp Inactive bitmap name character string Function This function sets the bitmap for LED An LED display be changed by entering this function immediately before the target LED s function This function is valid only if the bitmap has been specified by an LED function The same bitmap will be displayed until it is set again by this function The bitmap file should be stored in the same directory as the simulator or its name should be specified with the full path Parameters actbmp Specifies a character string for the bitmap file name displayed when active nactbmp Specifies a character string f
16. data Specifies data Return value If value is set correctly 1 If value is not set correctly 0 Example int ret ret UpSetMem Oxffe300 0x72 User s Manual U14873EJ2VOUM 69 CHAPTER 4 FUNCTION REFERENCE Active time notification function for motor int UpGetMtrAcClk pname val actime char pname Pin name char val Value unsigned long actime Active time Function This function captures the active time of the pin specified for a motor This function is valid only for pins connected to a motor part that has already been created using the motor pin notification function UplnitMtrPin The active time is the total time that has elapsed since the start of a simulation When a reset occurs or when the elapsed time value exceeds a 10 digit decimal value the active time is cleared to zero The active time is measured in pulses of the main system clock Parameters pname Specifies the motor connected pin name as a character string val Sets the value of the pin actime Uses a two dimensional array to represent the active time as the total time that has elapsed since the start of a simulation actime 1 x0x100000000 actime 0 Example actime 1 0x390 actime 0 0x10052688 Total time 0x39010052688 main system clock Return value If set pin was a pin set by DC motor function 0 If set pin was not a pin set by DC motor function 1 Remarks When using this fu
17. hWnd IDD PIN BUTTON i hInst NULL return FALSE User s Manual U14873EJ2VOUM 95 CHAPTER 6 PROGRAMMING EXAMPLES 6 8 UOadda00 c case WM COMMAND switch wParam case IDD PIN BUTTON if adval lt 245 adval 10 else adval 0 UpSetAD ANIO adval InvalidateRect hWnd NULL TRUE UpdateWindow hWnd break case IDD PIN BUTTON 1 UpGetDA ANOO amp daval InvalidateRect hWnd NULL TRUE Updat eWindow hWnd break return FALSE case WM PAINT hDC BeginPaint hWnd amp ps wsprintf strval AD Value u 0 adval TextOut hDC BTN WIDTH 40 15 strval lstrlen strval wsprintf strval DA Value u 0 daval TextOut hDC BTN WIDTH 40 45 strval lstrlen strval EndPaint hWnd amp ps return FALSE case WM SYSCOLORCHANGE InvalidateRect hWnd NULL TRUE break case WM MOVE GetWindowRect hWnd amp wRect wx wRect right wRect left wy wRect bottom wRect top if wx 36 amp amp wy 36 wsprintf UParts Rect str d oo d wRect top wx wy InvalidateRect hWnd NULL TRUE break wRect left 96 User s Manual U14873EJ2VOUM CHAPTER 6 PROGRAMMING EXAMPLES 7 8 UOadda00 c case WM SIZE if wParam SIZEICONIC lstrcpy UParts Veiw str Icon else GetWindowRect hWnd amp wRect lstrcpy UParts Veiw str Normal
18. 98 Windows NT 4 0 Window 2000 Windows Me Windows XP User s Manual U14873EJ2VOUM 15 CHAPTER 2 DOWNLOAD This chapter describes the steps for downloading to the simulator user customized parts that have been created as described in Chapters 3 and 4 Before user customized external parts DLL files can be actually used they must be loaded into the simulator To remove loaded user customized external parts DLL files unload them from the simulator Use the Parts window to load and unload user customized external parts DLL files Figure 2 1 SM850 Simulator Parts Window Parts Window File Mode Edit Parts Bitmap Oras Option Help Alle Unload 16 User s Manual U14873EJ2VOUM CHAPTER 2 DOWNLOAD 21 Download Operation steps 1 In the Parts window select Customize Load from the menu bar to open the Open dialog box Figure 2 2 Open Dialog Box File of type DLL Cancel 2 In the Open dialog box select a customized external part DLL file then click the lt gt button The specified DLL file is then loaded into the simulator Once this has been done the part created by the customization function in the Parts window is pasted in the Parts window If the part was customized via a user window it is displayed in a user window a Up to six user customized external part DLLs can be loaded into the simulator b A user customized e
19. LOW L 0 UpLed p22 HIGH H 0 Figure 4 5 Pictures for Inactive LED Left and Active LED Right L H C User s Manual U14873EJ2VOUM 33 CHAPTER 4 FUNCTION REFERENCE LED function set per port void UpPortLed portname actype ledname pictype char portname Port name unsigned char Active high low char ledname Function name char pictype Picture type Function This function creates a set of LEDs corresponding to pins assigned to a particular port eight LEDs make one set An active bitmap or color picture is displayed for each pin that is active and an inactive bitmap or colorless picture is displayed for each pin that is inactive Parameters portname Specifies the port name as a character string actype Specifies the value for displaying an active bitmap Specify 1 if a value of 1 high is active or specify 0 if a value of 0 low is active The 8 bit data that sets the status of eight LEDs is specified bitwise The port s lowest pin is specified as the LSB then the other seven bits are specified in order from LSB to MSB ledname Specifies a name to be assigned to an LED This function name is shown below the bitmap There is no limit on the number of characters pictype Specifies the picture type used in the LED display 1 specifies bitmap and 0 specifies a rectangular picture Return value None Example UpPortL ed p3
20. SW SHOW UpCallFuncName char UParts adda00Call UpResetFuncName char UParts adda00Reset UpLoadProjName char UParts adda00LoadProj UpSaveProjName char UParts adda00SaveProj Class name Title Style bits X default y default cx default cy default No parent Class memu Creator Params 94 User s Manual U14873EJ2VOUM CHAPTER 6 PROGRAMMING EXAMPLES 5 8 UOadda00 c HDC RECT int char long Helse WORD Hendif Helse Hendif BORK K K k KR RR KR KR k k k KR k k k KK RR RRR KK RK KR RR RR k k k k k k de ke k k RK RRR k k RK UParts adda00WndProc HWND unsigned WORD LONG BORK RRR k k RRR k k k k k k k k k KR KK KK RR KR KR KK k k ROKR k k k k k k RR k k k k k k RR k k k k k k RR eee k f LONG UParts adda00WndProc HWND hWnd unsigned iMessage WORD wParam LONG lParam hDC PAINTSTRUCT ps wRect d strval 20 Hifdef WIN32 WX Wy WX Wy switch iMessage case WM CREATE for i 0 i lt 2 i Hifdef WIN32 btm_hwnd i CreateWindow LPSTR button strbuf i WS CHILD BS PUSHBUTTON WS VISIBLE WS TABSTOP 10 10 30 i WIDTH BTN HIGHT hWnd HMENU IDD PIN BUTTON i hInst NULL btm_hwnd i CreateWindow LPSTR button strbuf WS CHILD BS PUSHBUTTON WS VISIBLE WS TABSTOP 10 10 30 i WIDTH HIGHT
21. The selected bit map file is invalid A bitmap file specified in the bitmap entry dialog box is incorrect Set a bitmap format file Bitmap setup functions The selected pin name is already set An attempt was made to re set a pin that had already been set in the buttons dialog box Do not set a pin that has been already set Button functions Allocation error Memory could not be secured Close other applications and secure memory All functions The active H L is not HIGH or LOW The described active H L is a value other than HIGH or LOW Describe HIGH or LOW in the active H L All functions that include an active high low parameter The chanel number is not 4 or 8 The described number of the channels is a value other than 4 or 8 Describe 4 or 8 for the number of the channels according to the number of the pins Stepping motor functions that include a minimum step angle parameter User s Manual U14873EJ2VOUM 105 APPENDIX A ERROR MESSAGES 106 E10202 Cause User Action Function E10203 Cause User Action Function E10204 Cause User Action Function E10205 Cause User Action Function E10206 Cause User Action Function E10207 Cause User Action Function E10208 Cause User Action Function E10209 Cause User Action Function E1020a Cause User Action Function E1020b Cause User Action Function The phase is not 0 or 1 The described excitation value is a value oth
22. a user created DLL file When compiling specify the option Zp1 for single byte alignment of structure members Specify UP as the first two characters in the name of the created DLL file To operate the DLL file in an environment in which Microsoft Visual is not installed create the DLL file using the released version Enter the user created DLL file name in the place for specifying the simulator s external parts customization files See 2 1 Download In addition to the standard parts that are already displayed in the Parts window the user created customized parts are displayed Set the Parts window to location mode and locate the parts Select Save As from File menu of the Parts window and save the current status so that there will not be any need to load the user created DLL files when performing the next simulation Customization via user window Program the external parts to be customized when creating a DLL file using Windows programming methods Be sure to include the file uparts32 h in this programming and add uparts32 cpp to the project Use Windows programming methods to create a module definition DEF fileNete a make file and if necessary a resource file then compile to create a user created DLL file When compiling specify the option Zp1 for single byte alignment of structure members Specify UO as the first two characters in the name of the created DLL file To operate the DLL fi
23. a user window can be used to enable processing of windows and input from user parts and the simulation call function can be used to perform output display processing to user parts 1 2 2 User created files User customized parts are implemented by user created programs based on the specifications described in this manual These user created programs end up as DLL files The DLL files for user customized parts are loaded into the external parts GUI block before simulation processing is executed User s Manual U14873EJ2VOUM 13 CHAPTER 1 GENERAL 1 2 3 Positioning of user customized parts Figure 1 1 Configuration Diagram of V850 Simulator Input from user Debugger block Simulator block External parts GUI block User customized external parts block DLL file External parts External parts user gt block open interface block A Instruction simulation block peripheral simulation block peripheral GUI block Y Debugger block Any directive from the user that causes any function to be executed by the simulator is called a command The debugger block provides an environment in which the user can enter such commands via the keyboard or the mouse Peripheral GUI block This block provides a setup environment that enables the user to easily set the desired input information to a port via a window DLL DLL stands for Dynamic Link L
24. after creating a window Parameter hUwnd Handle of a user created window Return value None Example HWND hwnd hwnd CreateWindow UpSetUserWnd hwnd User s Manual U14873EJ2VOUM 49 CHAPTER 4 FUNCTION REFERENCE Window close function void UpCloseUserWnd hwnd HWND hwnd Handle of window to be closed Function This function notifies the simulator that a user created window is being closed This function is described with the user created window callback function s message WM DESTROY Parameter hwnd Handle of user created window to be closed Return value None Example WM DESTROY UpCloseUserWnd hwndQ 50 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Simulation call function void UpCallFuncName fname char fname Simulation call function name Function This function reports the name of the function that is called from the simulator at a specified intervalN during simulation This function must be described within the user function UParts xxx Note This function is called once per command execution Parameter fname Specifies the name of the function called from the simulator Return value None Remarks The simulation call function should be specified as follows in the function specifications The simulation s execution time is received via an unsigned long type parameter The simulation s execution time is time
25. ccccccccccssssssseeeeeeseceenseeeeeseeeseanseseeesenenansess 76 5 1 Parts Customized via Parts 2 041221 nna 76 5 2 Parts Customized via User 76 CHAPTER 6 PROGRAMMING 5 uasa a KARA SAE KEANE RK aa dA 77 6 1 Example of Parts Customized via Parts Window 78 User s Manual U14873EJ2VOUM 9 6 1 1 Description of SAMPIGS iicet trei ette toe d i 78 6 1 2 Source examples ater e Ear e eed de ee ede op pne Dus 79 1 Target program program for 852 79 lt 2 gt Custom part source 00 80 lt 3 gt Definition UPswOO def eoe cete X dle ee nine 83 lt 4 gt Make file UPswOO mak eie ed eee Dead Re Geen ies 84 6 2 Example of Parts Customized via User nnmnnn 89 6 2 1 Description Of 5 de Dui Pena 89 6 222 Source exa mlples 2 nu eee HI e mE RE 90 1 Target program program for 853 90 2 Custom part source file 00
26. described within the user function UParts xxx Parameter funcname Specifies the name of the function that saves the project file that has been called from the simulator Return value None Remarks The project file save function s specifications are as follows The project file name character string is received via the char type parameter User window information is also written to the file named by the project file name that was received via the parameter At that time select the WritePrivateProfileString function for the library used with the write operation The section name used by the user is User DLL Window An EXPORTS declaration is required in a module definition file for the project file save function void UpSave usrproj char filename Example UpSaveProjName UpSave_usrproj 58 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Reset function name notification function int UpResetFuncName funcname char funcname Reset function name Function When a CPU reset is called by the simulator this function reports the function name that is used for the user window s reset processing This function must be described within the user function UParts_xxx Parameter funcname Specifies the name of the reset function called by the simulator Return value None Remarks The reset function s specifications are as follows e It is a void type function since it
27. has no parameters An EXPORTS declaration is required in a module definition file for the reset function void Upreset usrwin void Example UpResetFunName Upreset usrwin User s Manual U14873EJ2VOUM 59 CHAPTER 4 FUNCTION REFERENCE Pin value capture function int UpGetPin pname val char oname Pin name char val Pointer to area where pin value is stored Function This function captures the value for one pin Parameters pname Specifies the pin name as a character string val Specifies a pointer to the area where the pin value is stored Return value If pin value was successfully captured 1 If pin value was not successfully captured 9 0 Note O is also returned if the pin value is undefined Example char val int ret ret UpGetPin p46 amp val 60 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Port data capture function int UpGetPort portname data char portname Port name unsigned char data Pointer to area where port data is stored Function This function captures port data Parameters portname Specifies the port name as a character string data Specifies a pointer to the area where the port data is stored Return value If port data was successfully captured 1 If port data was not successfully captured 0 Note 0 is also returned if the port values include any undefined values Example unsigned ch
28. reported by the reset function name notification function UpResetFuncName the user window s reset processing function is performed 76 User s Manual U14873EJ2VOUM CHAPTER 6 PROGRAMMING EXAMPLES This chapter presents some examples of customized parts Among the sources cited below lt 1 gt refers to the target program Programs are compiled and linked using the CA850 to create load module files xxxx OUT lt 2 gt and subsequent sources refer to files that are required when creating customized parts This manual specifies that Visual C is used to create dynamic link library xxxx DLL When compiling be sure to specify the Zp1 option Zp1 option sets single byte alignment of structure members Remark The source program examples for customized parts are coded using ifdef statements and other elements that make it easier to switch from creating 16 bit dynamic link libraries to creating 32 bit dynamic link libraries If using SM850 V2 00 or a later version be sure to create 32 bit dynamic link libraries User s Manual U14873EJ2VOUM 77 CHAPTER 6 PROGRAMMING EXAMPLES 6 4 Example of Parts Customized via Parts Window 6 1 1 Description of samples The items displayed in the Parts window include eight LEDs and eight switches of which two P50 and P51 are push buttons two P52 and P53 are toggle buttons and four P54 P55 P56 and P57 are select buttons When a Switch is set ON or OFF its corresponding LED is als
29. s project file is being read this function reports the name of the function that simultaneously reads the information in the user window from the project file This function must be described within the user function UParts_xxx Parameter funcname Specifies the name of the function that reads the project file that has been called from the simulator Return value None Remarks The project file read function s specifications are as follows The project file name character string is received via the char type parameter User window information is also read from the file named by the project file name that was received via the parameter At that time select either the GetPrivateProfileString or GetPrivateProfilelnt function for the library used with the read operation The section name used by the user is User DLL Window An EXPORTS declaration is required in a module definition file for the project file read function void UpLoad usrproj char filename Example UpLoadProjName UpLoad usrproj User s Manual U14873EJ2VOUM 57 CHAPTER 4 FUNCTION REFERENCE Project file save function name notification function int UpSaveProjName funcname char funcname Project file save function name Function When the simulator s project file is being saved this function reports the name of the function that simultaneously saves the information in the user window to the project file This function must be
30. si85032 1lib S OUTDIR Nuoadda00 dll OUTDIR DEF FILE LINK32_OBJS 5 LINK32 lt lt LINK32 FLAGS LINK32 OBJS lt lt ENDIF c INTDIR obj lt lt PROJ lt lt lt 102 User s Manual U14873EJ2VOUM CHAPTER 6 PROGRAMMING EXAMPLES 4 4 UOadda00 mak cpp INTDIR obj S CPP lt lt PROJ lt cxx INTDIR obj S CPP lt lt CPP_PROJ lt c INTDIR sbr S CPP lt lt CPP_PROJ lt cpp INTDIR sbr S CPP lt lt CPP_PROJ lt cxx INTDIR sbr lt lt PROJ lt 1 5 EXTERNAL DEPS 1 IF EXISTS uoadda00 dep INCLUDE uoadda00 dep ELSE IMESSAGE Warning cannot find uoadda00 dep ENDIF ENDIF LIF CFG uoadda00 Win32 Release CFG SOURCE NUoadda00 c uoadda00 Win32 Debug S INTDIR NUoadda00 0bj SOURCE S INTDIR ENDIF User s Manual U14873EJ2VOUM 103 APPENDIX A ERROR MESSAGES A 1 Error Processing a If the specified pin name is not among the products that can be simulated the Error Message dialog box appears to report an error message b If the read DLL file is a combination of user panel custom functions and Parts custom functions a dialog box appears with a warning message when the first function to be read does not belong to the DLL file in accordance w
31. stdio h gt include lt stdlib h gt include lt string h gt typedef unsigned char UCHAR typedef unsigned short USHORT typedef unsigned long ULONG ifdef WIN32 include lt Windows h gt 1 include lt Windowsx h gt endif if 1 Specify 0 for 16 bit version include uparts32 h 1 include uparts h define IDM PAST Ox1111 define IDM NEWWIN 0 1112 define BTN WIDTH 70 define BTN HIGHT 25 define IDD PIN BUTTON 0x10 ifdef WIN32 BOOL APIENTRY DllMain HANDLE DWORD LPVOID else BOOL LibMain HANDLE WORD WORD LPSTR int int endif void UParts_adda00 void LONG UParts adda00WndProc HWND unsigned WORD LONG void UParts adda00Call ULONG void UParts adda00Reset void void UParts adda00LoadProj char void UParts adda00SaveProj char User s Manual U14873EJ2VOUM 91 CHAPTER 6 PROGRAMMING EXAMPLES 2 8 UOadda00 c Window point Title Strings HANDLE hInst HWND btm hwnd 2 USHORT adval 0 USHORT daval 0 ifdef WIN32 DLL Main hInst wndclass wndclass wndclass wndclass break Window Class Name wndclass wndclass wndclass wndclass wndclass wndclass define UParts adda00WIDTH 30 define UParts adda00HEIGHT 10 const BYTE cnUParts adda00 HWND hUParts adda00Wnd char UParts Veiw str 7 char UParts Rect str 23
32. str 7 fname if lstrcmp UParts Veiw str Icon mode ShowWindow hUParts adda00Wnd SW SHOWMINNOACTIVE else Normal mode Get PrivateProfileString UOadda00 Geometry 0 0 0 0 UParts Rect str 23 fname if lstremp UParts Rect str 0 0 0 0 next strtok UParts str x WORD strtoul next NULL 10 next strtok NULL y WORD strtoul next NULL 10 next strtok NULL wx WORD strtoul next NULL 10 next strtok NULL wy WORD strtoul next NULL 10 MoveWindow hUParts adda00Wnd x y wx wy TRUE ShowWindow hUParts adda00Wnd SW SHOWNORMAL BRR KR RK kkk k k k k k k k k k k k k k k k k k k k k k k RRR k k k k k k k k KR RR RR k k RR k kkk k ke ke ke ke ke e x UParts adda00SaveProj char BRR RR KK k k k k k k k k k k k k k k k k k k KR k k k k k k k k k k k k k k k k k k k KR void UParts adda00SaveProj char fname WritePrivateProfileString UOadda00 Window UParts Veiw str fname WritePrivateProfileString UOadda00 Geometry UParts Rect str fname UOadda00 c 98 User s Manual U14873EJ2VOUM CHAPTER 6 PROGRAMMING EXAMPLES 3 Definition UOadda00 def 1 1 UOadda00 def LIBRARY EXETYPE DESCRIPTION STUB CODE DATA HEAPSIZE EXPORTS IMPORTS UOADDAOO WINDOWS 3 1 User Open I F Pa
33. 0 0x0 gt Number of positive revolutions 0x0 0x0 0x0 0x0 lt Number of negative revolutions 0 0 0 O lt Rotation angle mark yellow motor means negative rotation Green motor means stopped P mark and red motor means positive rotation User s Manual U14873EJ2VOUM 37 CHAPTER 4 FUNCTION REFERENCE Vertical scroll bar analog input function void UpScalelnterAD pname adname char pname Pin name char adname Function name Function This function creates an analog input part for a vertical scroll bar Move the scroll button and right click the mouse over the scroll bar to enable input of analog data Input values are used to create a part that is shown in red Parameters pname Specifies the name of analog input pin as a character string adname Specifies the function name of the scroll bar type input part This function name is displayed above the scroll bar type input part and there is no limit on the number of characters Return value None Remarks The scroll bar s operating range is determined either by settings made via the reference voltage value setup function UpSetAVref or by the reference voltage value settings made via the Standard Level Gauge Pin Setting dialog box If neither of these settings have been made the default value of 5 0 V is used Note See CHAPTER 7 WINDOW REFERENCE in the SM850 V2 50 System Simulator Operation U16218E Example U
34. 3 3 00 k k k k k k k k k k k k k k k k k k k k k k k k k RR k k KR k k k k k k ke ke ke ke KK KK UParts sw00 void BRK RK RR KK k k k k k k k k k k k k k ke k e ke RR k k KR k k k k k k k k k k k k k k k k RR RR k k KR ke k kk k e ke ke ke ke KK KK void UParts_sw00 void static char pin 4 pb4 MPSS P56 pb static char name 4 S Bit4 S Bit5 S Bit6 S Bit7 UpSet PBtmtime 3 0 UpLed P60 HIGH BitO 1 UpLed P61 HIGH Biti 1 UpLed P62 HIGH Bit2 1 UpLed P63 HIGH Bit3 1 UpLed P64 HIGH Bit4 1 UpLed P65 HIGH Bit5 1 UpLed P66 HIGH Bit6 1 UpLed P67 HIGH Bit7 1 UpPushBtm P50 HIGH P BitO UpPushBtm P51 HIGH P Bitl UpTglBtm P52 HIGH T Bit2 UpTglBtm P53 HIGH T Bit3 UpSelectBtm Select pin 4 HIGH name UPsw00 c 82 User s Manual U14873EJ2VOUM CHAPTER 6 PROGRAMMING EXAMPLES 3 Definition file UPsw00 def 1 1 UPsw00 def LIBRARY EXETYPE UPSWOO WINDOWS 3 1 DESCRIPTION User Open I F Panel sw00 STUB CODE DATA HEAPSIZE EXPORTS WEP WINSTUB EXE PRELOAD MOVEABLE DISCARDABLE PRELOAD SINGLE 3072 Q1 UParts sw00 Q2 IMPORTS 50850 50850 50850 50850 50850 UpSetPBtmtime UpLed UpPushBtm UpTglBtm UpSelectBtm U
35. 32 FLAGS 5 2 OBJS lt lt ELSEIF S CFG uoadda00 Win32 Debug OUTDIR Debug INTDIR Debug Begin Custom Macros OutDir Debug End Custom Macros ALL OUTDIR Nuoadda00 d11 User s Manual U14873EJ2VOUM 101 CHAPTER 6 PROGRAMMING EXAMPLES 3 4 UOadda00 mak CLEAN erase 5 INTDIR Uoadda00 obj erase INTDIR vc60 idb erase 5 INTDIR vc60 pdb erase OUTDIR Nuoadda00 dll erase S OUTDIR uoadda00 exp erase OUTDIR uoadda00 ilk erase OUTDIR Nuoadda00 1lib erase S OUTDIR uoadda00 pdb 5 OUTDIR if not exist OUTDIR S NULL mkdir OUTDIR CPP PROJ nologo 2 1 MTd W3 Gm GX ZI Od D WIN32 D DEBUG D WINDOWS D MBCS D USRDLL D UOADDAO0 EXPORTS Fp INTDIR Nuoadda00 pch YX Fo INT DIR Fd S INTDIR FD GZ c MTL PROJ nologo D DEBUG mktyplib203 win32 BSC32 bscmake exe BSC32 FLAGS nologo o OUTDIR Nuoadda00 bsc BSC32 SBRS LINK32 link exe LINK32 FLAGS kernel32 lib user32 lib gdi32 lib winspool lib comdlg32 lib advapi32 lib shell32 lib ole32 1ib oleaut32 lib uuid lib odbc32 lib odbccp32 lib nologo dll in cremental yes pdb OUTDIR uoadda00 pdb debug 1386 def NUoadda00 def out OUTDIR uoadda00 d11 implib OUTDIR Nuoadda00 lib pdbtype sept DEF FILE NUoadda0O0 de f LINK32 OBJS INTDIR Uoadda00 obj X
36. 4 6 User s Manual U14873EJ2VOUM Target Readers Purpose Organization How to Use This Manual Conventions INTRODUCTION The contents described in this manual use the Windows 98 WindowsMe Windows NT 4 0 Windows2000 WindowsXP 32 bit application program format and this manual is therefore intended for users who experience creating Windows 98 WindowsMe Windows NT 4 0 Windows2000 WindowsXP 32 bit application programs The purpose of this manual is to describe the interface specifications so to enable users to create custom settings for standard external parts that cannot otherwise be used for the SM850 System Simulator The functions programming rules and programming steps that users need to create programs for customized parts are described in this manual This manual is broadly divided into the following sections e General Download e Programming e Function reference Operations during CPU reset e Programming examples e Error messages It is assumed that readers of this manual have general knowledge of microcomputers and the C programming language Readers will need to have a basic knowledge of how to create Windows 98 WindowsMe Windows NT 4 0 Windows2000 WindowsXP 32 bit application programs For information on functions the user can use to create programs for customized parts See CHAPTER 4 FUNCTION REFERENCE For information on the meanings and causes of messages See APP
37. AMPLES 5 5 UPsw00 mak LINK32 link exe LINK32 FLAGS kernel32 1ib user32 lib gdi32 lib winspool lib comdlg32 1ib advapi32 lib shell32 lib ole32 1ib oleaut32 lib uuid lib odbc32 lib odbccp32 lib nologo dll in cremental yes pdb S OUTDIR upsw00 pdb debug machine I386 def Upsw00 def o ut S OUTDIR NupswO0 dll implib OUTDIR Nupsw00 lib pdbtype sept DEF FILE NUpswO0 def LINK32 OBJS 5 INTDIR Upsw00 obj X NS8185032 1lib OUTDIR Nupsw00 dll S OUTDIR DEF FILE LINK32 OBJS S LINK32 lt lt S LINK32 FLAGS 5 2 OBJS lt lt ENDIF IF 5 EXTERNAL DEPS 1 IF EXISTS upsw00 dep INCLUDE upsw00 dep ELSE IMESSAGE Warning cannot find upsw00 dep ENDIF ENDIF LIF CFG upsw00 Win32 Release CFG upsw00 Win32 Debug SOURCE Upsw00 c INTDIR Upsw00 obj SOURCE S INTDIR ENDIF 88 User s Manual U14873EJ2VOUM CHAPTER 6 PROGRAMMING EXAMPLES 6 2 Example of Parts Customized via User Window 6 2 1 Description of samples The items displayed in the user custom window include a part that sets a value to the AD input pin and a part that captures values from the DA output pin Pressing the ANIO button in the user custom window causes the analog value input to analog input pin ANIO to be incremented by 10 When the AD value reaches 250 it is cleared to zero The analog value from ANIO un
38. ENDIX A ERROR MESSAGES Data significance Higher digits on the left and lower digits on the right Note Footnote for item marked with Note in the text Caution Information requiring particular attention Remark Supplementary information Numerical representation Binary XXXX or XXXXB Decimal XXXX Hexadecimal OXXXXX Prefix indicating the power of 2 address space memory capacity Kilo 219 1024 M Mega 2 1024 User s Manual U14873EJ2VOUM 7 Related Documents Refer to the documents listed below when using this manual The related documents indicated in this publication may include preliminary versions However preliminary versions are not marked as such Documents related to development tools User s Manuals 703002 In circuit emulator for V853 v850 SA1 v850 SB1 v8s50 SB2 Va50 sc1 U11595E v850 SC2 v850 sc3 v850 sF1 v850 SV1 IE V850E MC In circuit emulator for V850E IA1 V850E IA2 U14487E IE V850E MC A In circuit emulator for V850E MA1 V850E MA2 IE 703102 MC EM1 IE 703102 MC EM1 A In circuit emulator option board for V850E MS1 V850E MS2 U13876E CA850 Ver 2 50 C Compiler Package SM850 Ver 2 00 or Later System Simulator External Part User Open Interface This manual Specifications RX850 Ver 3 13 or Later Real Time OS U13430E RX850 Pro Ver 3 13 Real Time OS 8 User s Manual U14873EJ2VOUM CONTENTS CHAPTER 1 GENERAL
39. ENERAL 1 1 General Description of External Part User Open Interface Specifications In addition to simulating the operations of the actual target system the SM850 can simulate the operations of a dummy target system Standard external parts are provided with the SM850 for building a dummy target system Setup dialog boxes are also provided for each external part to enable easier implementation of standard external parts In addition parts that cannot be set up using a setup dialog box for standard external parts still can be implemented via user programming as user specified external parts The external part user open interface specifications include the function specifications for the SM850 s interface which the user needs to create programs for customized parts 1 2 General Description of User Custom Parts 1 2 1 Types of customization Parts can be customized by the user s programming in the following two ways 1 Customization via Parts window Parts can be customized using the customization function that facilitates the creation of parts by simply giving the relevant pins and action information as parameters Based on information that is called within a user s function the corresponding part is pasted into the Parts window and all of the related simulation processing is executed 2 Customization via user window Users can customize parts with functions that can be used to create parts and windows The handle notification function for
40. FUNCTION REFERENCE LED picture setup function void UpSetLedPic type color char type Picture type char color Picture fill color when active Function This function sets the type of picture and fill color when active to be used in an LED display An LED display can be changed by entering this function immediately before the target LED s function This function is valid only if a picture has been specified by an LED function The same picture will be displayed until it is set again by this function Parameters type Specifies the type of picture macro is defined in uparts32 h Macro PIC RECT Rectangle Macro PIC Ellipse color Specifies fill color when active macro is defined in uparts32 h Macro PIC RED Red Macro PIC YELLOW Yellow Macro PIC GREEN Green Return value None Example UpSetLedPic PIC PIC GREEN UpLed p32 HIGH Test 0 User s Manual U14873EJ2VOUM 43 CHAPTER 4 FUNCTION REFERENCE Serial pin data input function void UpSerial_data serpname data count first bitnum char serpname Serial pin name character string unsigned short data Pointer to data array unsigned short count Number of data arrays char first First bit MSB or LSB char bitnum Number of bits in transfer data Function This function sets values in order starting from the specified first data bit using the number of bits in the da
41. LL ELSE NULL nul ENDIF CPP cl exe MTL midl exe RSC rc exe 1 uoadda00 Win32 Release OUTDIR Release INTDIR Release Begin Custom Macros OutDir Release End Custom Macros ALL OUTDIR Nuoadda00 d1ll 100 User s Manual U14873EJ2VOUM CHAPTER 6 PROGRAMMING EXAMPLES 2 4 UOadda00 mak CLEAN erase INTDIR Uoadda00 obj erase S INTDIR Nvc60 idb erase OUTDIR Nuoadda00 d11 erase OUTDIR uoadda00 exp erase OUTDIR uoadda00 1lib S OUTDIR if not exist OUTDIR S NULL mkdir OUTDIR CPP PROJ nologo Zpi MT W3 GX O2 D WIN32 D NDEBUG D WINDOWS D MBCS D USRDLL D UOADDAO0 EXPORTS Fp INTDIR Nuoadda00 pch YX Fo INTDIR Fd S INTDIR NN FD c MTL PROJ nologo D NDEBUG mktyplib203 win32 BSC32 bscmake exe BSC32 FLAGS nologo o OUTDIR Nuoadda00 bsc BSC32 SBRS LINK32 link exe LINK32 FLAGS kernel32 1ib user32 lib gdi32 lib winspool lib comdlg32 lib advapi32 lib shell32 lib ole32 lib oleaut32 lib uuid lib odbc32 1ib odbccp32 1lib nologo dll in cremental no pdb OUTDIR Nuoadda00 pdb machine I386 def NUoadda00 def out OUTDIR Nuoadda00 dll implib OUTDIR Nuoadda00 1lib DEF FILE NUoadda00 def f LINK32 OBJS X S INTDIR NUoadda00 0bj X Ng185032 1ib S OUTDIR Nuoadda00 dll OUTDIR DEF FILE LINK32 OBJS S LINK32 lt lt S LINK
42. TER 3 PROGRAMMING 3 4 Programming Configuration and Processing Flow This chapter describes the basic programming used for customization via the Parts window and customization via the user window 3 1 1 Customization via Parts window Configuration The configuration includes user functions that are called only once after the DlIMain function required to create DLL files and the DLL files have been loaded Function references described in Chapter 4 must be included either in user functions or in functions subordinate to user functions Processing flow The simulator s external parts block is used to create parts based on the specified function s part information and performs all simulation related to parts associated with the simulator s external parts block Figure 3 1 shows the relation between user created DLL files and external parts in the simulator as well as the configuration of functions Figure 3 1 Programming Configuration and Processing Flow for Customization via Parts Window User customized file UPusr c include lt Windows h gt External parts block include uparts32 h DllMain Uparts_usr UpPushBtm UpMtxLed Called once after UPusr dll is loaded External parts user open I F block 18 User s Manual U14873EJ2VOUM CHAPTER 3 PROGRAMMING 3 1 2 Customization via user window Configuration The configuration includes the DlIMain function requ
43. TER 4 FUNCTION REFERENCE LED function void char int char char Function UpLed pname actype ledname pictype pname Pin name actype Active high low ledname Function name pictype Picture type This function creates one LED When the specified pin s status is active an active bitmap or color picture is displayed When the pin s status is inactive an inactive bitmap or colorless picture is displayed Parameters pname actype ledname pictype Return value None 32 Specifies the pin name as a character string Specifies the value to be displayed on the LED Specify 1 for active high or 0 for active low Specifies the LED s function name This function name is shown on the LED There is no limit on the number of characters Specifies the type of picture or bitmap image used in the LED display If 1 The default bitmap type is a light bulb type bitmap image However any bitmap specified by the UpSetLedBmp function is displayed instead of the default bitmap If 0 The default picture type is a rectangular picture Any picture specified by the UpSetLedPic function is displayed instead of the default picture User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Example UpLed p40 LOW Reserved 1 UpLed p21 HIGH Power 1 Figure 4 4 Bitmap Images for Inactive LED Left and Active LED Right Reserved Power UpLed p41
44. To our customers Old Company Name in Catalogs and Other Documents On April 1 2010 NEC Electronics Corporation merged with Renesas Technology Corporation and Renesas Electronics Corporation took over all the business of both companies Therefore although the old company name remains in this document it is a valid Renesas Electronics document We appreciate your understanding Renesas Electronics website http www renesas com April 17 2010 Renesas Electronics Corporation Issued by Renesas Electronics Corporation http www renesas com Send any inquiries to http www renesas com inquiry 24 NC S AS 10 11 12 Notice All information included in this document is current as of the date this document is issued Such information however is subject to change without any prior notice Before purchasing or using any Renesas Electronics products listed herein please confirm the latest product information with a Renesas Electronics sales office Also please pay regular and careful attention to additional and different information to be disclosed by Renesas Electronics such as that disclosed through our website Renesas Electronics does not assume any liability for infringement of patents copyrights or other intellectual property rights of third parties by or arising from the use of Renesas Electronics products or technical information described in this document No license express implied or otherwise is gr
45. active mode value for one pin When there is a value to be input for a pin this function must be described within the user function UParts xxx When there is no value to be input for a pin there is no need to describe this function Parameters pname Specifies the pin name as a character string actype Specifies the active value of a pin Specify HIGH for active high status or LOW for active low status Return value If pin s active value was set correctly 1 If pin s active value was not set correctly 0 Example When set to operate when pin P46 is active high when input value 1 int ret ret UplnitPin P46 HIGH 54 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Port active value notification function int UplnitPort portname actype char portname Port name unsigned char actype Active value of port Function This function sets the active mode value for one port When there is a value to be input for a port this function must be described within the user function UParts xxx When there is no value to be input for a port there is no need to describe this function Parameters portname Specifies the port name as a character string actype Specifies the active value for each pin of a port Specify 1 for port pins that have active high status 0 port pins that have active low status Values are specified bitwise for 8 bits starting from the port s lowest
46. anted hereby under any patents copyrights or other intellectual property rights of Renesas Electronics or others You should not alter modify copy or otherwise misappropriate any Renesas Electronics product whether in whole or in part Descriptions of circuits software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples You are fully responsible for the incorporation of these circuits software and information in the design of your equipment Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits software or information When exporting the products or technology described in this document you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations You should not use Renesas Electronics products or the technology described in this document for any purpose relating to military applications or use by the military including but not limited to the development of weapons of mass destruction Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose manufacture use or sale is prohibited under any applicable domestic or foreign laws or regulations Renesas Electronics has used reasonable care in preparing the information included in this document b
47. ar data int ret ret UpGetPort p4 unsigned char amp data User s Manual U14873EJ2VOUM 61 CHAPTER 4 FUNCTION REFERENCE DA output pin value capture function int UpGetDA pname val char pname DA output pin name unsigned short val DA output value Function This function sets the value of the DA output pin Parameters pname Specifies the DA output pin name as a character string val Specifies a pointer to the area where the value of the DA output pin is stored Return value Normal end 1 Abnormal end 0 Note 0 also returned if the value of the DA output pin is undefined Example unsigned short daval UpGetDA ANOO amp daval 62 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Memory area data capture function int UpGetMem adar data unsigned long Address unsigned char data Data storage area Function This function captures the data in the memory area Parameters addr Specifies an address in the memory area to be captured data Specifies the data storage area Return value If data was successfully captured 1 If data was not successfully captured 0 Example unsigned char data int ret ret UpGetMem Oxffe000 unsigned char amp data User s Manual U14873EJ2VOUM 63 CHAPTER 4 FUNCTION REFERENCE DC motor active time clear function void UpCIrMtrAcCIk pname char pname
48. ass hIcon NULL wndclass lpszMenuName NULL wndclass hbrBackground COLOR WINDOW 1 wndclass style CS HREDRAW CS VREDRAW wndclass cbClsExtra 20 wndclass cbWndExtra RegisterClass amp wndclass hInst hInstance return TRUE ifndef WIN32 BORK KR k k KR k k k k KK RR KR KK KR k k k k k k KR k k k k k k RR RK RRR k k k k ke ke ke x WEP S EKK K K k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k RRR k k k k k k k k RR RR k k k k k k k k ke ke ke ke x int WEP int nParameter User s Manual U14873EJ2VOUM 93 CHAPTER 6 PROGRAMMING EXAMPLES 4 8 UOadda00 c switch nParameter case SYSTEM EXIT break case WEP_FREE DLL break return 1 BRR KR KK KR RR k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k k UParts adda00 void A BR RR k k k k k RR RK k k k k k k k k k k k k RRR RR k k k k RR RR k k RRR k k k e ke ke ke KK KKK void UParts_adda00 void if hUParts adda00Wnd hUParts adda00Wnd STR UP TITLE WS OVERLAPPEDWINDOW CW USEDEFAULT CW USEDEFAULT UParts adda00WIDTH UParts adda00HEIGHT NULL NULL hInst NULL if hUParts adda00Wnd UpInitAD ANIO UpInitAD ANI1 return CreateWindow LPSTR cnUParts adda00 WS BORDER WS VISIBLE UpSetUserWnd hUParts adda00Wnd ShowWindow hUParts adda00Wnd
49. ce equipment communications equipment test and measurement equipment audio and visual equipment home electronic appliances machine tools personal electronic equipment and industrial robots High Quality Transportation equipment automobiles trains ships etc traffic control systems anti disaster systems anti crime systems safety equipment and medical equipment not specifically designed for life support Specific Aircraft aerospace equipment submersible repeaters nuclear reactor control systems medical equipment or systems for life support e g artificial life support devices or systems surgical implantations or healthcare intervention e g excision etc and any other applications or purposes that pose a direct threat to human life You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics especially with respect to the maximum rating operating supply voltage range movement power voltage range heat radiation characteristics installation and other product characteristics Renesas Electronics shall have no liability for malfunctions or damages arising out of the use of Renesas Electronics products beyond such specified ranges Although Renesas Electronics endeavors to improve the quality and reliability of its products semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under
50. certain use conditions Further Renesas Electronics products are not subject to radiation resistance design Please be sure to implement safety measures to guard them against the possibility of physical injury and injury or damage caused by fire in the event of the failure of a Renesas Electronics product such as safety design for hardware and software including but not limited to redundancy fire control and malfunction prevention appropriate treatment for aging degradation or any other appropriate measures Because the evaluation of microcomputer software alone is very difficult please evaluate the safety of the final products or system manufactured by you Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product Please use Renesas Electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances including without limitation the EU RoHS Directive Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations This document may not be reproduced or duplicated in any form in whole or in part without prior written consent of Renesas Electronics Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electr
51. ctive LED Left and Inactive LED Right 7750 1600 Motor Motor 36 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Stepping motor function void UpStpingMtr pnames num actype reiji step char onames Pin names int num Number of pins per channel int actype Active high low char Excitation method short step Minimum step angle Function This function creates a stepping motor that is operated via several pins The motor is displayed according to its direction of rotation with the rotation speed and step angles Parameters pname Specifies pin names character strings for all pins num Specifies the number of pins per channel 4 or 8 actype Specifies the status when the motor is displayed as active Specify HIGH for active high status or LOW for active low status The active status is the same for all pins reiji Specifies the excitation method Set 0 for single phase or 1 for single dual phase step Specifies an integer fraction of 360 as the minimum step angle Return value None Remarks Once operation of this function is started the first value other than zero that is output to a connected pin is taken as the initial value At that point the stepping motor is shown as stopped not rotating Example char mtrpin 4 p00 p01 p02 p03 UpStpingMtr char mtrpin 4 HIGH 1 10 Figure 4 9 Stepping Motor 0 0 0 0 0
52. d P41 are reported as active high while pins P42 to P47 are reported as active low the description shown below sets port P4 s pins P40 P42 and P43 to active mode and holds the active mode for 50 pulses of the main system clock unsigned char data data Oxf1 UpSetPort p4 data 50L User s Manual U14873EJ2VOUM 67 CHAPTER 4 FUNCTION REFERENCE Value setting function for AD input pin int UpSetAD pname val char pname AD input pin name unsigned short val AD input value Function This function sets the value of the AD input pin Parameters pname Specifies AD input pin name as a character string val Sets value to be input to AD input pin Return value Normal end 1 Abnormal end t 0 Note 0 is returned if the AD input pin does not exist in a device used in the current simulation Remarks When using this function the AD input pin connection notification function UplnitAD must be called from within a user function so that the AD input pin name is reported in advance Example unsigned short adval adval 10 UpSetAD ANIO adval 68 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Data setting function for memory area int UpSetMem adar data unsigned long Address unsigned char data Data Function This function sets data in a memory area Parameters addr Specifies an address in the target memory area
53. dergoes AD conversion and the resulting digital value is then DA converted and output to ANOO as an analog value The display of DA Value XXXX is updated to the current value when the ANOO button in the user custom window is pressed An example is shown below Figure 6 2 Example of Parts Customized via User Window Analog value input incremented by 10 when uPD703003 ANIO button is pressed ANIO AD Value XXX ANOO DA Value XXX AD NC d conversion Analog value is set i DA conversion DACSO Analog value is displayed when ANOO button is pressed User created window Processing using UOadda00 c User Open I F Panel 00 IC AD Value 0 DA Value 0 User s Manual U14873EJ2VOUM 89 CHAPTER 6 PROGRAMMING EXAMPLES 6 2 2 Source examples lt 1 gt Target program program for V853 1 1 SAMPLE2 C pragma ioreg pragma interrupt INTADfuncl __interrupt void funcl void interrupt void funcl void DIO DACSO char ADCRO ADMO 0x90 __ 1 return main ADM1 0x07 ADMO 0x90 DAM 0x01 ADIC 0x02 __ 1 while 1 90 User s Manual U14873EJ2VOUM CHAPTER 6 PROGRAMMING EXAMPLES lt 2 gt Custom part source file UOadda00 c 1 8 UOadda00 c User Open I F Sample Program UOadda00 c include lt
54. e 3 3 6 Include file Source file The include file uparts32 h and source file uparts32 cpp that are used for user customization are bundled in the 5 850 product package Include uparts32 h and add uparts32 cpp to the project uparts32 h contains descriptions of macro definitions for active high low status and IMPORTS declarations for functions described in CHAPTER 4 FUNCTION REFERENCE When compiling be sure to set the include path in the directory where the file uparts32 h is located 24 User s Manual U14873EJ2VOUM CHAPTER 3 PROGRAMMING 3 4 Module Definition DEF File A module definition DEF file must be created to include the EXPORTS declaration as described in the module definition file for Windows programming The IMPORTS declaration is already included in the file Uparts32 h and therefore does not need to be considered 341 EXPORTS declaration Be sure to enter an EXPORTS declaration for user functions and simulation call functions You must also enter an EXPORTS declaration for functions used to read or save project files for reset functions and some other functions Example EXPORTS UParts usrwin UPdata usrwin User s Manual U14873EJ2VOUM 25 CHAPTER 4 FUNCTION REFERENCE 4 1 Customization via Parts window The functions that can be called from within user functions and pasted into the Parts window to perform all simulation processing are listed below These functions can be used to easily cr
55. e val Port data capture function UpGetPort portname data DA output pin value capture function UpGetDA pname val Memory area data capture function UpGetMem adar data DC motor active time clear function UpCIrMtrAcCIk pname Stepping motor information capture function UpGetStpingMtr pnames num posrev negrev angle Value setting function for pins UpSetPin pname val time Data setting function for ports UpSetPort portname data time Value setting function for AD input pin UpSetAD pname val Data setting function for memory area UpSetMem adar data Active time notification function for motor UpGetMtrAcClk pname val actime Time conversion notification for one main system UpSimtimeSec void clock pulse Function for transmitting packets from HOST using UpSetUSBPack total total bit data USB function Function for receiving packets from Function using UpGetUSBPack total data USB function Function for transmitting signals from HOST using UpSetUSBSig sig USB function Function for receiving signals from Function using UpGetUSBSig sig USB function 48 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Window handle notification function void UpSetUserWnd hUwnd HANDLE hUwnd Handle of user window Function This function notifies the simulator of a user created window handle The user should describe this function immediately
56. e from that country Please call an NEC sales representative The information in this document is current as of October 2002 The information is subject to change without notice For actual design in refer to the latest publications of NEC s data sheets or data books etc for the most up to date specifications of NEC semiconductor products Not all products and or types are available in every country Please check with an NEC sales representative for availability and additional information No part of this document may be copied or reproduced in any form or by any means without prior written consent of NEC NEC assumes no responsibility for any errors that may appear in this document NEC does not assume any liability for infringement of patents copyrights or other intellectual property rights of third parties by or arising from the use of NEC semiconductor products listed in this document or any other liability arising from the use of such products No license express implied or otherwise is granted under any patents copyrights or other intellectual property rights of NEC or others Descriptions of circuits software and other related information in this document are provided for illustrative purposes in semiconductor product operation and application examples The incorporation of these circuits software and information in the design of customer s equipment shall be done under the full responsibility of customer NEC assumes no resp
57. eate parts simply by specifying pins and action information as parameters Note however that even if the user has created a window all parts that are created by this function are still pasted in the Parts window Table 4 1 Customization Functions Used in Parts Window Function Name Prototype Push button function UpPushBtm pname actype btmname Toggle button function UpTglBtm pname actype btmname Group select button exclusive push button UpSelectBtm gname pnames pnum actype btmnames function Hold time setup function UpSetPBtmtime time LED function UpLed pname actype ledname pictype LED function set per port UpPortLed portname actype ledname pictype Matrix LED function UpMtxLed pnames1 pnames2 pnum1 pnum2 actype1 actype2 DC motor function UpDoMtr pname actype mtrname Stepping motor function UpStpingMtr pnames num actype reiji step Vertical scroll bar analog input function UpScalelnterAD pname adname Reference voltage value setup function UpSetAvref avref Bitmap setup function for button UpSetBtmBmp actbmp nactbmp Bitmap setup function for LED UpSetLedBmp actbmp nactbmp Bitmap setup function for DC motor UpSetMtrBmp actbmp nactbmp LED picture setup function UpSetLedPic type color Serial pin data input function UpSerial_data serpname data count first bitnum Window title function UpPanelTitleName title Bitmap disp
58. elow the bottom right part Parameter string Specifies the character string to be displayed Return value None Example UpWriteString Power User s Manual U14873EJ2VOUM 47 CHAPTER 4 FUNCTION REFERENCE 4 2 Customization via User Window The following functions are provided to enable the user to freely customize user created windows and parts The handle notification function for user windows can be used to enable processing of windows and input from user parts and the simulation call function can be used to perform output display processing to user parts Table 4 2 Customization Functions Used in User Window Function Name Prototype Window handle notification function UpSetUserWnd hUwnd Window close function UpCloseUserWnd hwnd Simulation call function UpCallFuncName fname Motor pin notification function UplnitMtrPin pname actype Stepping motor notification function UplnitStpingMtr pname num actype reiji step Pin active value notification function UplnitPin pname actype Port active value notification function UplnitPort portname actype AD input pin notification function UplnitAD pname Project file read function name notification function UpLoadProjName funcname Project file save function name notification UpSaveProjName funcname function Reset function name notification function UpResetFuncName funcname Pin value capture function UpGetPin pnam
59. er than 0 or 1 Describe 0 or 1 for excitation according to the excitat ion method Stepping motor functions that include a minimum step angle parameter The minimum step angle does not divide to 360 The described minimum step angle is a value that ccannot divide 360 evenly Describe an integer value that can divide 360 evenly for the minimum step angle Stepping motor functions that include a number of channels parameter The picture type is not PIC_RECT or PIC_ELL The described value for the type of figure in the parameter is a value other than macro PIC_RECT or PIC_ELL Describe PIC_RECT or PIC_ELL for the type of figures LED picture setup function The color type is not PIC RED or PIC YELLOW or PIC GREEN The described value for the type of color in the parameter is a value other than macro PIC RED PIC YELLOW or PIC GREEN Describe one of PIC RED PIC YELLOW or PIC GREEN for the type of color LED picture setup function The view type is no O or 1 The described value of the figure style is a value other than or 1 Describe 0 or 1 for the parameter figure style LED functions that include a picture type parameter The first bit of serial input data is not MSB or LSB The described value of the figure style is a value other than O or 1 Describe 1 or 0 for the first bit of the parameter Serial pin data input function The active H L of output1 is not HIGH or LOW The described value of the active H L of output 1 for
60. er words there can be only one active button at a time within the button group Parameters gname Specifies the name assigned to the group This group name is shown at the top of the group select buttons pnames Specifies pin names character strings for each button pnum Specifies the number of buttons actype Specifies the value entered by clicking a group select button Specify HIGH to enter a 1 high value or LOW to enter a 0 low value The active status for all group buttons is the same btmnames Specifies the names assigned to individual buttons Since this function name is displayed on the button the character string is limited to 10 single byte characters Return value None User s Manual U14873EJ2VOUM 29 CHAPTER 4 FUNCTION REFERENCE Example static char sizePin 4 p30 p31 p32 p33 static char sizeName 4 B5 A4 A3 UpSelectBtm Size sizePin 4 HIGH sizeName Figure 4 3 Group Select Buttons 30 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Hold time setup function void UpSetPBtmtime time char time Hold time Function This function specifies the hold time for a push button Parameter time Sets a hold time character string The unit for this setting is ms milliseconds The range of settings is 0 001 to 999 ms Return value None Example UpSetPBtmtime 0 2 User s Manual U14873EJ2VOUM 31 CHAP
61. ety equipment and medical equipment not specifically designed for life support Specific Aircraft aerospace equipment submersible repeaters nuclear reactor control systems life support systems and medical equipment for life support etc The quality grade of NEC semiconductor products is Standard unless otherwise expressly specified in NEC s data sheets or data books etc If customers wish to use NEC semiconductor products in applications not intended by NEC they must contact an NEC sales representative in advance to determine NEC s willingness to support a given application Note 1 NEC as used in this statement means NEC Corporation and also includes its majority owned subsidiaries 2 NEC semiconductor products means any semiconductor product developed or manufactured by or for NEC as defined above M8E 00 4 4 User s Manual U14873EJ2VOUM Regional Information Some information contained in this document may vary from country to country Before using any NEC product in your application please contact the NEC office in your country to obtain a list of authorized representatives and distributors They will verify Device availability Ordering information Product release schedule Availability of related technical literature Development environment specifications for example specifications for third party tools and components host computers power plugs AC supply voltages and so fort
62. eue c iia dan enn aw aaa Weal 13 1 4 General Description of External Part User Open Interface Specifications 13 1 2 General Description of User Custom 2 122222 13 1 2 1 TYPES Of CUSTOMIZATION tohoto cete Pace eg 13 1 2 2 Userscreated files rre VE ve ve vo a yea Eee vede wee Tue En ev ge v ge EU E 13 1 2 3 Positioning of user customized 14 1 3 Environment 1 E tenes doro eure xa sou vex aee sata mo u Katova 15 1 3 1 Development 4 404 1 12 0 eee eee nenene PA KKK KK KKK K PAR 15 1 3 2 Operatirig envIFoOnmielit eie Sce Ei ee erede epe ei haz ate 15 CHAPTER 2 DOWNEQAD 83 oan cre e o ca ca soya ca selec vom Va cR E redeo vr 16 2 1 2DOWMOAG MSEE I IEEE 17 2 25 Unload tutta ei P 17 CHAPTER 3 18 3 1 Programming Configuration and Processing Flow eere 18 3 1 1 Customization via Parts windOw 18 3 1 2 Customization via user 1 19 3 2 Steps in Creation of Customized Parts
63. gh low char btmname Function name Function This function creates one toggle button When clicked a toggle button sets and holds input status until the same button is clicked again This button s initial mode is inactive mode The first time this button is clicked the value specified by the parameter actype is input Parameters pname Specifies the pin name as a character string actype Specifies a value to be input using the toggle button Specify HIGH to enter a 1 high value or LOW to enter a 0 low value btmname Specifies the name of the toggle button function Since this function name is displayed on the button the character string is limited to 16 single byte characters Return value None Example UpTglBtm p22 HIGH START UpTglBtm p23 LOW STOP Figure 4 2 Toggle Buttons 28 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Group select button exclusive push button function void UpSelectBtm gname pnames pnum actype btmnames char gname Group name char pnames Pin name int pnum Number of buttons int actype Active high low char btmnames Function name Function Several buttons can be grouped together as exclusive buttons Clicking one of the group of buttons that is enclosed in a frame enters an active value for the clicked button only The entered value remains in effect until another button is clicked In oth
64. h Network requirements In addition trademarks registered trademarks export restrictions and other legal issues may also vary from country to country NEC Electronics Inc U S Filiale Italiana Santa Clara California Milano Italy Tel 408 588 6000 Tel 02 66 75 41 800 366 9782 Fax 02 66 75 42 99 Fax 408 588 6130 800 729 9288 Branch The Netherlands Eindhoven The Netherlands NEC do Brasil S A Tel 040 244 58 45 Electron Devices Division Fax 040 244 45 80 Guarulhos SP Brasil Tel 11 6462 6810 Fax 11 6462 6829 Branch Sweden Taeby Sweden Tel 08 63 80 820 NEC Electronics Europe GmbH 08 63 80 388 Duesseldorf Germany Tel 0211 65 03 01 Fax 0211 65 03 327 United Kingdom Branch Milton Keynes UK Tel 01908 691 133 Sucursal en Espa a Fax 01908 670 290 Madrid Spain Tel 091 504 27 87 Fax 091 504 28 60 Succursale Francaise V lizy Villacoublay France Tel 01 30 67 58 00 Fax 01 30 67 58 99 User s Manual U14873EJ2VOUM NEC Electronics Hong Kong Ltd Hong Kong Tel 2886 9318 Fax 2886 9022 9044 NEC Electronics Hong Kong Ltd Seoul Branch Seoul Korea Tel 02 528 0303 Fax 02 528 4411 NEC Electronics Shanghai Ltd Shanghai P R China Tel 021 6841 1138 Fax 021 6841 1137 NEC Electronics Taiwan Ltd Taipei Taiwan Tel 02 2719 2377 Fax 02 2719 5951 NEC Electronics Singapore Pte Ltd Novena Square Singapore Tel 253 8311 Fax 250 3583 J02
65. he character string for the name to be displayed in the title bar of the Parts window Return value None Example UpPanelTitleName System for printer User s Manual U14873EJ2VOUM 45 CHAPTER 4 FUNCTION REFERENCE Bitmap display function void UpSetUsrBmp bmpname char bmpname Bitmap file name Function This function displays a bitmap that is always displayed without any relation to simulations The bitmap is displayed to the right of the part that is at the bottom right in the set of currently displayed parts If there is not enough room in the window to display the bitmap to the right of the bottom right part it is displayed below the bottom right part Parameter bmpname Specifies a character string as the bitmap file name The bitmap file should be stored in the same directory as the simulator or its name should be specified with the full path Return value None Example UpSetUsrBmp printer bmp 46 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Character string display function void UpWriteString string char string Character string to be displayed Function This function displays a character string The character string is displayed to the right of the part that is at the bottom right in the set of currently displayed parts If there is not enough room in the window to display the character string to the right of the bottom right part it is displayed b
66. ibrary DLLs are Windows modules that contain executable code and data that can be accessed by functions within Windows applications or other DLLs External parts GUI block This block enables external part operations to be performed via a window External parts block This is part of the external parts GUI block which is used to control standard external parts User customized external parts block This is part of the external parts GUI block which is used for user created external parts External parts user open interface block 14 This is part of the external parts GUI block which is used as an interface between the external parts block and the user customized external parts block User s Manual U14873EJ2VOUM CHAPTER 1 GENERAL 1 3 Environment 1 3 1 Development environment The following describes the development environment under which users write programs according to this manual s specifications in order to create DLL files Hardware environment PC AT compatible CPU Pentium 166 MHz or above is recommended Software environment Windows 98 Windows NT 4 0 Window 2000 Windows Me Windows XP Microsoft Visual C V5 00 or later 1 3 2 Operating environment The operating environment of the simulator that loads and operates user created files is described below Hardware environment IBM PC AT compatible CPU Pentium 166 MHz or above is recommended Software environment Windows
67. ired to create DLL files the created window s callback functions user functions and simulation call functions that are called at a set interval during simulations User functions and their subordinate functions are used to report simulation call functions and the motor pin names The creation of parts and programming of I O actions are done using the user created window s callback functions and simulation call functions Processing flow Simulation of customized parts is performed as the simulator works with the external parts block using functions that capture and set I O information on pins and ports The pin output information also can be redrawn or otherwise processed by calling simulation call functions from the external parts block Figure 3 2 shows the relation between DLL files customized via a user created window and external parts in the simulator as well as the configuration of functions User s Manual U14873EJ2VOUM 19 CHAPTER 3 PROGRAMMING Figure 3 2 Programming Configuration and Processing Flow for Customization via User Window User customized file UOusrwin c External part user open is called include lt Windows h gt include uparts32 h Called by external part Seley gla DllMain RegisterClass WindProc HWND hwnd switch msg External parts block case WM_COMMON switch wParam case IDM_BTM1 UpSetPin p21 1 50 U
68. ith the DLL file name c If an error occurs when a user created custom DLL is read the part that caused the error is not created d If an error or warning occurs even once for the user panel custom functions UpGetPin UpGetPort UpGetMem UpCIrMtrAcCIk or UpGetStpingMtr error values may be returned or the function may not operate correctly during subsequent uses of the function Therefore if an error or warning occurs revise the Source code create the DLL file again and reload to avoid such problems A 2 Error and Warning Messages Error messages and warning messages that may occur during execution of a function are listed below The abbreviated function names listed below are used to refer to the function names for which the error occurred Table A 1 The Function Names For Which The Error Occurred Stepping motor functions UpStpingMtr UpSetStpingMtr UpGetStpingMtr LED picture setup function UpSetLedPic LED functions UpLed UpPortLed Matrix LED function UpMtxLed Serial pin data input function UpSerial data Port value setup capture functions UpPortLed UpGetPort UpSetPort Hold time setup function UpSetPBtmtime Vertical scroll bar analog input function UpScalelnterAD Reference voltage value setup function UpSetAvref Function name notification functions UpCallFuncName UpLoadProjName UpSaveProjName UpResetFu
69. l FAX Address Thank you for your kind support North America Hong Kong Philippines Oceania Asian Nations except Philippines NEC Electronics Inc NEC Electronics Hong Kong Ltd NEC Electronics Singapore Pte Ltd Corporate Communications Fax 852 2886 9022 9044 Fax 65 250 3583 Fax 1 800 729 9288 1 408 588 6130 oe s tronics Hong Kong Ltd oe iconductor Technical Hotli ectronics Hong Kong Ltd emiconductor Technical Hotline P Branch Fax 81 44 435 9608 Technical Documentation Dept Fax 82 2 528 4411 Fax 49 211 6503 274 South America Taiwan NEC do Brasil S A NEC Electronics Taiwan Ltd Fax 55 11 6462 6829 Fax 886 2 2719 5951 would like to report the following error make the following suggestion Document title Document number Page number If possible please fax the referenced page or drawing Document Rating Excellent Acceptable Clarity Technical Accuracy Organization
70. lay function UpSetUsrBmp bmpname Character string display function UpWriteString string 26 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Push button function void UpPushBtm pname actype btmname char pname Pin name int actype Active high low char btmname Function name Function This function creates one push button A push button is a button icon that sets and holds input status for a specified hold time only after the button has been clicked The hold time is set using the hold time setup function UpSetPBtmtime The time set in UpSetPBtmtime described before this function is assumed as the hold time If a hold time is not set the default value 0 5 ms is used Parameters pname Specifies the pin name as a character string actype Specifies a value to be input using a push button Specify HIGH to enter a 1 high value or LOW to enter a O low value btmname Specifies the name of the push button function Since this function name is displayed on the button the character string is limited to 16 single byte characters Return value None Example UpSetPBtmtime 50 UpPushBtm p20 HIGH START UpPushBtm p20 LOW STOP Figure 4 1 Push Buttons User s Manual U14873EJ2VOUM 27 CHAPTER 4 FUNCTION REFERENCE Toggle button function void UpTglBtm pname actype btmname char pname Pin name int actype Active hi
71. le in an environment in which Microsoft Visual is not installed create the DLL file using the released version Enter the user created DLL file name in the place for specifying the simulator s external parts customization files See 2 1 Download The window created by the user and the corresponding customized parts are displayed Note See 3 4 Module Definition DEF File User s Manual U14873EJ2VOUM 21 CHAPTER 3 PROGRAMMING 22 Figure 3 3 Creation Flow usr def usr c uparts32 h uparts32 cpp UPusr dll UOusr dll External parts block User s Manual U14873EJ2VOUM CHAPTER 3 PROGRAMMING 3 3 Basic Rules The basic rules for user programming of customized parts are described below 3 3 1 User functions User functions are main functions that are described by users 1 When a user created DLL file is loaded to the simulator it becomes a function that is called by the simulator 2 The function references described in Chapter 4 must be contained in user functions or functions that are subordinate to user functions 3 User function names are function names in which the name of the user created DLL file minus the first two characters is added to UParts 4 The first two characters of the user created DLL file name are fixed a Customization via Parts window Always use UP as the first two characters of the user created DLL file name Example UPusr dll UParts usr
72. ncName Bitmap setup functions UpSetBtmBmp UpSetLedBmp UpSetMtrBmp Button functions 104 UpPushBtm UpTglBmp UpSelectBtm User s Manual U14873EJ2VOUM APPENDIX A ERROR MESSAGES 2 1 Error Messages With the simulator when an error is deetected a message is output to the error dialog box and the processing is stopped E10100 Cause User Action Function E10101 Cause User Action Function 10103 Cause User Action Function E10107 Cause User Action Function E1010c Cause User Action Function E10124 Cause User Action Function E10139 Cause User Action Function E10200 Cause User Action Function E10201 Cause User Action Function The selected pin name does not exist The set pin does not exist Set a pin name that exists on the target device All functions that include a pin name parameter The pin name is a 2 byte name The set pin name is described with 2 byte characters Desscribe the pin name with 1 byte characters All functions that include a pin name parameter Hold time is invalid Retention time is not set within the settable range or is not a numerical value Set the retention time within the range 999msec to 0 001msec Hold time setup function AVref is above under operating voltage range AVref is not within the range of operating voltage Set it within the range of operating voltage Reference voltage value setup function
73. nction call the motor pin notification function UplnitMtrPin from within a user function so that the pin name is reported in advance Example char val unsigned long actime 2 UpGetMtrAcClk p41 amp val actime wsprintf timebuf Rotation time Ix 08Ix M actime 1 actime 0 TextOut hdc 240 320 timebuf sizeof timebuf 70 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Time conversion notification for one main system clock pulse unsigned long UpSimtimeSec void Function This function converts one pulse of the main system clock to a nanosecond value Parameter None Return value The nanosecond value converted from one pulse of the main system clock is returned Example unsigned long simtime simtime UpSimtimeSec User s Manual U14873EJ2VOUM 71 CHAPTER 4 FUNCTION REFERENCE Function for transmitting packets from HOST using USB function BOOL UpSetUSBPack total total bit data unsigned char total Number of data arrays unsigned char total bit Number of bits in transmit data unsigned char data Pointer to packet data array Function This function uses the USB function to set packet transmission information from the HOST Parameters total Specifies the number of packet data arrays total bit Specifies the converted total bits of the data to be transmitted data Specifies a pointer to the packet data array to be transmitted
74. nel adda00 WINSTUB EXE PRELOAD MOVEABI PRELOAD MOVEABI 4096 WEP UParts adda00 UParts adda00WndProc UParts adda00Call UParts adda00Reset UParts adda00LoadProj UParts adda00SaveProj SU78K0 UpSetUserWnd 50850 50850 50850 50850 50850 50850 50850 50850 UpCloseUserWnd UpCallFuncName UpResetFuncName UpLoadProjName UpSaveProjName UpInitAD UpSetAD UpGetDA LE DISCARDABLE LE SINGLE Q1 Q2 04 95 96 97 User s Manual U14873EJ2VOUM 99 CHAPTER 6 PROGRAMMING EXAMPLES lt 4 gt Make file UOadda00 mak 1 4 UOadda00 mak Microsoft Developer Studio Generated NMAKE File Based uoadda00 dsp IIF S CFG CFG uoadda00 Win32 Debug IMESSAGE Configuration not specified Set default uoadda00 Win32 Debug IENDIF 1 S CFG uoadda00 Win32 Release se CFG uoadda00 Win32 Debug IMESSAGE Specified build mode CFG is not correct IMESSAGE Configuration can be specified during execution of NMAKE IMESSAGE Defines command line macro setting Example MESSAGE IMESSAGE NMAKE f uoadda00 mak CFG uoadda00 Win32 Debug MESSAGE IMESSAGE Selectable build modes MESSAGE IMESSAGE uoadda00 Win32 Release for Win32 x86 Dynamic Link Library IMESSAGE uoadda00 Win32 Debug for Win32 x86 Dynamic Link Library MESSAGE ERROR Invalid configuration was specified ENDIF 1 5 05 Windows NT NU
75. not set previous Cause A necessary notification function was not notified previously User Action Call the necessary notification function previously Function Functions requiring advance notification function A 2 2 Warning Messages With the simulator when a warning is detected a message is output to the warning dialog box and the processing is continued W10180 Cause User Action Function W10181 Cause User Action Function W 10280 Cause User Action Function Hold time is not set Hold time is set to 0 5 msec Hold time is not set Set the hold time Hold time setup function AVref is not set AVref is set 5 0v continue AVref is not set Set AVref Reference voltage value setup function Data cannot be input from external devices during backtrace execution Data input during back trace is prohibited Do not input data while executing back trace Vertical scroll bar analog input function User s Manual U14873EJ2VOUM 107 108 User s Manual U14873EJ2VOUM Although NEC has taken all possible steps essag e to ensure that the documentation supplied to our customers is complete bug free From and up to date we readily accept that errors may occur Despite allthe care and precautions we ve taken you may Name encounter problems in the documentation Please complete this form whenever Company you d like to report errors or suggest improvements to us Te
76. o set ON or OFF An example is shown below Figure 6 1 Example of Parts Customized via Parts Window Port 6 Output mode LED uPD703002 Pe Bito P6 Bit1 Pe P6 Bit5 P6 Bit6 P6 Bit7 ooo 6 P60 to P67 lt P5 Bito P5 Bitt Bit2 P5 P5 5 5 P5 6 P5 Bit7 P50 to P57 Parts window Processing of sample1 c Port 5 Input mode switch Parts Window File Mode Edit Parts Bitmap Customize Dray Option Help BitO Biti Bit2 Bits 7 78 User s Manual U14873EJ2VOUM CHAPTER 6 PROGRAMMING EXAMPLES 6 1 2 Source examples lt 1 gt Target program program for V852 1 1 SAMPLE1 C pragma ioreg main 0 0 5 OxFF PM6 0 User s Manual U14873EJ2VOUM 79 CHAPTER 6 PROGRAMMING EXAMPLES lt 2 gt Custom part source file UPsw00 c 1 3 UPsw00 c User Open I F P50 P51 P52 P53 P54 P55 P56 P57 include include typedef unsigned char typedef unsigned short typedef unsigned long if 1 include uparts32 h else I I Switcl Switcl Switcl Switc Switcl Switc Switcl Switcl lt string h gt include uparts h endif ifdef WIN32 BOOL APIENTRY DllMain HANDLE DWORD LPVOID else 1 R WN lt Windows h gt
77. onics products or if you have any other inquiries Note 1 Renesas Electronics as used in this document means Renesas Electronics Corporation and also includes its majority owned subsidiaries Note 2 Renesas Electronics product s means any product developed or manufactured by or for Renesas Electronics RENESAS User s Manual 5 850 System Simulator Ver 2 00 or Later External Part User Open Interface Specifications Target Device V850 Series Document No U14873EJ2VOUMOO 2nd edition Date Published October 2002 Corporation 2000 Printed in Japan 2 User s Manual U14873EJ2VOUM V850 Series V852 V853 V850 SA1 850 5 1 V850 SB2 V850 SC1 V850 SC2 V850 SC3 V850 SF1 V850 SV1 850 51 V850E MS2 850 1 V850E MA2 V850E IA1 and V850E IA2 are trademarks of NEC Corporation Pentium is a trademark of Intel Corporation Windows and WindowsNT are either a registered trademark or a trademark of Microsoft Corporation in the United States and or other countries PC AT is a trademark of International Business Machines Corporation User s Manual U14873EJ2VOUM 3 The export of these products from Japan is regulated by the Japanese government The export of some or all of these products may be prohibited without governmental license To export or re export some or all of these products from a country other than Japan may also be prohibited without a licens
78. onsibility for any losses incurred by customers or third parties arising from the use of these circuits software and information While NEC endeavours to enhance the quality reliability and safety of NEC semiconductor products customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely To minimize risks of damage to property or injury including death to persons arising from defects in NEC semiconductor products customers must incorporate sufficient safety measures in their design such as redundancy fire containment and anti failure features NEC semiconductor products are classified into the following three quality grades Standard Special and Specific The Specific quality grade applies only to semiconductor products developed based on a customer designated quality assurance program for a specific application The recommended applications of a semiconductor product depend on its quality grade as indicated below Customers must check the quality grade of each semiconductor product before using it in a particular application Standard Computers office equipment communications equipment test and measurement equipment audio and visual equipment home electronic appliances machine tools personal electronic equipment and industrial robots Special Transportation equipment automobiles trains ships etc traffic control systems anti disaster Systems anti crime systems saf
79. or the bitmap file name displayed when inactive Return value None Remarks If an LED function is described without describing this function first the standard LED s bitmap is displayed see the image shown in Figure 4 4 Example UpSetLedBmp lighton bmp lightoff bmp UpLed p31 HIGH Power 1 User s Manual U14873EJ2VOUM 41 CHAPTER 4 FUNCTION REFERENCE Bitmap setup function for DC motor void UpSetMtrBmp actbmp nactbmp char actbmp Active bitmap name character string char nactbmp Inactive bitmap name character string Function This function sets the bitmap for a DC motor A DC motor display can be changed by entering this function immediately before the target DC motor s function The same bitmap will be displayed until it is set again by this function The bitmap file should be stored in the same directory as the simulator or its name should be specified with the full path Parameters actbmp Specifies a character string for the bitmap file name displayed when active nactbmp Specifies a character string for the bitmap file name displayed when inactive Return value None Remarks If a DC motor function is described without describing this function first the standard DC motor s bitmap is displayed see the image shown in Figure 4 8 Example UpSetMtrBmp trun bmp stop bmp UpDcMtr p32 HIGH Motor 42 User s Manual U14873EJ2VOUM CHAPTER 4
80. pScalelnterAD ani1 Voltage Figure 4 10 Vertical Scroll Bar Analog Input Voltage 0 0 38 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Reference voltage value setup function void UpSetAVref avref char avref Reference voltage value Function This function sets the reference voltage value for the A D converter This reference voltage value is used to determine the operating range for an analog input part Any setting that is within the range for operating power supply voltage see the User s Manual of each device can be set Values can be set as precisely as the first decimal place but subsequent decimal places are rounded off Parameter avref Specifies the reference voltage value as a character string Return value None Remarks If this function or the standard setting is not set the analog input part will operate using the default voltage value of 5 0 V Example UpSetAVref 3 5 User s Manual U14873EJ2VOUM 39 CHAPTER 4 FUNCTION REFERENCE Bitmap setup function for button void UpSetBtmBmp actbmp nactbmp char actbmp Active bitmap name character string char nactbmp Inactive bitmap name character string Function This function sets the bitmap for a button A button display can be changed by entering this function immediately before the target button s function The same bitmap will be displayed until it is set again by this function
81. pin as the LSB Return value If port s active value was set correctly 1 If port s active value was not set correctly 0 Example When port 4 s pins P40 and P41 are set as active high and pins P42 to P47 are set as active low int ret ret UplnitPort P4 0x03 When port 2 s pin P27 only is set as active high and pins P20 to P26 are set as active low int ret ret UplnitPort P2 0x80 User s Manual U14873EJ2VOUM 55 CHAPTER 4 FUNCTION REFERENCE AD input pin notification function int UplnitAD pname char pname AD input pin name Function This function notifies the simulator of the AD input pin used to input a value from the user open interface function If UpSetAD includes a value to be input to the AD input pin this function must be described within the user function UParts xxx When the user open interface function does not include a value to be input to the AD input pin there is no need to describe this function Parameter pname Specifies the AD input pin name as a character string Return value Normal end 1 Abnormal end 0 if the AD input pin does not exist in a device used in the current simulation Example UplnitAD ANI0 56 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Project file read function name notification function int UpLoadProjName funcname char funcname Project file read function name Function When the simulator
82. r notification function int UplnitStpingMtr pnames num actype step char pnames Pin name int num Number of pins per channel int actype Active high low char reiji Excitation method short step Minimum step angle Function This function connects a stepping motor that is operated via several pins to the specified pin When using the stepping motor this function must be described within the user function UParts_xxx When not using the stepping motor there is no need to describe this function Parameters pnames Specifies pin names character strings for all pins num Specifies the number of pins per channel 4 or 8 actype Specifies the status when the motor is displayed as active Specify HIGH for active high status or LOW for active low status The active status is the same for all pins reiji Specifies the excitation method Set 0 for single phase or 1 for single dual phase step Specifies an integer fraction of 360 as the minimum step angle Return value If set correctly 1 If not set correctly 0 Example char mtrpin 4 p00 p01 p02 p03 UplnitStpingMtr char mtrpin 4 HIGH 1 10 User s Manual U14873EJ2VOUM 53 CHAPTER 4 FUNCTION REFERENCE Pin active value notification function int UplnitPin pname char pname Pin name int actype Active value of pin Function This function sets the
83. ser s Manual U14873EJ2VOUM 83 CHAPTER 6 PROGRAMMING EXAMPLES 4 Make file UPsw00 mak 1 5 UPsw00 mak Microsoft Developer Studio Generated NMAKE File Based on upsw00 dsp S CFG i CFG upsw00 Win32 Debug IMESSAGE Configuration not specified Set default upsw00 Win32 Debug IENDIF LIF S CFG upsw00 Win32 Release amp amp S CFG upsw00 Win32 Debug IMESSAGE Specified build mode CFG is not correct IMESSAGE Configuration can be specified during execution of NMAKE IMESSAGE Defines command line macro setting Example MESSAGE IMESSAGE NMAKE f upsw00 mak CFG upsw00 Win32 Debug MESSAGE IMESSAGE Selectable build modes MESSAGE IMESSAGE upsw00 Win32 Release for Win32 x86 Dynamic Link Library IMESSAGE upsw00 Win32 Debug for Win32 x86 Dynamic Link Library MESSAGE ERROR Invalid configuration was specified ENDIF 1 5 05 Windows NT NULL ELSE NULL nul ENDIF 1 upsw00 Win32 Release OUTDIR Release INTDIR Release Begin Custom Macros OutDir Release End Custom Macros ALL OUTDIR Nupsw00 dll 84 User s Manual U14873EJ2VOUM CHAPTER 6 PROGRAMMING EXAMPLES 2 5 UPsw00 mak CLEAN erase 5 INTDIR Upsw00 obj erase S INTDIR vc60 idb erase 5 OUTDIR Nupsw00 dll erase OUTDIR upsw00 exp erase 5 OUTDIR upsw00 1lib S OUTDIR
84. ser window s callback function case WM DESTROY UpCloseUserWnd hwnd Called once after UOusrwin dll is loaded Uparts_usrwin int i hwnd CreateWindow UpSetUserWnd hwnd UpCallFuncName Update_usrwin UpReset FuncName Upsur_reset UpSaveProjName UpSave_usrproj UpLoadProjName UpLoad usrproj i UplnitPin p21 HIGH Called once each time a simulation is executed ed Update usrwin unsigned long simtime val UpGetPin p32 External parts user open I F block Called when CPU reset occurs _ _ Upusr_reset Called when saving to project file a UpSave usrproj char filename WritePrivateProfileString User Window filename Called when reading from project file SS UpLoad usrproj char filename GetPrivateProfileString User DLL Window filename 20 User s Manual U14873EJ2VOUM CHAPTER 3 PROGRAMMING 3 2 Steps in Creation of Customized Parts 3 2 1 3 2 2 Customization via Parts window Program the external parts to be customized when creating a DLL file using Windows programming methods Be sure to include the file uparts32 h in this programming and add uparts32 cpp to the project Use Windows programming methods to create a module definition DEF a make file and if necessary a resource file then compile to create
85. ta transferred to the serial pin as one unit Parameters serpname Specifies the character string for the name of the serial data input pin data Specifies a pointer to an array in which the value set to the serial data input pin has been stored in units consisting of the number of transfer data bits count Specifies the number of arrays in which values set to the serial data input pin have been stored in units consisting of the number of transfer data bits first Specifies whether data equivalent to the number of bits in the transfer data will be set sequentially with the MSB first or the LSB first 1 is specified to set sequentially with the MSB first and 0 is specified to set sequentially with the LSB first bitnum Specifies the number of bits in the transfer data When using UART Universal Asynchronous Receiver Transmitter the start bit parity bit and stop bit are included in the data and data bit count Return value None Example To set 8 bit data sequentially from LSB first to serial pin SERT unsigned short data 3 Oxff Oxa0 Ox3b Upserial data SER1 data 3 0 8 The data is input to SER1 as shown below lt 111111110000010111011100 44 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Window title function void UpPanelTitleName title char title Title name Function This function displays a name in the title bar of the Parts window Parameter title Specifies t
86. that has elapsed since the previous function call and its measurement unit is the main system clock Be sure to enter an EXPORTS declaration see 3 4 1 EXPORTS declaration in a module definition file for the simulation call function void Update usrwin unsigned long simtime Example UpCallFuncName Update usrwin User s Manual U14873EJ2VOUM 51 CHAPTER 4 FUNCTION REFERENCE Motor pin notification function void UplnitMtrPin pname actype char pname Pin name int actype Active high low Function This function reports the pin name specified for the motor to capture the motor value and active time via the active time notification function for motor When using the motor pin this function must be described within the user function UParts_xxx When not using the motor pin there is no need to describe this function Parameters pname Specifies a character string for the name of the pin connected to the motor actype Specifies that the motor is in active mode Specify HIGH for active high status or LOW for active low status Return value None Remarks Unless notification is already included in the user function even if the information is captured by the active time notification function for motor UpGetMtrAcClk during a simulation the captured value is not guaranteed Example UplnitMtrPin p41 HIGH 52 User s Manual U14873EJ2VOUM CHAPTER 4 FUNCTION REFERENCE Stepping moto
87. the parameter is a value other than HIGH or LOW Describe HIGH or LOW for the active H L of output 1 for the parameter Matrix LED function The active H L of output2 is not HIGH or LOW The described value of the active H L of output 2 for the parameter is a value other than HIGH or LOW Describe HIGH or LOW for the active H L of output 2 for the parameter Matrix LED function The port name is a 2 byte name The port name of the parameter is described with 2 byte characters Describe the port name of the parameter with 1 byte characters Port value setup capture functions The selected port name does not exsist A nonexistent port name is described as the port name of the parameter Describe a port name existing on a target device Port value setup capture functions User s Manual U14873EJ2VOUM APPENDIX A ERROR MESSAGES E1020c The parameter is NULL pointer Cause An incorrect parameter is described in a function User Action Describe a correct parameter Function All functions that include a pointer type parameter E1020d The function xxxx can not set in UOxxx dll Cause This function was described in UOxxx dll User Action Use it in UPxxx dll Function All functions described in section 4 1 1020 function not set in UPxxx dll Cause This function was described in UPxxx dll User Action Use it in UOxxx dll Function All functions described in section 4 2 E1020f The function xxxx does
88. tion to receive a signal from Function Parameter sig Specifies the receive signal ID 0 USBreset 1 Resume Return value None Remarks This function is supported only for devices that include USB function User s Manual U14873EJ2VOUM 75 CHAPTER 5 OPERATIONS DURING CPU RESET This chapter describes the operations of custom parts when a CPU reset is triggered by the simulator debugger 5 1 Parts Customized via Parts Window The parts for functions that are specified by customization via the Parts window are listed below Table 5 1 Parts Customized via Parts Window During CPU Reset Part Name Status Push button All are set to inactive mode Toggle button All are set to inactive mode Group select button All are set to non pressed mode LED All are set to inactive mode LED set per port All are set to inactive mode Matrix LED All are set to OFF mode DC motor All are set to inactive mode and total active time is set to 0 Stepping motor All are set to inactive mode and the number of positive revolutions the number of negative revolutions and rotation angle are all set to 0 Vertical scroll bar analog input Input value is set to 0 and scroll bar s scroll button is set to the bottom edge Serial pin data input Returns to start of data 5 2 Parts Customized via User Window When a CPU reset has been triggered by the simulator debugger if the function name has already been
89. ut Renesas Electronics does not warrant that such information is error free Renesas Electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein Renesas Electronics products are classified according to the following three quality grades Standard High Quality and Specific The recommended applications for each Renesas Electronics product depends on the product s quality grade as indicated below You must check the quality grade of each Renesas Electronics product before using it in a particular application You may not use any Renesas Electronics product for any application categorized as Specific without the prior written consent of Renesas Electronics Further you may not use any Renesas Electronics product for any application for which it is not intended without the prior written consent of Renesas Electronics Renesas Electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for an application categorized as Specific or for which the product is not intended where you have failed to obtain the prior written consent of Renesas Electronics The quality grade of each Renesas Electronics product is Standard unless otherwise expressly specified in a Renesas Electronics data sheets or data books etc Standard Computers offi
90. utput 2 pins Return value None Example static char out1 4 p30 p31 p32 p33 static char out2 4 p24 p25 p26 p27 UpMtxLed char out1 char out2 4 4 HIGH HIGH Figure 4 7 Matrix LED Function Output 1 Pin names are not shown p30 p31 p32 p33 p27 26 Output2 p25 p24 User s Manual U14873EJ2VOUM 35 CHAPTER 4 FUNCTION REFERENCE DC motor function void UpDcMtr pname actype mtrname char pname Pin name int actype Active high low char mtrname Function name Function This function creates a DC motor icon An active bitmap is displayed when the specified pin becomes active and the inactive bitmap is displayed when the specified pin is inactive This function also displays the total active time that has elapsed since the start of a simulation The displayed time is based on the main system clock When a reset occurs or when the elapsed time value exceeds a 10 digit decimal value the displayed time is cleared to zero Parameters pname Specifies the pin name as a character string actype Specifies the status when the motor is displayed as active Specify HIGH for active high status or LOW for active low status mtrname Specifies the DC motor function s name This function name is shown under the motor icon Return value None Example UpDcMtr p41 HIGH Motor Figure 4 8 A
91. xternal part DLL file that is downloaded to the simulator remains valid even after the Parts window is closed The next time the Parts window is opened the same DLL file will be automatically downloaded c The name of the loaded user customized external part DLL file is added to the pull down menu under Customize menu of the Parts window d The user customized external part that is displayed in the Parts window can be relocated However the information about the relocation cannot be saved After relocation if you have performed either the following sets of operations the location of each part is neither saved nor completed Therefore be sure to locate each part again f the status is saved to a project file xxxx prj or to a file to which display information for the Parts window is to be saved xxxx pnl and then these files are read f the Parts window is closed while customized external part DLL information remains loaded and then the Parts window is opened again 2 2 Unload Operation steps 1 Select Customize menu gt Unload from the menu bar in the Parts window 2 This unloads removes all of the customized external part DLLs that are currently loaded in the simulator Parts that have been created by the Parts window s customization function are deleted from the Parts window Also if there are any programs that have been customized via a user window the user window is closed User s Manual U14873EJ2VOUM 17 CHAP

Download Pdf Manuals

image

Related Search

Related Contents

Sistema JKAL3GARA  NUVITA BOTTLEWARMER 1160  三浦達司教授 略歴および研究業績  Fujitsu Presenter USB III  GN 9120 DG MODE D`EMPLOI  OpenWay Tools v3.51 User Guide - Coalition to Stop Smart Meters  取扱説明書  露店等の自主チェック表 【PDFファイル:236KB】  取 扱 説 明 書 - メニコン・ライフサイエンス    

Copyright © All rights reserved.
Failed to retrieve file