Professional Documents
Culture Documents
M. K. A. Ahamed Khan,
Universiti Industri Selangor
Kampus Bestari Jaya,
Jln T. Tambahan
45600 Berjuntai Bestari
Malaysia
I. INTRODUCTION
526
527
Master/Slave
Microcontroller
Communication
Inputs
Power Supply
Outputs
528
V. PROGRAMMING
A. Power
This circuit board provides power supply to the
main board. A voltage regulator was incorporated to
automatically maintain a constant voltage level. The
over-current and reverse-polarity power protection is
achieved by using a PPTC fuse coupled with a
1N4007 diode. A PPTC fuse greatly increases in
resistance when the fuse current rating is exceeded.
This resistance increases to the point that the fuse
effectively becomes an open connection. For the
reverse current protection, a 1N4007 diode is
connected in a crow-bar configuration. When the
power is connected with reverse polarity, the 1N4007
diode conducts, and the current causes the fuse to trip.
B. Microcontroller
A microcontroller is a functional computer
system-on-a-chip. It contains a processor core,
memory, and programmable input/output peripherals.
Two PIC16F877A microcontrollers were used as the
master slave configuration to increase the inputs and
outputs.
//MASTER program
#include <16F877A.h>//
#fuses
NOWDT,NOPROTECT,XT,NOLVP,PUT
#use delay(clock=4000000)
float val=0;
int8 data=0;
setup_spi( SPI_MASTER | SPI_H_TO_L | SPI_XMIT_L_TO_H |
SPI_CLK_DIV_16 );
while(1)
{
spi_write(data);
printf("\n\rdata = %u dataf = %f",data,val);
}
}
C. Inputs
A controller board has various types of inputs such
as sensors, switches, and analog-to-digital converter.
The programmer can choose to use either sensors,
switches, or analog-to-digital converter based on the
required application. The sensor which is used to
sense data from the robot is able to receive analog
signal and convert it to digital. Switches are used to
control motors and LEDs.
D. Outputs
The output of controller board consists of the DC
motor and brushless motor. For these motors, motor
driver is needed to control the speed and rotation of
the motor. It is usually an external circuit which
attached to controller board. For the DC motor
outputs, H-bridge chips are used. These chips are
commonly used to control motors in small robots. In
one chip, it provides two DC motor H-bridges. Each
H-bridge allows bi-directional control of a DC motor.
//SLAVE program
#include <16F877A.h>//
#fuses NOWDT,NOPROTECT,XT,NOLVP,PUT
#use delay(clock=4000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7)
int8 data=0;
void main()
{
setup_spi(SPI_SLAVE|SPI_H_TO_L|SPI_SS_DISABLED);
output_high(PIN_C4);
output_high (PIN_C5);
while(1)
{
if(SPI_DATA_IS_IN())
{
data = spi_read();
output_b(data):
output_toggle(PIN_D4);
printf("\n\r data = %u",data);
}
E. Communication
The
communication
board
provides
communication between PIC and the programmer. It
consists of USB port to load a program and a switch
for reset. An USB port type B which has a square
shape was used in this board. Type B plugs deliver
power and therefore, analogous to a power socket. An
USB was instead of RS232 to reduce space on the
circuit board.
}
}
Figure 9: Slave Program
529
REFERENCES
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[9]
[10]
[11]
[12]
[13]
[14]
Figure 11: Performance Testing
[15]
VII. CONCLUSION
Technologies that allow developing biologically
inspired system are increasingly emerging. As we are
inspired by biology to make more intelligent robot to
improve our lives, we will increasingly be faced with
challenges to such implementations. This paper
focused on the development of a controller board for
[16]
530