The SSC-32 controller card has 4 pairs of pins that can be used to receive input signals from external devices. These are marked “A”, “B”, “C” and “D” and are beside the Baud rate setting for the serial port.
These inputs can be connected to switches and sensors to provide feedback on the positioning of the servos. For example, we can put a simple switch across the “D” pins at the end, and send a “D” or a “DL” message to the SSC-32, to get a message back that tells us whether the switch is open (ASCII “0” or 48) or closed (ASCII “1” or 49).
To test this we just created another a simple program with a timer called "checkSensor". It works much like our other program, and simply sends the "D" command to check what state the D pins are in(open or closed). This program just logs the state of the input (either 48 or 49) every fifth of a second. Normally the output logs 49, but when we shorted the two pins together for a couple of cycles, the output changed to 48. It change back to 49 when we stopped shorting out the pins.
We also tried changing the input from "D" to "DL". The difference between the “D” and the “DL” command is that the DL command is a latch. This means that once that switch opens, it will continue to return the symbol for 'open' until it is reset. The D command simply returns the open symbol only when the switch is open.
When we ran this version of the program, we had to change the timer to fire every 3 seconds so we could see how it worked. When we shorted the input pins, the value being returned switched from 49 to 48, and it didn't switch back, meaning that the latch was successful.
A latch could be used in a moving robot to detect if hits a wall. For instance, if a robot is moving at a certain speed, then hits a wall, it might bounce off. This could happen in between sensor checks the computer makes, which means the robot won't register it, and hit the wall again. A latch, however, will only allow the computer to hit a wall once, thereby avoiding possible damage to the robot.
No comments:
Post a Comment