pittom said:
Rossw would it be possible to give an example of storing 3,10-bit numbers in one memory by shifting please
Sure. There are so many different ways of doing it, I'll present a couple of alternatives.
If you have an older firmware without shift/rotate, here's a way of doing it with straight multiply/divides. This is brute-force ugly, but functional.
T1, T2, H1 packed into VAR2 (in decades, so you can visualize them without needing to calculate anything)
START
MUL T1 1000000 var2
MUL T2 1000 RAM1
ADD RAM1 H1 ram1
add ram1 var2 var2 # VAR2 encoded with 111222hhh (1=T1, 2=T2, h=Humidity)
DIV VAR2 1000000 VAR8 # for the purposes of demonstration, we'll extract just T1 into VAR8
DIV VAR2 1000000 RAM1 # for demonstration, decode just T2 into VAR7
MUL RAM1 1000000 RAM1
SUB VAR2 RAM1 ram1
DIV RAM1 1000 VAR7
DIV VAR2 1000 RAM1 # and finally H1 into VAR6
MUL RAM1 1000 ram1
SUB VAR2 RAM1 VAR6
END
32 Bit Signed Vars
0 138140065 0 0 0 65 140 138
Temperature Sensors
13.8 C 14.0 C unbound unbound unbound unbound unbound unbound
Humidity Sensor
65 %