Carbine Target Illuminator

Shenzhen I/O: Carbine Target Illuminator

Once again we are going to make equipment for military use. Someone in the company is not going to be happy about it. This time it is a Carbine Target illuminator, so we can see the bad guys before we shoot them. With the use of radar we are going to measure the distance to the bad guy by counting the number of cycles between output and input to the radar. Based on that we will turn on the laser sight and or the flood light in the following configuration.

Shenzhen I/O - Carbine target Illuminator - specification


If we can cram all the code into one MC6000 we should be able to do it with the following structure on the problem.

shenzhen io - carbine target illuminator structure

That would leave us with a price of 7¥ which is pretty respectable.

Coding the Carbine Target Illuminator

First we need to code something that will reset the counter on a radar-out signal and increase the count when we don’t receive anything on the radar in. That can be done with the follow bits.

slp: slp 1
  tcp x0 10
- add 1
- jmp slp
+ mov 0 acc
+ jmp slp

That will do exactly what we need and only continue if we get something on the radar-in.

The rest of the code is mostly trivial to write, all we need is to go through and check how long we waited and then set the output as needed.

  mov 1 x3
  mov 0 p1
  tgt acc 1
+ mov 10 x3
+ mov 50 p1
  tgt acc 3
+ mov 0 x3
+ mov 100 p1

All in all the solution looks likeshenzhen io - carbine target illuminator solution


This gives us a solution in

Cost: 6¥
Energy: 211
Lines of code: 14

Which is the lowest possible production cost, but the lines of code and energy usage could be lower. If they can with this structure I don’t know. I haven’t found better solutions than this. I tried fiddling around with the latter part where we set the outputs, but I haven’t figured out a way to improve it.

Posted by Kristian


I luv your solution of this problem! Thx a lot!

I had a build that was slightly worse than yours in terms of energy, but thanks to your clever use of tcp I was able to reduce it below the specs you provided, for 2 extra¥(with an added ROM)

add 7 lets us swap to the right column on the ROM, effectively letting us emulate 2 inputs in one tick, and we don’t even need to substract because mov 0 acc takes care of it for us.

We end up squeezing just below 200 power usage with only 11 lines of code

Leave a Reply