The syntax of the "@" command is:
@[[ ]address]
where "address" is the optional FLASH address of the subroutine to CALL
Notes:
No distinction is made between uppercase and lowercase.
There is no need to be logged in to execute a Sequencer Step command.
Login is required to specify a subroutine address to CALL.
The called address is NOT checked for validity.
The purpose of this command is simply to CALL a subroutine from the
command line. It accepts no parameters. Its main use is for testing
and debugging.
If an address is NOT specified AND a valid sequencer configuration is already
loaded, that sequencer service routine is called. By "not specified", simply
an "@" with NOTHING following it is meant. There cannot be a space, or a
semicolon to start a comment, or anything else after the '@' character - just
the '@' character alone as the command.
If an address is specified, the system must be in Manager or Administrative
mode, which could be toggled at the start of that very command line. So,
one could say that another form of the command would be "$@ address", where
the '$' toggles the Manager mode immediately but its display suppressed.
The address is placed in R31:R30 and an ICALL is executed. The address is
NOT checked. The reason is simple: if address 0x7000 (for devices
based on the 328P MCU, 0x1E000 for the 1284P, 0x3E000 for the 2560) were
checked, it would return the value 0xFFFF, since it is in the system memory
area. That would prevent a system reboot from being executed using this
command.
A reboot, using the specified address method, is the first example:
>@ 0x7000 ; Not logged in, so the command is ignored
> ; Type a '$' as the first character and ENTER (it does not display)
m>@ 0x7000
Copyright, 2013-2021, SCADA Support Group, Inc.
Sonoma, CA 95476 ###.###.####
MIRTOS for 16 MHz Arduino Pro Mini
Version 3.01 - Monday, March 28, 2022
Serial Number: #########
Cause of the last reset: (no MCUSR bit was set)
>>>>>
> ; The line above shows that the initialization script ran
> ; Another way to issue a reboot command:
>@ 0x7000 ; A hidden '$' preceeded the '@' on this line
Copyright, 2013-2021, SCADA Support Group, Inc.
Sonoma, CA 95476 ###.###.####
MIRTOS for 16 MHz Arduino Pro Mini
Version 3.01 - Monday, March 28, 2022
Serial Number: #########
Cause of the last reset: (no MCUSR bit was set)
>>>>>
MIRTOS Version 3.01 comes preloaded with a group of example subroutines.
The first six, ToggleDIOs, (at FLASH
addresses 0x3800, 0x3804, 0x3808, 0x380C, 0x3810, and 0x3814 in the 328P,
which correspond to addresses 0x0F000, 0x0F004, 0x0F008 ... 0x0F014 in
either the 1284P or 2560) allow any one of the Discrete Outputs to be
toggled with a single CALL. The seventh
subroutine calculates and displays the power coming into the MCU, in
Engineering Units, based on Analog Input 8. This second example
demonstrates how to use the '@' command to CALL them:
> ; Login with the '$' as the first character on the line
m>DP+ 0x3800 80 ; First verify that they are both present
FLASH (program memory) contents:
3800: 80 E2 09 C0 81 E2 07 C0-82 E2 05 C0 83 E2 03 C0 ................
3810: 84 E2 01 C0 85 E2 28 2F-E4 E7 0E 94 00 00 ED E7 ......(/........
3820: 0E 94 00 00 68 2F 61 50-82 2F ED E7 01 D0 E5 E7 ....h/aP./......
3830: 0C 94 00 00 FF FF FF FF-FF FF FF FF FF FF FF FF ................
3840: 88 E0 EA E0 0E 94 00 00-ED E7 0E 94 00 00 9C 01 ................
m>@ 0x3800 ; Toggle DIO(0) on
m>DS+ 0x26 3 ; Another way: check MCU Registers PINC, DDRC, and PORTC
SRAM contents:
0020: 01 3F-01 .?.
m>@ 0x3804 ; Toggle DIO(1) on
m>@ 0x3808 ; Toggle DIO(2) on
m>@ 0x380C ; Toggle DIO(3) on
m>D+S 0x26 3 ; Display the PINC, DDRC and PORTC stata again
SRAM contents:
0020: 0F 3F-0F .?.
m>@ 0x3800 ; Call to deenergize DIO(0)
m>@ 0x3804 ; Call to deenergize DIO(1)
m>@ 0x3808 ; Call to deenergize DIO(2)
m> ; Logout, using '$'
>D+S 38 3 ; Display the 3 Port C Registers
SRAM contents:
0020: 08 3F-08 .?.
>@ 0x380C ; Attempt to deenergize DIO(3)
>D+S 38 3 ; Verify that it didn't change; logout prevented ICALL
SRAM contents:
0020: 08 3F-08 .?.
> ; Login again, using '$'
m>@ 0x380C ; Repeat the call to deenergize DIO(3)
m>DS+ 38 3 ; Verify that it did deenergize this time
SRAM contents:
0020: 00 3F-00 .?.
m>
m> ;---------- Test the Vcc display subroutine:
m>
m>@0x3840 ; Can omit space between @ and the subroutine address
5.02 Volts
m>@ 0x3840 ; Single space
5.02 Volts
m>@ 0x3840 ; Multiple spaces
5.02 Volts
m> ; Logout, using '$'
>@ 0x3840 ; Try to call it again after logging out
>
> ; No response indicates that the subroutine was not called
>
There are some example task sequencer configurations which come with MIRTOS
Version 3.01 that change the colors of 240 WS2812 GRB LEDs. This third
example uses the task sequencer Mode 8 and single steps it. The number of
LEDs configured is changed below from 240 to 8, however. The "P?" command
will display as many as are configured.
>DV+ ; Verify that no sequencer configuration is loaded
SRAM contents:
0280: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
0290: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
>R ; Display the Registers
10 32 54 76 98 1110 1312 1514 1716 1918 2120 2322 2524 2726 2928 3130
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
0000 07AA 091C 1C28-0004 0000 0000 0000-0001 3165 521D 2020-2020 0230 0280 3165
>DE 0x180 16 ; Display a WS2812 configuration in EEPROM
EEPROM contents:
>0180: 08 E2 3C 02 FF F0 00 78-78 78 78 00 1E 00 FF FF ..<....xxxx.....
>P@ 0x180 ; Validate and load the sequencer config at EEPROM 0x0180
>R ; Verify the sequencer configuration was loaded
10 32 54 76 98 1110 1312 1514 1716 1918 2120 2322 2524 2726 2928 3130
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
0000 006A 0938 3828-0004 0180 0241 0000-0021 3165 5235 2020-2020 0230 0280 3165
> ; The Registers show R11:R10 = 0x0180 and R13:R12 = 0x0241, which
> ; means that the FLASH WORD address = 0x241 (so, * 2 = 0x482) which
> ; is the PROGRAM address of the service routine found, verified,
> ; copied, and loaded for sequence type = 8 (in SRAM 0x280)
>DV+ ; Verify that uVars.B[0] to [15] are now loaded
SRAM contents:
0280: 08 E2 3C 02 FF F0 00 78-78 78 78 00 1E 00 FF FF ..<....xxxx.....
0290: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
>ES 0x285 = 8 ; Change the LED count from 240 (= 0xF0 in SRAM 0x285) to 8
>DF+ 0x490 32 ; The first byte at FLASH address 0x490 is 8, so matched
FLASH (program memory) contents:
0490: 08 07 E0 E0 B5 DD 3C DE-43 E0 50 E0 2F 01 60 81 ......<.C.P./.`.
04A0: 60 30 21 F0 6D 19 08 F4-60 E0 53 95 61 93 4A 95 `0!.m...`.S.a.J.
>P?+ ; Display the Pixel Data array (on the HEAP); it's unused
SRAM contents:
02A0: 00 00 ..
>@
>p?+ ; Pixel Data array was initialized with 3*8 = 0x18 data bytes
SRAM contents:
02A0: 18 00 23 30 1F 12 42 69-CE 33 29 07 C4 49 FF B4 ..#0..Bi.3)..I..
02B0: F7 38 4D B2 88 44 BE 71-82 48 .8M..D.q.H
> ; The WORD at 0x2A0 is the byte count = 8 LEDs * 3 data bytes each
> ; The WORD count will remain constant throughout the steps
>@
>P+? ; Notice that all the other bytes decrease by 2 each step
SRAM contents:
02A0: 18 00 21 2E 1D 10 40 67-CC 31 27 05 C2 47 FD B2 ..!...@g.1'..G..
02B0: F5 36 4B B0 86 42 BC 6F-80 46 .6K..B.o.F
>@
>p+? ; Recall that '@' alone single steps
SRAM contents:
02A0: 18 00 1F 2C 1B 0E 3E 65-CA 2F 25 03 C0 45 FB B0 ...,..>e./%..E..
02B0: F3 34 49 AE 84 40 BA 6D-7E 44 .4I..@.m~D
>@
>p+?
SRAM contents:
02A0: 18 00 1D 2A 19 0C 3C 63-C8 2D 23 01 BE 43 F9 AE ...*...k|B
>@
>P?+
SRAM contents:
02A0: 18 00 1B 28 17 0A 3A 61-C6 2B 21 00 BC 41 F7 AC ...(..:a.+!..A..
02B0: EF 30 45 AA 80 3C B6 69-7A 40 .0E..<.iz@
>@
>P+? ; The GREEN component of the 4th LED is holding at zero
SRAM contents:
02A0: 18 00 19 26 15 08 38 5F-C4 29 1F 00 BA 3F F5 AA ...&..8_.)...?..
02B0: ED 2E 43 A8 7E 3A B4 67-78 3E ..C.~:.gx>
> ; Login to show that single-step the call still works
m>@
m>P?+
SRAM contents:
02A0: 18 00 17 24 13 06 36 5D-C2 27 1D 00 B8 38 F3 A8 ...$..6].'...8..
02B0: EB 2C 41 A6 7C 38 B2 65-76 3C .,A.|8.ev<
m>@
m>P?+
SRAM contents:
02A0: 18 00 15 22 11 04 34 5B-C0 25 1B 00 B6 36 F1 A6 ..."..4[.%...6..
02B0: E9 2A 3F A4 7A 36 B0 63-74 3A .*?.z6.ct:
m>
Sequencer Mode 8, used above, is called "DimDown". It causes each color
of the LED "triplet" (i.e., the GREEN, RED, and BLUE intensity bytes) to
decrease by the specific amount (in this case 2) until all 3 reach zero.
The LED then appears to be OFF, at which time a new color is loaded into
that LED triplet.
See also:
The Pixel command and
the Sequencer documentation.