Basic circuit of using L293 forms an H-Bridge Driver is shown in Figure 1. As shown for such inductive load as DC motor, external diodes for suppressing back EMF must be connected. The MiniBoard uses L293D instead, the L293D has internal diodes, however providing a bit less driving capacity, i.e., 600mA @4.5V-36V. From the truth table, we see that direction of the motor can control by pin C and D. VINH enable/disable power to the motor, thus for speed regulation, we then use this pin for PWM signaling. See details, L293.pdf data sheet.
Figure 1: Basic circuit of L293 forms H-Bridge Driver
A circuit connecting C-52 P1 to L293 driver chip is shown in Figure 2. As shown Enable pin 1 connected to P1.0 is for PWM signaling. We use additional inverter at pin7 and pin 15 to provide proper logic for easy directional control. Please note that pin 4,5,12,13 are tied to ground and if heat sinking needed, one method is to make a large area of PCB or soldering it with a metal sheet, say.
Figure 2: Connecting C-52 EVB P1.4-P1.7 to L293.
External diodes must be connected for L293(not shown in circuit diagram). My latest design put additional inverter for PWM signal at pin 1 and pin 9 to prevent full power delivering to DC motors when resetting the 89C52(i.e., all bits of P1 is logic high). Check the logic of PWM pins for another microcontrollers.
Line Tracking Sensor (I have to KUK)
Since there’s no ADC for 89C52 chip, each competitor may build their own Line Tracking Sensor, some may use LM339 QUAD comparator with IR transmitter and receiver, some may use LDR as described in Line Follower Robot . With an external comparator, it may not necessary to have ADC, but with LDR, we need external ADC. ” Having additional ADC for 89C52 would be better”, I thought. How can we provide ADC for 89C52 with a cheap method? I chose PIC16C711 with 4-channel ADC, and 7-pin input port. Interfacing to 89C52 is done with simple PISO protocol by using RB0 for SCLK and RA4 for SDA. The code for such purpose was written in C, here is the source file, C52ADC.C. After some initialization, the 711 chip wait for trigger read signal at pin RB0, i.e., high-to-low transition, then it responses by sending 40-bit through RA4(SDA) with low-to-high transition. 40-bit data stream begins with LSB of ADC0 to MSB of PORT B. Example of program to testing ADC is ADC.C.