E or E[B|L|W][S|R] ### op ##[ ## ...]|[M|S] or E[S|R] = "string" or EC[F|P|R|S] ### ### ### or EI[F|P|R|S] ### ### ### or EF[R|S]] ### # ### or EZ[R|S]] ### ### or where "B" selects signed BYTE input (the default if unspecified), "W" selects signed WORD (2-byte) signed integer input, "L" selects signed LONG (4-byte) signed integer input, "F" or "P" selects FLASH (or PROGRAM) memory data source, "R" or "S" selects RAM or SRAM, "M" is the system milliseconds value, "S" in data entry context, is the system seconds value, "EC" copies to EEPROM from either FLASH or SRAM, "EI" initializes an SRAM range, copying from either FLASH or SRAM, "EF" fills one or more BYTEs in either EEPROM or SRAM with a constant, "EZ" fills one or more BYTEs in either EEPROM or SRAM with zeros, and ### are pointers (addresses in EEPROM, FLASH or SRAM as appropriate), ## are byte counts (with a general limit of 1,203), # are numeric values (0 to 255, 0x0 to 0xFF, -1 to -254), op is the operator, which applies to the remainder of the line; it can be: "=" to simply assign, or write, the new value(s) to the location(s) "+=" to add to the prior value(s) "-=" to subtract from the prior value(s) "&=" to bitwise AND with the prior value(s) "|=" to bitwise OR with the prior value(s) "^=" to bitwise XOR with the prior value(s) "v=" to bitwise MASK OFF with the prior value(s) (same as "!=" or "~=") ">=" to rotate all bits right by bit count "<=" to rotate all bits left by bit countNotes:
The first group is the simplest "Edit" command set which change the values in EEPROM:
"E ## = #[ # ...] byte address [op]= #[, optional additional values ...] "EB ## = #[ # ...] byte address [op]= #[, optional additional values ...] "EW ## = #[ # ...] word address [op]= #[, optional additional values ...] "EL ## = #[ # ...] long address [op]= #[, optional additional values ...]The second group is the same, except the destination is SRAM instead of EEPROM (and will also accept "ER" for "RAM" in place of "ES" for SRAM):
"ES ## = #[ # ...] byte address [op]= #[, optional additional values ...] "ESB ## = #[ # ...] byte address [op]= #[, optional additional values ...] "ESW ## = #[ # ...] word address [op]= #[, optional additional values ...] "ESL ## = #[ # ...] long address [op]= #[, optional additional values ...]The "EC" command is the "Copy" version, with the destination ALWAYS being EEPROM, but the source of the copy varies with the optional letter after the 'C' as shown here:
"EC ### ### ###" *ptrToEEPROM *ptrFromEEPROM count (or "ECE") "ECF ### ### ###" *ptrToEEPROM *ptrFromFLASH count (or "ECP") "ECS ### ### ###" *ptrToEEPROM *ptrFromSRAM count (or "ECR")The "EI" command is the "Initialize" set, with the destination ALWAYS being SRAM, but the source of the initialization (or copying) varies with being the optional letter after the 'I' as shown here:
"EI ### ### ###" *ptrToSRAM *ptrFromEEPROM count "EIF ### ### ###" *ptrToSRAM *ptrFromFLASH count (or "EIP") "EIS ### ### ###" *ptrToSRAM *ptrFromSRAM count (or "EIR")The "EF" command set is to "Fill" a portion of memory with the same value. The destination can be either EEPROM or SRAM, but the last two parameters are the data value and the number of bytes to be filled (with the same BYTE value in each location):
"EF ### # ###" *ptrToEEPROM value count "EFS ### # ###" *ptrToSRAM value count (or "EFR")The "EZ" command is actually the "Zero" version of "EF" above, with the value set to zero and only the number of bytes needs to be specified:
"EZ ### ###" *ptrToEEPROM count "EZS ### ###" *ptrToSRAM count (or "EZR")It may simplify memorization to note that the destination is ALWAYS the first parameter and if there is a count, it is ALWAYS the last parameter.
In the following examples, assume that the memory block starting at SRAM address 0x700 and the next 79 bytes after that point are not in use. To make sure that is true, enter "E 1 = 1". This will turn off all of the Automatic features except the Analog to Discrete conversions.
Now try some basic data input:> DS+ 0x700 80 SRAM contents: 0700: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 0710: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 0720: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 0730: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 0740: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ >
Before going on, there are several things to note:> ES 0x700 = 1 2 3 4 5 -1 >DS+ 0x700 32 SRAM contents: 0700: 01 02 03 04 05 FF 00 00-00 00 00 00 00 00 00 00 ................ 0710: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ >ESW 0x700 = 1 2 3 4 5 -1 0x1234 >DS+ 0x700 32 SRAM contents: 0700: 01 00 02 00 03 00 04 00-05 00 FF FF 34 12 00 00 ............4... 0710: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ >ELS 0x700 = 1 2 3 4 5 >DS+ 0x700 32 SRAM contents: 0700: 01 00 00 00 02 00 00 00-03 00 00 00 04 00 00 00 ................ 0710: 05 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ >ESL 0x700 = 1000 2000 3000 4000 5000 -1 -2 >D+S 0x700 32 SRAM contents: 0700: E8 03 00 00 D0 07 00 00-B8 0B 00 00 A0 0F 00 00 ................ 0710: 88 13 00 00 FF FF FF FF-FE FF FF FF 00 00 00 00 ................ >? 1000 0x3E8 >
Data are stored in "little-endian" order, that is, with the Low-Order (or Least Significant Byte, or LSB) first. | |
The same operation is carried out, based on the operator ('=' above.) | |
Values will continue to be entered in sequential memory locations until the command is ended with "ENTER". | |
The number of bytes each variable uses depends on the size (i.e., BYTE, or WORD, or LONG), of the values being entered. | |
The default data entry size is BYTE, unless specified otherwise. | |
Negative or hexadecimal values ("0x" prefix) may be entered. | |
Byte order before the first space is not important, so "ELS" and "ESL" have the same meanings (as do "DS+" and "D+S", by the way. |
Proceeding with some further examples:
The things to notice about the examples above:> EFS 0x700 1 30 >DS+ 0x700 32 SRAM contents: 0700: 01 01 01 01 01 01 01 01-01 01 01 01 01 01 01 01 ................ 0710: 01 01 01 01 01 01 01 01-01 01 01 01 01 01 00 00 ................ >ES 0x700 += 1 2 3 4 5 6 xab 7 8 9 >DS+ 0x700 32 SRAM contents: 0700: 02 03 04 05 06 07 01 01-01 01 01 01 01 01 01 01 ................ 0710: 01 01 01 01 01 01 01 01-01 01 01 01 01 01 00 00 ................ >ES 0x708 |= 0x80 0x7F 0x7E -1 -4 >DS+ 0x700 32 SRAM contents: 0700: 02 03 04 05 06 07 01 01-81 7F 7F FF FD 01 01 01 ................ 0710: 01 01 01 01 01 01 01 01-01 01 01 01 01 01 00 00 ................ >ESW 0x710 1 2 >DS+ 0x700 32 SRAM contents: 0700: 02 03 04 05 06 07 01 01-81 7F 7F FF FD 01 01 01 ................ 0710: 01 01 01 01 01 01 01 01-01 01 01 01 01 01 00 00 ................ >ERW 0x710 -= 1 2 >DR+ 0x700 32 SRAM contents: 0700: 02 03 04 05 06 07 01 01-81 7F 7F FF FD 01 01 01 ................ 0710: 00 01 FF 00 01 01 01 01-01 01 01 01 01 01 00 00 ................ERL 0x714 <= 1 2 4 >DR+ 0x700 0032 SRAM contents: 0700: 02 03 04 05 06 07 01 01-81 7F 7F FF FD 01 01 01 ................ 0710: 00 01 FF 00 02 02 02 02-04 04 04 04 10 10 00 00 ................ >
The first invalid entry ("xab" instead of "0xab") ends the sequential data entry, but valid entries before that point are still accepted. | |
The "+=" operator adds to the prior value, in the same way which it is used within the "C" programming language. | |
The "|=" (inclusive OR) operator can work with negative numbers. | |
Without an operator (the "ESW 0x710 1 2"), no data are changed. | |
"ER" is the same as "ES" and "DR" is the same as "DS". | |
Subtraction also works with WORD and LONG operands (WORD here, with the examples: 0x0101 - 1 = 0x0100 and 0x0101 - 2 = 0x00FF). | |
Leading zeros are parsed correctly; in effect, they're just ignored. |
The bit-shifting operators also accept WORD and LONG operands (LONG here with the examples: 0x01010101 <= 1 is 0x02020202, 0x01010101 <= 2 is 0x04040404 and 0x00000101 <= 4 is 0x00001010). |
Here is a set of character string examples:
Notes for the example above:> EZS 0x700 29 >DS+ 0x700 - 0x72F SRAM contents: 0700: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 0710: 00 00 00 00 00 00 00 00-00 00 00 00 00 10 00 00 ................ 0720: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ >ES 0x710 = "A test string" >EFs 0x720 2 8 >DS+ 0x700 0x30 SRAM contents: 0700: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 0710: 41 20 74 65 73 74 20 73-74 72 69 6E 67 00 00 00 A test string... 0720: 02 02 02 02 02 02 02 02-00 00 00 00 00 00 00 00 ................ >Eis 0x708 0x710 16 >d+s 0x700 48 SRAM contents: 0700: 00 00 00 00 00 00 00 00-41 20 74 65 73 74 20 73 ........A test s 0710: 74 72 69 6E 67 00 00 00-74 72 69 6E 67 00 00 00 tring...tring... 0720: 02 02 02 02 02 02 02 02-00 00 00 00 00 00 00 00 ................ >EIR 0x710 0x708 30 >? 0x700 1792 >D+r 1792 0x30 SRAM contents: 0700: 00 00 00 00 00 00 00 00-41 20 74 65 73 74 20 73 ........A test s 0710: 41 20 74 65 73 74 20 73-74 72 69 6E 67 00 00 00 A test string... 0720: 74 72 69 6E 67 00 00 00-02 02 02 02 02 02 00 00 tring........... >DS+ 0x6C0 64 SRAM contents: 06C0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 06D0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 06E0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 06F0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ >ES 0x6C0 = "'String 1'" >ES 0x6D0 = '"String 2"' >ES 0x6E0 = "String 3' >ES 0x6F0 = 'String 4" >DS+ 0x6C0 64 SRAM contents: 06C0: 27 53 74 72 69 6E 67 20-31 27 00 00 00 00 00 00 'String 1'...... 06D0: 22 53 74 72 69 6E 67 20-32 22 00 00 00 00 00 00 "String 2"...... 06E0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 06F0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ >
The first "EZS" command intentionally cleared 29, not 30 bytes, leaving the byte at 0x71D with a nonzero value. | |
The character string entry terminated the string entered with a NULL (or zero) byte; this is called an ASCIIz string. | |
The complete ASCIIz string entered is therefore 14, not 13, bytes in length. | |
The "EFs 0x720 2 8" filled 0x720 through 0x727 with the value 2. |
The first copy ("Eis") was from higher to lower memory, and since there was an overlap of 3 bytes, only "tring" was left at the original location but the entire original string was copied to the new location. | |
The second string copy ("EIR") was in the opposite direction (from lower to higher memory) and since there was again an overlap, the copy was performed in reverse as indicated by the "tring" and the 6 bytes of "02 02 02" so none of the data bytes were lost. | |
The '?' command can be used to do quick value conversions between hexadecimal and decimal values. | |
Addresses can also be entered in decimal (e.g., "1792") format. | |
The opening delimiter must have its matching closing delimiter. |
To demonstrate the copying with EEPROM, consider this block:
Notice that the data are returned to their original locations after having been copied both forward and reverse. The Operating System checks for any address overlap then decides whether to copy forward or reverse, in order to prevent the loss of data. Just copy. If you get your destination address (always the first address), the source address (always the second address), and the number of bytes correct, MIRTOS will handle copying correctly, so you need not consider anything about the forward and reverse copying issues.> D+E 0 0x120 EEPROM contents: 0000: 10 01 00 9F 01 01 96 FF-04 00 FF FF 28 3C 50 FF ............(.P. 0010: C0 00 3F FF 40 08 03 67-FF 15 74 FF FF FF FF FF ..?.@..g..t..... 0020: FF 64 05 FF FF 10 FF FF-FF 20 FF 20 00 30 FF FF .d....... . .0.. 0030: FF FF 06 00 FF FF FF FF-FF FF FF FF FF FF 80 16 ................ 0040: FF FF 00 31 90 00 FF FF-FF FF F0 01 90 01 B0 00 ...1............ 0050: 6E 52 46 20 50 54 58 20-63 6F 6E 66 69 67 3A 00 nRF PTX config:. 0060: 7C 3F 3F 03 34 4E 06 58-4E 30 32 00 58 4E 30 31 |??.4N.XN02.XN01 0070: 00 33 34 35 36 58 4E 30-32 00 3F 07 88 D0 07 00 .3456XN02.?..... 0080: 6E 52 46 20 50 52 58 20-63 6F 6E 66 69 67 3A 00 nRF PRX config:. 0090: 7D 00 03 03 34 4E 06 58-4E 30 32 00 58 4E 30 31 }...4N.XN02.XN01 00A0: 00 33 34 35 36 58 4E 30-32 00 3F 07 88 D0 07 00 .3456XN02.?..... 00B0: 3B 6E 52 46 20 62 6F 6F-74 75 70 20 69 6E 69 74 ;nRF bootup init 00C0: 00 45 20 31 20 7E 3D 20-33 32 00 4E 2A 2A 00 4E .E 1 ~= 32.N**.N 00D0: 44 2B 00 45 53 20 34 37-39 3D 31 32 32 00 FF FF D+.ES 479=122... 00E0: FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................ 00F0: 45 53 20 30 78 31 32 35-20 3D 20 30 78 45 30 00 ES 0x125 = 0xE0. 0100: 52 3D 30 78 37 41 00 45-20 31 20 7C 3D 20 33 32 R=0x7A.E 1 |= 32 0110: 00 FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................ >; Copying one byte lower in memory uses normal or "forward" copying: >EC 0xEF 0xF0 36 >DE+ 0xE0 - 0x11F EEPROM contents: 00E0: FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF 45 ...............E 00F0: 53 20 30 78 31 32 35 20-3D 20 30 78 45 30 00 52 S 0x125 = 0xE0.R 0100: 3D 30 78 37 41 00 45 20-31 20 7C 3D 20 33 32 00 =0x7A.E 1 |= 32. 0110: FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................ >; To copy one byte higher in memory requires copying in "reverse": >EC 0xEF 0xEE 36 >DE+ 0xE0 64 EEPROM contents: 00E0: FF FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................ 00F0: 45 53 20 30 78 31 32 35-20 3D 20 30 78 45 30 00 ES 0x125 = 0xE0. 0100: 52 3D 30 78 37 41 00 45-20 31 20 7C 3D 20 33 32 R=0x7A.E 1 |= 32 0110: 00 FF FF FF FF FF FF FF-FF FF FF FF FF FF FF FF ................ >
Lines that begin with a semicolon are treated as comments, but note also that text takes up a lot of EEPROM or PROGRAM memory.
To enable initialization scripts, staring with ";nRF bootup init" in the example above, first set the pointer WORD value at 0x4E. This is shown as "B0 00" in the example above (the last 2 data bytes at the end of the line that begins with "0040:") which is the WORD 0x00B0. Again, the ATmega is a "little-endian" processor. Point it at (i.e., "specify the address of") the first byte of the EEPROM script. Here is that bootup initialization script:
Command: Meaning: ;nRF bootup init The leading ';' makes this just a comment E 1 ~= 32 Turn off the Auto-sequencer bit in EEPROM address 1 N** Initialize and enable the default nRF24L01+ configuration ND+ Enable the default nRF24L01 debugging output ES 479=122 Display Return Address and Stack during any Register dumpTo enable auto-initialization of that boot sequence, use:
E 1 |= 128
That's enough to get started with the "Edit" or "Enter" commands. The next thing to do to gain some experience is to try some of them.