Sunteți pe pagina 1din 15

EN206 Robot Competition

Guidelines for Board Construction


and Interfacing
Subsystems of the Processor Board
LO
J3
U6 R4

LO
R SW1
1 1 3
0

GND
2 VIN VOUT
LO
C9 C10 C11 R16 C21 U2
C C C R C D50 SENS59150-SPST
78XX/SM R1 R17

2
HEADER 2 0 R LED R

D7
MCLR RB7 Digital1
POWER SUPPLY LED Analog1 RA0 RB6 Digital2
D18
R2 R Analog2 RA1 RB5 Digital3
DIODE
Analog3 RA2 RB4 Digital4
Q1
PIC RESET Analog4 RA3 RB3 Digital5
BC548
0 R3
Timer0/Counter0 input RA4 RB2 Digital6
C20 Analog5 RA5 RB1 Digital7
R
0 Analog6 RE0 RB0 Digital8
Analog7
LO
LO RE1 VDD
C C14
Analog8 RE2 18F452 VSS 0
C 0 LO VDD RD7 LED1
U4
0 0 VSS RD6 LED2

16
0 Y1 OSC1 RD5 LED3
P1 OSC2 RD4 LED4
CRY STAL
Timer1/Counter1 Input RX-TTL

VCC
1 9 RC0 RC7
6 R2OUT RX-TTL 0 C C15
PWM1 RC1 RC6 TX-TTL
PWM2 RC2 RC5 SDO
2 7 10
T2OUT T2IN TX-TTL SCL RC3 RC4 SDI
7 8
PIC RESET R2IN Motor1Dir1 RD0 RD3 Motor2Dir2
3
Motor1Dir2 RD1 RD2 Motor2Dir1
8 C C19 2
4
LO V+ MAX232
9 1
5 C16 3 C1+ 11
0 C C1- T1IN 12
R1OUT 13
CONNECTOR DB9 4 R1IN 14
C17 5 C2+ T1OUT
C C2-
GND

Use Female 6
V-
Foot print C18 J24
0
15

1
0
LO
2
3
0
PWM1
RS232 LEVEL CONVERTER 4
PWM2
5
Motor1Dir1
6
Motor1Dir2
7
Motor2Dir1
8
Motor2Dir2

J29
J9 J6 HEADER 10 J10 HEADER 8

1
SDI
2 1 1 1
SCL Analog1
3 2 2 2
SDO Analog2
4 3 3 3
SS Analog3
5 4 4 4
LED1 Analog4
6 5 5 5
LED2 Analog5
7 6 6 6
LED3 Analog6
8 7 7 7
LED4 Analog7
8 8 8
Analog8
9 9 LO 9
10 10 10

Processor Board
HEADER 8 LO

SPI INTERFACE 0 0
HEADER 10 Analog Port HEADER 10

J11 J12
J7 HEADER 10
D14
LO R9
LO 1 1
HEADER 2 J8 R14 2 1 2 D15
Digital1 LED1 0
R R15 3 2 3 R10
Digital2
R 4 3 4 D16
Digital3 LED2 0
1 5 4 5 R12
R
Timer1/Counter1 Input Digital4 LED
2 6 5 6 D17
Timer0/Counter0 input Digital5 LED3 0
7 6 7 R13
R Title
Digital6 LED
8 7 8 <Title>
Digital7 LED4 0
9 8 9 R
Digital8 LED
10 9 LO 10 Size Document Number Rev
10
Encoder/Counter Interface LO LED R B <Doc> <Rev Code>

0
Indicators Date: Monday , July 09, 2007 Sheet 1 of 1
0
HEADER 10 Digital Port HEADER 10
Detailed Plan of the Processor Board
5V Regulator I/O Bus (Analog/Digital) Reset
Switch

Ground Bus
5V Bus
Power Supply
(9V 24V) I/O Bus (Digital)

Power Indicator Indicator LEDs

PIC Micro
controller
(18F452)

DB9 Serial Connector Max232 Encoder Motor Driver I/O Bus (Digital)
Level Interface Interface
converter
Tracks of the PCB of the Processor Board
Recommended Steps for Construction (1)

1. Solder the power supply


Check if the indicator LED lights up
Verify that the supply voltage is 5V
2. Solder the IC base for the microcontroller
Check if the voltage between the VDD and
GND pins of the microcontroller is 5V
Recommended Steps for Construction (2)

3. Solder the microcontroller circuit, the


indicator LEDs and the encoder/counter
interface
Write a simple program for the
microcontroller to make the LEDs
connected to IO pins D7-D4 blink. Use this
to check the circuit.
Recommended Steps for Construction (3)

4. Solder the RS232 interface


Write a simple program for the PC to write a
character to the RS232 port and read a
character from it.
Write a program for the microcontroller to
read the RS323 port and echo the character
it receives.
Verify the performance of the system and
use the oscilloscope to check if the voltage
levels are correct.
Recommended Steps for Construction (4)

5. Solder the remaining interface pins

If any of the stages do not pass the


diagnostic tests specified, do not proceed
without correcting the fault at that stage.
mikroC
Syntax very similar to C/C++
High level programming language
Complex low level operations are abstracted
(eg. RS232 interfacing)
Versatile
Sample Program LED Blinking
void main() {
PORTD = 0xA0;
TRISD = 0;

while(1) {
PORTD = ~PORTD;
Delay_ms(1000);
}
}
Sample Program RS323
unsigned short i;

void main() {
USART_init(2400); // initialize USART module
// (8 bit, 2400 baud rate, no parity bit...
while (1) {
if (USART_Data_Ready()) { // if data is received
i = USART_Read(); // read the received data
USART_Write(i); // send data via USART
}
}
}
Motor Driving Board

Motor 1
Interfacing to
Processor
Board

Motor 2
L298 Motor Driver
IC (2A Max)

Power
Connector
Motor 3

Interfacing to
Processor
Board

Motor 4
The Sonar Sensor
SRF05
Operation of the Sonar Sensor
Range detection using ultrasound

Ultrasound Pulse

Echo

Sonar Sensor Object


Interfacing the Sonar Sensor
short i;
void main() {
PORTB = 0; TRISB = 0xFD; // Pin B0 is input Pin
B1 is output
TRISD = 0; // Port D - Output
PORTB.F1 = 0; i = 0;
do { // Send Trigger Pulse
PORTB.F1 = 1; Delay_us(10); PORTB.F1 = 0;
Delay_ms(1); i = 0;
while (PORTB.F0 == 1)
{
if (i<0xFE) {i++;} if (i == 0xFF) {break;} Delay_us(2);
}
Delay_ms(100); PORTD = i;
} while(1);
}

S-ar putea să vă placă și