What you learn today
- Bapal, bnaal, bapzal, bnazal, bdseal, bdnsal
- There is no brXXal
The rest of the al family combines two things you already know: approximate comparisons from week 16 and device checks from week 15. On top of that there is a gap you have to know about.
Tolerance and devices
| Instruction | calls if |
|---|---|
bapal a b c target | a approximately equal to b (tolerance c relative) |
bnaal a b c target | a clearly different from b |
bapzal a c target | a practically exactly 0 |
bnazal a c target | a not practically exactly 0 |
bdseal device target | something hangs on the device |
bdnsal device target | nothing hangs on the device |
bdnsal probe noprobe # fallback mode if the probe is missing
bapal temp TARGET TOL reached # target temperature reached
bnaal temp TARGET TOL adjust # clearly off
For the tolerance everything from week 16 applies: c is relative to the larger magnitude, and with bapzal and bnazal practically only the tiny fixed limit takes effect.
There is no brXXal
The relative branches from week 16 have no al form. breqal, brltal or a jral do not exist. The chip reports UnrecognisedInstruction when saving. Calling conditionally only works with an absolute target, that is with a label. And the only unconditional call is jal.
Safe on every path
A device that is missing cannot be read. That is why a jump that skips the reading comes after the call of the fallback handling:
bdnsal probe noprobe # set the alarm
bdns probe output # and do not read
l temp probe Temperature
With NaN neither bapal nor bnaal calls in the game: NaN is neither approximately equal nor clearly different. Whoever calls “adjust” with bnaal therefore does not adjust at all on sensor failure. Guard the reading beforehand, as above with bdns.
The device variants bdseal and bdnsal take a pin or a ReferenceId, not a name. For devices on the data network the NaN check remains.
Diagram
Exercise
Task
A pipe analyzer at the boiler hangs on d0. Target: 80 °C, tolerance 1 % relative. Wall heater “Kessel”, wall light “Kessel Ziel”, flashing light “Kessel Alarm”.
- If the probe is missing: call the subroutine
noprobewithbdnsal(alarm on), heater off, read nothing. - Temperature approximately at the target: subroutine
reachedwithbapal(light on). - Clearly off: subroutine
adjustwithbnaal– it heats if it is too cold. - Default state before the calls: everything off.
Hints
Hint 1
Everything to 0 first, then bdnsal probe noprobe and bdns probe output.
Hint 2
bapal temp TARGET TOL reached_sub and bnaal temp TARGET TOL adjust.
Hint 3
adjust only needs slt heat temp TARGET and j ra.
Quiz
4 questions. You pass from 60 % – the server does the grading.
Complete the day
- Passed the simulator exercise
- Passed the quiz with at least 60 %
Without an account progress is saved in this browser only.
Report a mistake in this lesson
Please sign in to report. Sign in