Download Arithmetic Circuits

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

STANAG 3910 wikipedia , lookup

Rectiverter wikipedia , lookup

Serial digital interface wikipedia , lookup

Regenerative circuit wikipedia , lookup

Index of electronics articles wikipedia , lookup

Radio transmitter design wikipedia , lookup

UniPro protocol stack wikipedia , lookup

Immunity-aware programming wikipedia , lookup

HD-MAC wikipedia , lookup

Transcript
COURSE PROJECT
The following documentation describes a project that must be designed, developed and
implemented for this course. A written report and oral presentation is expected at its conclusion.
Description
The course project involves the design, debugging and building of hardware and software for a
wireless servo driven robot. The robot should be capable of forward and reverse movements as well
as right and left turns of a fixed radius. The type of motion is controlled by pushbuttons on the
wireless remote. There are four push buttons responsible to create the required codes. A receiver
must receive the data, demodulate it and deliver the coded information to a decoder and then to the
Dragon 12 board mounted on a robot chassis built by the designer. Depending on the received data
the dragon board controls servos on the robot. The robot must have the ability to move to right, left,
forward and backward, depending upon the code received from the transmitter. The remote switches
will be arranged in a manner that toggling them will dictate the direction of robotic motion. The
servos themselves are driven by PWM. The driving algorithm is determined by which remote
pushbutton is pressed.
Parts and data
The parts required for the project are:
1.) 1 - Laipac 434 MHz TX/RX transceiver pair
Figure 1. Transmitter TLP434A and receiver RLP434A
2.) 1 – Holtek HT6014/HT6034 encoder/decoder pair.
ECET-365 Project
Page 1 of 14
3.) 2 - Parallax continuous rotation servos.
Continuous Servos
Provided with minor modifications, the standard servo can be converted to one which rotates
continuously at a speed determined by its highest count and in either direction. Parallax has already
made these modifications on its continuous rotation servos. With these modifications the following
table should make sense.
Figure 2. Standard and continuous Parallax Servo
Servo specifications:

Power: 4.8 – 6 V
ECET-365 Project
Page 2 of 14

Top 4.8 V speed: 60 RPM (with no load)

Torque: 2.4 kg-cm/33.3 oz-in at 4.8 V, 3.0 kg-cm/41.7 oz-in at 6 V

Size (L x W x H): 40.5 mm x 20.0 mm x 38.0 mm / 1.60" x 0.8" x 1.50"

Control interface: RC servo pulse width control, 1.50 ms neutral

Manual adjustment port
Figure 3. Continuous Rotation Servo Table
The same information can be given graphically as
ECET-365 Project
Page 3 of 14
Figure 4. Continuous Servo Rotation
Note that again 750 high counts represent a boundary. In this case it is the boundary between
continuous CW and CCW motion. At 750 there is no motion. Larger high count values cause
continuous CCW motion at ever increasing speeds. Note the maximum speed occurs at a high count
of 850 in the CCW direction. Also the maximum CW speed occurs at a high count of 650. Values
larger than these have no added effect.
4.) 4 – N.O. pushbuttons.
5.) 6 – 0.1μf capacitors.
6.) Dragon12 EVB-PLUS-SM
7.) Various resistors, capacitors, LED’s.
ECET-365 Project
Page 4 of 14
8.) Various pieces of wood, metal, screws, and nuts will be required for frame construction (local
hardware store or Parallax).
9.) 2 – 9V battery.
10.) 2 – 5v LDO voltage regulator.
11.) Various wire lengths.
12.) Small bread board
13.) Freescale Codewarrior v. 5.9.0
Procedure
Construct the following circuits/components in the order shown. Each item should be independently
tested according to some test plan that you are required to develop and follow. This must be included
as part of the final report.
1.) Power Interface Construction - the power interface has been described in the course
distribution previously and consists mainly of a battery, voltage regulator, and de-noising
capacitors. This will be the source of clean power for the robot and will be mounted on the
remote. Another power interface is needed as well on the μC.
2.) Remote Control Construction – the remote is the small bread board which at this point will
only have the power interface on it. To this the Holtek encoder is added as well as the
pushbutton switches and the Laipac transmitter. The transmitter circuit schematic is shown
below.
ECET-365 Project
Page 5 of 14
7805
3
1
VIN
VOUT
4
3
C1 2
TLP434A
RF Out
1
1
SW1
1
2
SW2
1
2
SW3
1
2
SW4
1
2
Vdd
Dout
OSC1
R1
OSC2
SW0
TE
SW5
1
2
SW6
1
2
SW1
AD12
SW2
AD11
SW7
1
2
SW3
AD10
SW4
AD9
Figure 5. Transmitter Circuit
3.)
Robot Body Construction - The robot body can be constructed many ways. The important
thing is that there must be space for the wheel servos. The size of the space for the wheel
servos can be found from the Parallax metal body dimensions sheet which is included.
Screws and nuts for servo attachment to the body’s rear housing is best done using the
Parallax hardware that is included. The Dragon12 board must also be affixed to the flat top of
the robot body. Standoffs and screws, again from Parallax work best. This may however
require drilling holes in the board, so two sided adhesive tape could be used. A third nondriven wheel is needed at the front of the robot body. A cotter pin through a hard round ball
will work as will any model wheel (requires some extra thick wire attachment). Wheels must
also be attached to the servos. The screws are already attached to the servos.
4.)
Receiver Circuit Construction - The receiver circuit will be built upon the Dragon12
breadboard. It can be powered with a 9v battery and may need a power interface if the
ECET-365 Project
Page 6 of 14
Dragon’s cannot be accessed. The circuit itself requires a Holtek decoder and a Laipac RX
unit. The circuit is shown below.
7805
1
VIN
VOUT
3
OSC2
OSC1
C1
1
1
MC9S12DG256
1
1
2
HT12D
1
A0
Vdd
A1
VT
A2
OSC1
A3
OSC2
A4
DIN
A5
D11
2
2
RLP434
R1
RF in
2
PB0
1
2
1
2
PB1
PB2
1
2
1
2
PB3
GRD
Digital Out
Linear
A6
D10
PB4
A7
D9
PB5
Vss
D8
GRD
Out
GRD
Vcc
Vcc
C1
PB6
PORTP6
PORTP5
PORTP4
PORTP3
PORTP2
PORTP1
PORTP0
PB7
-
+
1
A
MG1
2
MOTOR SERVO
-
A
+
MG2
1
2
MOTOR SERVO
Figure 6. Receiver Circuit
5.)
Servo Interface Construction - Finally the servo hardware circuit must be installed. The
servos will be driven by PWM so the PWM output port header must be found and each PWM
module connected to a servo as shown below.
ECET-365 Project
Page 7 of 14
Figure 7. Servo Interface
6- Code to set up the 16 bit PWM channel with output from PP7 for controlling the first servo in the
above figure:
#include <hidef.h>
/* common defines and macros */
#include <mc9s12dg256.h>
/* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dg256b"
int i;
void main(void) {
ECET-365 Project
Page 8 of 14
PWMPRCLK=0X60;
//Prescales can be 2^0, 2^1,...,2^7. 2^6=64 is chosen. ClockB= Fbus/64
PWMSCLB=103;
//ClockSB=ClockB/(2X103)
PWMCLK=0X80;
//ClockB is used for CH 7
PWMPOL=0X80;
//high pulse first
PWMCAE=0;
//Align it left
PWMCTL=0X80;
//Choose Channel 6 and 7 for a 16 bit PWM from Channel PP7
PWMPER67=40;
//ClockB= Period (PWMPERx)*Freq
PWMDTY67=3;
//Determines duty cycle=PWMPER2 X Duty%.
PWMCNT67=0;
PWME=0X80;
asm ("swi");
}
Code to set up the 16 bit PWM channel with output from PP5 for controlling the 2nd servo is
provided in the above figure:
#include <hidef.h>
ECET-365 Project
/* common defines and macros */
Page 9 of 14
#include <mc9s12dg256.h>
/* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dg256b"
int i;
void main(void) {
// Bus Frequency is 24 MHz
CCW rotation
PWMPRCLK=0X06;
//Prescales can be 2^0, 2^1,...2^7. 2^6=64 is chosen. ClockA= Fbus/64
PWMSCLA=103;
//ClockSA=ClockA/(2X103)
PWMCLK=0X20;
//ClockA is used for CH 5
PWMPOL=0X20;
//high pulse first
PWMCAE=0;
//Align it left
PWMCTL=0X40;
//Choose Channel 4 and 5 for a 16 bit PWM from Channel PP5
PWMPER45=40;
//ClockB= Period (PWMPERx)*Freq
PWMDTY45=3;
//Determines duty cycle=PWMPER2 X Duty%. // Change to 2 to turn
// Clockwise
PWMCNT45=0;
PWME=0X20;
ECET-365 Project
Page 10 of 14
asm ("swi");
}
Following is a C program for controlling a standard servo
#include <hidef.h>
/* common defines and macros */
#include <mc9s12dg256.h>
/* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dg256b"
int i;
void main(void) {
// Bus Frequency is 24 MHz
PWMPRCLK=0X06; //Prescales can be 2^0, 2^1,…..2^7. 2^6=64 is chosen. ClockA= Fbus/64
PWMSCLA=103;
ECET-365 Project
//ClockSA=ClockA/(2X103)
Page 11 of 14
PWMCLK=0X20;
//ClockB is used for CH 5
PWMPOL=0X20;
//high pulse first
PWMCAE=0;
//Align it left
PWMCTL=0X40;
//Choose Channel 4 and 5 for a 16 bit PWM from Channel PP5
PWMPER45=40;
//ClockB= Period (PWMPERx)*Freq
PWMDTY45=1;
//Determines duty cycle=PWMPER2 X Duty%.
// 0 to 180 degrees. Change this value to move standard servo to
// different locations between
PWMCNT45=0;
PWME=0X20;
asm ("swi");
}
Note: All servos must be zeroed before usage.
ECET-365 Project
Page 12 of 14
7.)
Transmitter Function – The Holtek encoder is used in the transmitter. It has its own oscillator
circuit to serially shift out data to the wireless transmitter. The data is the value (encoded) of
the pushbutton pressed. The address lines shown allow this information to be included in the
signal. Therefore it should be possible for all robots to use different addresses and all operate
at the same time. Depending on the Holtek variant used some values are transmitted using
active low logic. The transmitter and receiver cannot operate at the same frequency so
resistors are needed to configure TX and RX to data sheet values. Figure for their selection
are shown in the data sheets.
8.)
Software Flowchart for Receiver – the receiver circuit continually reads the data ignoring
data whose address is different than itself. Valid data is decoded and available at the input
port pins of the μC. This information represents a signal, via position, telling the μC what
direction is sought. The μC must continually read this information on its input pins and drive
each of the two PWM modules to make both wheels perform that motion. A flowchart should
be developed and included in your final report.
9.)
Component Integration – The items above, once tested must be integrated and tested as a unit
for functionality. Obtain a robot address from the instructor so robot communications remain
independent. Include tests for the integrated item in you report.
10.) Navigation – To be of any use your robot must be able to use the pushbutton system to
navigate an arbitrary course. In particular the course shown below must be navigated as proof
of robot function.
ECET-365 Project
Page 13 of 14
Figure 8. Test Course
Report
A complete report detailing construction, test and validation of the project should be written. The
report format should follow the follow the format for course labs in general.
Presentation
In addition to a written report, a complete power point presentation must be written. A final
presentation of the project using the presentation must be given to your class peers and the
instructor. It is considered towards a part of your grade.
ECET-365 Project
Page 14 of 14