|
Objective
Learn how to create digitally controlled
devices using the LogoChip and then
interface these devices to the Handy
Cricket using its Bus protocol.
Design
For the LogoChip lab I decided to
implement a driver for the DevanTech
sonars that are part of the Botball kit.
The driver will have the LogoChip
indicate distance to target in a standard
unit of time. The sonar data will be
communicated to the cricket over the bus
line, which the cricket is in control of.
Based on how close the target is to the
sonar sensor, the cricket will emit a beep
from its piezo commensurate with the
target proximity.
The LogoChip Logo code for the sonar,
also known as the sonar driver is in the
file
sonar.txt. This code sits quietly in
the LogoChip until a request is made over
the bus line, connected to pin B0 of the
LogoChip, by the cricket. The sonar is
connected to pins B6 and B7 of the
LogoChip. The wiring diagram for the
LogoChip is found
here.
The cricket code is found in the file
son.txt. It continuously sends a
command over its bus to the LogoChip. The
LogoChip waits for this command and upon
receiving it, it calls the sonar driver,
which returns a value representative of
the distance of the target from the sonars.
The LogoChip sends this value over the
bus to the cricket. The cricket emits
beeps from its piezo to indicate how close
the target is.
The resolution of the sonar data returned
from the LogoChip was not very good due to
the large timer values(1 ms), relatively
speaking. In the future the resolution
could be improved by utilizing no-op
operations.
|