The Let's Play Archive

SHENZHEN I/O

by Quackles

Part 42: Assignment #18: Remote Kill Switch

Remote Kill Switch



One of the things that it's easy to forget about Jie is that he is still an engineer and does do engineering work, even if he also manages the rest of us. What he's suggesting seems like quite a sensible precaution, though I'll have to see the details of the spec to understand what sort of equipment is expected to be connected to this thing.






There it is, in black and white: 'industrial equipment'. I'm guessing the sort of high-powered robots that assemble cars or that sort of thing?
Looking at this, I can tell right away I'll need two MCs for this. The reasons follow from the design.

First off - putting an output expander in front of the three outputs seems perfect here, given that the outputs are always on or off (no in-between). One of the MCs has to use its acc to keep track of the state of the outputs (which we can change incrementally by using dst instructions to set individual digits of acc to 1 or 0 before that value is pushed to the expander).

The thing is, we also need to use an acc as a counter to keep track of how long it's been since we received a pulse from the transmitter (because only accs can be added to / subtracted from). This means, another MC.

With that in mind, here's an initial design sketch:



 

This seems pretty straightforward, though chip sizes are subject to change. Time to get to work!

[ ~ ]



 

Here's my first design. ¥11, and 507 power usage on average.
I had to bump the first chip up to a MC6000 so it can use dat to store the radio signal. If it gets nothing, it adds 1 to acc (counting how long it's been since the last pulse); if it's been too long, it sends -1 (override) to the second MC. Otherwise, the first MC just passes the command on (if it's a command) or sleeps (if it's a keep-alive pulse).

The second MC... I'm not as proud of. It just waits for notification from the first MC, and either sets acc to 0 (in the case of an override), or modifies the appropriate digit of acc with the dst instructions (normally). Then it pushes the result out to the output expander.

The thing is, I had to use both registers, which is why it's a MC6000 - but all that wasted space is gnawing at me. I could shrink it down to a MC4000, except to do that would require not using dat, and I have to use that now to cache the first value (which power supply to change) from the first MC.

(I did try to read from the first MC twice in one tick. It turns out you can't do that - at least not on the same pin.)



Maybe if I could make it read using different pins (so something like "dst x0 x1" and read the two values in order)? I might be able to make it work if I used a MC4000X for the second chip. I'll think about it some more.

[ ~ ~ ]



 

It looks like using a MC4000X was the right call. (¥9 and 489 average power, so this is an unequivocal improvement.)

I realized that I didn't even need to have two different pins of the first MC hooked to the second. When a 'power change' command arrives, the first MC has to read the first value— but it can leave the second in the radio and have the second MC pick it up directly. This lets the dst x1 x0 work, pulling in both values in the same tick and sending the updated acc out to the expander immediately afterwards.

This seems like a good design, and Jie will be pleased. I wonder if it'll end up on our own factory floor? No more smashed-part incidents like the one that happened back near when I started.



Ho-ly crabapples. I'm completely in line with Carl on this - imagining Jie talking like Joe is... well, I don't have to imagine it, it's right there! But Joe is more idiomatic than a lot of Californians I know!

...does this mean that Joe is kind of like... Reverse David, in a way?

There's a scary thought.

I think maybe because it could be true.


P.S: I added a gif of the aquaponics arm at work to that post - I forgot to include it when I originally posted it. Check it out! (GIF is near the bottom)

P.P.S: Still watching My Roommate Is A Lamia. The most recent episodes have introduced a (more or less normal) best friend to the protagonist - she's a definite foil to everyone's favorite lamia, though. The showrunners are definitely trying to get a romance started between the guy and his lamia roommate, but said best friend's plans to start a band have been schedule-blocking it big time.
If there's any other Lamia fans reading the blog: my guess is that he joins the band. That beat-up bass guitar in his closet didn't get put there just as background...