Set event breakpoint. First parameter specifies type of event. See general description of event breakpoints above about meaning of event identifiers. Second parameter specify if the breakpoint will be fix (f) or dynamic (d). Third parameter specifies address. Remember that this is not an instruction address, it is address of the memory cell where specified event should occur.
Forth parameter is optional and it specifies the hit number. It is 1 by default.
$ s51 remoansi.hex ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt. ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. 58659 bytes read from remoansi.hex > dis 00d47e 22 RET 000000 02 01 60 LJMP 0160 000160 c2 90 CLR P1.0 000162 c2 97 CLR P1.7 000164 d2 b5 SETB P3.5 000166 d2 b4 SETB P3.4 000168 75 81 22 MOV SP,#22 00016b 75 d0 00 MOV PSW,#00 00016e 7e 00 MOV R6,#00 000170 7f 00 MOV R7,#00 000172 79 04 MOV R1,#04 000174 12 0d b8 LCALL 0db8 000177 0f INC R7 000178 d9 fa DJNZ R1,0174 00017a 75 0b 00 MOV 0b,#00 00017d 75 0c 00 MOV 0c,#00 000180 02 02 2a LJMP 022a 000183 78 22 MOV R0,#22 000185 76 00 MOV @R0,#00 000187 d8 fc DJNZ R0,0185 > bse wi f 6 > g 4 000170 7f 00 MOV R7,#00 >
Delete event breakpoint. First parameter must be given to specify type of event. Second parameter is address of memory cell which the breakpoint is associated to. Continuing example given above:
> bl D 2(2) 000180 02 LJMP 022a F 1(1) 000006 wi > bde ri 6 No ri breakpoint at 000006 > bde wi 6 > bl D 2(2) 000180 02 LJMP 022a >
Delete all breakpoints. This command deletes all fetch as well as event breakpoints. Be carefull because it does not ask you to confirm your intention.
> bl F 1(1) 000160 c2 CLR P1.0 D 2(2) 000180 02 LJMP 022a F 1(1) 000006 wi > ba > bl >
Dump out ports. This command shows actual value of ports.
$ s51 remoansi.hex ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt. ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. 58659 bytes read from remoansi.hex > sopt stopit 1 > g 5 * 000023 02 01 1c LJMP 011c > dp P0 11111111 0xff 255 . P1 11111110 0xfe 254 . Pin0 11111111 0xff 255 . Pin1 11111111 0xff 255 . Port0 11111111 0xff 255 . Port1 11111110 0xfe 254 . P2 11111111 0xff 255 . P3 11111111 0xff 255 . Pin2 11111111 0xff 255 . Pin3 11111111 0xff 255 . Port2 11111111 0xff 255 . Port3 11111111 0xff 255 . >First lines on the list (labelled with Px) are value of SFRs which are internal latch registers. Second lines (labelled with Pinx) are outputs of external devices connected to port pins of the microcontroller. These values can be set by you using sp command. Third lines (labelled with Portx) show actual values can be measured on pins of the device. These values are calculated with following pseudo formula:
Portx= Px AND Pinx
All three values are displayed in binary, hexadecimal, decimal form and then the ASCII character of the value is shown.
$ s51 remoansi.hex ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt. ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. 58659 bytes read from remoansi.hex > sopt stopit 1 > g 5 * 000023 02 01 1c LJMP 011c > ds 000080 ff 2a ba 16 00 00 00 00 55 a1 d7 fe 50 fd 00 00 .*......U...P... 000090 fe 00 00 00 00 00 00 00 7e 00 00 00 00 00 00 00 ........~....... 0000a0 ff 00 00 00 00 00 00 00 97 00 00 00 00 00 00 00 ................ 0000b0 ff 00 00 00 00 00 00 00 15 00 00 00 00 00 00 00 ................ 0000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000e0 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > ds p1 0x87 P1 fe 254 . 000087 00 0 . > ds p2 ip scon P2 ff 255 . IP 15 21 . SCON 7e 126 ~ >If you specify one or more parameter the ds command prints out value of registers specified by parameters. Parameter can be an address or a symbolic name of the register. Note that the simulator implements a register at all address in the address space which is not true in real microcontroller where reading of an unimplemented register gets undefined value. Value of the registers printed out in hexadecimal, decimal, and ASCII form.
Note that different type of controllers can implement different registers:
$ s51 ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt. ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. > ds rcap2l > q $ s51 -t 52 ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt. ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. > ds rcap2l RCAP2L 00 0 . >
$ s51 ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt. ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. > db it1 0x20.3 0x43 p2.5 000088 IT1 0 000020 20.3 0 000028 28.3 0 0000a0 P2.5 1 >Value of bits are printed out one per line. The list starts direct address of the bit followed by bit name or address of the memory cell or SFR which contains the displayed bit and bit number within the byte separated by a dot. At last the value of the bit is shown. Displaying a port bit you get value of SFR latch:
> sp 1 0x0f > ss p1 0x55 000090 55 U > dp P0 11111111 0xff 255 . P1 01010101 0x55 85 U Pin0 11111111 0xff 255 . Pin1 00001111 0x0f 15 . Port0 11111111 0xff 255 . Port1 00000101 0x05 5 . P2 11111111 0xff 255 . P3 11111111 0xff 255 . Pin2 11111111 0xff 255 . Pin3 11111111 0xff 255 . Port2 11111111 0xff 255 . Port3 11111111 0xff 255 . > db p1.2 p1.3 p1.4 p1.5 p1.6 000090 P1.2 1 000090 P1.3 0 000090 P1.4 1 000090 P1.5 0 000090 P1.6 1 >
Go, start execution. Parameters are optional. First parameter specifies start address of the execution. By default execution starts at address specified by actual value of the PC. This can be overridden by first parameter. If second parameter is specified it places a dynamic breakpoint at specified address which stops the execution. If stop address is not given the simulator stops if it reaches a breakpoint, or the CPU accepts an interrupt and stopit option is TRUE, or fatal error occurres or stop command is used. Note that first instruction is executed without effect of breakpoints. It means that if there is a breakpoint at start address then it will not be hit.
$ s51 remoansi.hex ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt. ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. 55755 bytes read from remoansi.hex > b 0x187 > sopt stopit y > g Simulation started, PC=0x000000 Stop at 000187: (4) Breakpoint F 000187 >After execution is started the Simulation started message appears with value of PC where the execution started and the simulator is ready to accept other commands while the simulation is running in background.
Searching for specified string in internal RAM area. String is interpreted from first non-space character until end of the command including spaces. wi command makes case insensitive search and Wi can be used to make case sensitive search. Result is a hexa dump of memory areas that match with specified string. Most of C-style escape sequences can be used in the string: \f, \n, \r, \t, \v, \a, \b, \0, and \0xxx where xxx is an octadecimal number of the code of the character.
$ s51 remoansi.hex ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt. ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. 58659 bytes read from remoansi.hex > g Simulation started, PC=0x000000 Stop at 00019c: (7) User stopped F 00019c > si 20 Dani DAni 000014 44 61 6e 69 44 41 6e 69 DaniDAni > wi dani 000014 44 61 6e 69 Dani 000018 44 41 6e 69 DAni > Wi Dani 000014 44 61 6e 69 Dani > wi dani\0 000018 44 41 6e 69 00 DAni. >
Search commands. These commands are similar to wi, Wi commands the only difference is that wx,Wx are used to search for a string in external memory.
Search commands. These commands are similar to wi, Wi commands the only difference is that wx,Wx are used to search for a string in code memory area.
Get actual value of option(s). Some options can be set by sopt to modify behavior of the simulator. Using gopt you can get actual value of these options. If you use this command without parameter you get list of all options known by the program. In this way you can figure out which options can be used.
$ s51 -V ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt. ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. > gopt verbose TRUE Verbose flag. stopit FALSE Stop if interrupt accepted. debug FALSE Debug flag. > gopt stopit stopit FALSE Stop if interrupt accepted. >This version of the simulator knows about three options. First element of the list is name of the option (verbose, debug and stopit). This name can be used to identify the option in gopt and sopt command. Second element of the list is the value of the option. In this case type of both options is boolean, their value can be TRUE or FALSE. Third element is a short description of the option.
Set option value. Options described at previous command (gopt) can be set using this command. First parameter must be an option name and second the new value. Interpretation of the value depends on type of the option. Value for a boolean type of option interpreted as follows: if first character of the value is one of 1, t, T, y, Y then value will be TRUE otherwise it will be FALSE.
$ s51 -V ucsim 0.2.24, Copyright (C) 1997 Daniel Drotos, Talker Bt. ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. > gopt verbose TRUE Verbose flag. stopit FALSE Stop if interrupt accepted. debug FALSE Debug messages appears on this console. > sopt debug t > gopt verbose TRUE Verbose flag. stopit FALSE Stop if interrupt accepted. debug TRUE Debug messages appears on this console. >
Write data into internal RAM area. First parameter specifies start address of memory area to set and other parameters are data to set.
$ s51 ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt. ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. > si 10 dani\040hej-ho 00000a 64 61 6e 69 20 68 65 6a 2d 68 6f dani hej-ho >Result of the command is a memory dump of area which has been modified by the command. If there is syntax error in a data parameter then remaining parameters are dropped out.
> si 20 1 2 0xi 3 4 Bad data 0xi 000014 01 02 .. >
This command is similar to si command described above but it is used to modify external RAM.
This command is similar to si command described above but it is used to modify code memory area (ROM).
This command is similar to si command described above but it is used to modify SFR. Other difference is that first parameter (start address) can be specified by name of SFR not by address only.
$ s51 ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt. ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. > ss p1 0 000090 00 . >
Modify bit(s). First parameter is address of first bit to modify. See description of db command how bit address can be specified. If first character of data parameter is 0 it means zero otherwise it means one.
$ s51 ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt. ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. > sb 0x23.5 1 > db 0x23.5 000023 23.5 1 > sb p3.3 0 > dp P0 11111111 0xff 255 . P1 11111111 0xff 255 . Pin0 11111111 0xff 255 . Pin1 11111111 0xff 255 . Port0 11111111 0xff 255 . Port1 11111111 0xff 255 . P2 11111111 0xff 255 . P3 11110111 0xf7 247 . Pin2 11111111 0xff 255 . Pin3 11111111 0xff 255 . Port2 11111111 0xff 255 . Port3 11110111 0xf7 247 . > sb tr1 0 > db tr1 000088 TR1 0 > sb tr1 1 > db tr1 000088 TR1 1 >
This command can be used to set up output values of external circuits connected to port pins. If a port bit is used as output to drive external circuits, do not set corresponding pin bit to zero because read back value of the port can be false. First parameter must be number of the port between 0 and 3.
$ s51 ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt. ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. > dp P0 11111111 0xff 255 . P1 11111111 0xff 255 . Pin0 11111111 0xff 255 . Pin1 11111111 0xff 255 . Port0 11111111 0xff 255 . Port1 11111111 0xff 255 . P2 11111111 0xff 255 . P3 11111111 0xff 255 . Pin2 11111111 0xff 255 . Pin3 11111111 0xff 255 . Port2 11111111 0xff 255 . Port3 11111111 0xff 255 . > ss p1 0x55 000090 55 U > sp 1 0x0f > dp P0 11111111 0xff 255 . P1 01010101 0x55 85 U Pin0 11111111 0xff 255 . Pin1 00001111 0x0f 15 . Port0 11111111 0xff 255 . Port1 00000101 0x05 5 . P2 11111111 0xff 255 . P3 11111111 0xff 255 . Pin2 11111111 0xff 255 . Pin3 11111111 0xff 255 . Port2 11111111 0xff 255 . Port3 11111111 0xff 255 . >
Fill command. It can be used to fill up an area of internal RAM with a specified data.
$ s51 ucsim 0.2.12, Copyright (C) 1997 Daniel Drotos, Talker Bt. ucsim comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. > fi 11 0x34 44 > di 000000 00 00 00 00 00 00 00 00 ........ 000008 00 00 00 2c 2c 2c 2c 2c ...,,,,, 000010 2c 2c 2c 2c 2c 2c 2c 2c ,,,,,,,, 000018 2c 2c 2c 2c 2c 2c 2c 2c ,,,,,,,, 000020 2c 2c 2c 2c 2c 2c 2c 2c ,,,,,,,, 000028 2c 2c 2c 2c 2c 2c 2c 2c ,,,,,,,, 000030 2c 2c 2c 2c 2c 00 00 00 ,,,,,... 000038 00 00 00 00 00 00 00 00 ........ 000040 00 00 00 00 00 00 00 00 ........ 000048 00 00 00 00 00 00 00 00 ........ >
Fill command. It works similar to fi but it puts data into external RAM instead of internal RAM.
Fill command. It works similar to fi but it puts data into SFR instead of internal RAM.
Fill command. It works similar to fi but it puts data into code memory (ROM) instead of internal RAM.