I have access to an instrument that runs a C-style scripting language on it. It can declare and use variables or arrays of char
, int
and double
but not float
. It allows the operands of standard C logic and addition, subtraction, division and multiplication. It doesn't have useful functions such as sizeof()
and doesn't have any of the bit shift operators <<
, >>
.
I am trying to get it to send a double
value over two binary output ports. Each can be set High or low.
I was thinking that I should do this by bit-shift masking the double value using the bit-wise AND comparator. However I CAN'T do this because bit shift operators don't exist. I would then use one output port as a clock and the second as the synced data line.
For example using an input byte with value = 6 (0000 0110). The data would be output like below with X denoting the read value on the 'clock' down stroke:
*Clock, Input
* 0, 0
* 1, 0 X
* 0, 0
* 1, 1 X
* 0, 0
* 1, 1 X
* 0, 0
* 1, 0 X
* 0, 0
* 1, 0 X
* 0, 0
* 1, 0 X
* 0, 0
* 1, 0 X
* 0, 0
* 1, 0 X
* 0, 0
So I need a way of iterating through the double bit-by-bit (not sure how many bits the instrument uses for its double
) and setting the output flag to its value but this can't be done with bit-shift because I don't have it.