SHENZHEN I/O

SHENZHEN I/O

Ver estadísticas:
Nosferatu 5 AGO 2023 a las 6:57 a. m.
Assist/Hint Needed
I'm on the second level (first conditional) feeling very stupid.

mov p0 p1 # move input to output
loop: # start loop
+teq p1 100 # conditional - when p1 is equal to 100 do :
mov 0 p1 # the next four lines just make the power go up and down each second.
slp 1
mov 100 p1
slp 1
end:

Unfortunately, I can't seem to get the conditional to proc. When I add a plus to the code, it just gets greyed out at runtime. Any hint on this? I don't want the answer.
< >
Mostrando 1-2 de 2 comentarios
vapier 6 AGO 2023 a las 9:30 p. m. 
from the datasheet:
Conditional Execution
All instructions in the MCxxxx programming language are capable of conditional execution. Prefixing an instruction with a “+” or “-” symbol will cause that instruction to be enabled or disabled by test instructions. When an instruction is disabled by a test instruction, it will be skipped and will not consume power. Instructions with no prefix are never disabled and always execute normally. All conditional instructions start in a disabled state. A test instruction must be executed to enable conditional instructions.

all `+` and `-` statements start off disabled which means you have to execute a test insn first. the only test insn you have is prefixed with a `+` which starts off disabled, so it's impossible to have it be enabled. so don't put the `+` in front of the `teq`, put the `+` in front of the statements you want to be affected by the `teq`.
Última edición por vapier; 6 AGO 2023 a las 9:31 p. m.
Nosferatu 9 AGO 2023 a las 2:23 p. m. 
Publicado originalmente por vapier:
from the datasheet:
Conditional Execution
All instructions in the MCxxxx programming language are capable of conditional execution. Prefixing an instruction with a “+” or “-” symbol will cause that instruction to be enabled or disabled by test instructions. When an instruction is disabled by a test instruction, it will be skipped and will not consume power. Instructions with no prefix are never disabled and always execute normally. All conditional instructions start in a disabled state. A test instruction must be executed to enable conditional instructions.

all `+` and `-` statements start off disabled which means you have to execute a test insn first. the only test insn you have is prefixed with a `+` which starts off disabled, so it's impossible to have it be enabled. so don't put the `+` in front of the `teq`, put the `+` in front of the statements you want to be affected by the `teq`.


Thank you for the direction!
< >
Mostrando 1-2 de 2 comentarios
Por página: 1530 50