This action might not be possible to undo. Are you sure you want to continue?
To be able to create a program that will trigger the sensor and motor. II.Materials Circuit used in Experiment no. 3 Since we changed the circuit, we now used: 1pc 1pc 1pc 1pc 1pc L293D IC 7404 IC 2N2222 Transistor PIC 16F84A Microcontroller Voltage Regulator 1pc 2pcs 4pcs 4pcs 4MHz Clock Motor LDRs White LEDs
Others: Power Supply PIC Burner Computer that has MPLAB IDE and IC Prog software Robot Car III. Procedure
IV. Circuit Diagram
Figure1. Original circuit given to us
Figure2. Here we used L293D IC instead of 2 Relays
Figure3. Given condition/situation to our group
V. Program Code ; MAIN PROGRAM LOOP CALL LEFT CALL RIGHT GOTO LOOP LEFT BTFSC PORTA,0 RETURN CALL LEFT1 LEFT1 BTFSC PORTA,1 RETURN CALL LEFT2 LEFT2 BTFSC PORTA,2 CALL LEFT3 RETURN LEFT3 BSF PORTB,0 BCF PORTB,1 BSF PORTB,2 BCF PORTB,3 RETURN RIGHT BTFSC PORTA,0 RETURN CALL RIGHT1 RIGHT1 BTFSC PORTA,1 CALL RIGHT2 RETURN RIGHT2 BTFSC PORTA,2 RETURN CALL RIGHT3 RIGHT3 BSF PORTB,0 BCF PORTB,1 BCF PORTB,2 BSF PORTB,3 RETURN ; END
VI. INSTRUCTIONS/COMMANDS USED IN THE PROGRAM MOVWF – Move W to f
VII. Discussion In this experiment, we constructed a robot car and made a program that will satisfy the given conditions (turn left and turn right), given to us by Mr. Alcaraz. We performed this activity by group. The four of us helped each other in constructing our car, while the other one is assigned in programming. We programmed our PIC microcontroller using the MPLAB IDE software. We first create a g3.asm file-- this is where we encode our program. After encoding, we ‘build’ the program then ‘burn’ it on the microcontroller. Since we’re not done constructing our own car we used Mr. Alcaraz’s car to test our microcontroller. In our first try, we didn’t do it correctly.
We checked our program. We reconstruct it. We try it again on Mr. Alcaraz’s car. Still, it didn’t work. We did again some reconstruction on our program, and on our third try we did it at last; the car satisfies the given condition. We called Mr. Alcaraz to check our work.
We also need to perform this experiment in our own car; the problem is that we’re having a trouble in constructing it. Some problems we encountered were: 1. When we use 9V from function generator the car is moving, but when we use 9V battery it doesn’t move. Mr. Alcaraz said that we should use a battery that has high ampere. 2. When we put our car on the ground the tires are not moving but when we raise the car, the tires are running. What we did is we replaced the whole car. 3. LDRs are not functioning well. We need to recheck our LDRs again and again. 4. The LEDs got busted. What we did is we put a resistor on each LEDs. 5. The circuit itself is our problem because it’s too complicated.
Mr. Alcaraz taught us again another circuit which we will be using a L293D IC instead of having two relays. We did this circuit and our car worked out correctly. Actually, our car is 90% done: it moves and it follows the track. Our only problem was our car move fast, so fast that it leaves the track. (We tested our car in the track by just tapping the battery to the circuit, and it follows the track) We did some modifications like, we place a potentiometer, we put a resistor, we lowered the voltage, etc. Unfortunately, when our groupmate brought our car to their house and when he tested it, the LEDs got busted, and our motor didn’t work again.
VIII. Conclusion MPLAB IDE MPLAB IDE is a software program that runs on a PC to develop applications for Microchip microcontrollers. It is called an Integrated Development Environment, or IDE, because it provides a single integrated “environment” to develop code for embedded microcontrollers. PIC The PIC was developed as a peripheral controller. PIC(Peripheral Interface Controller) is the IC which was developed to control peripheral devices. PIC 16F84A OSC1/CLKIN : Oscillator crystal input. External clock source input. OSC2/CLKOUT : Oscillator crystal output. Connects to crystal or resonator in crystal oscillator mode. MCLR(inv) : Master clear(reset)input. Programming voltage input. This pin is an active low reset to the device. RA0 - RA3 : Bi-directional I/O port. RA4/T0CKI : Bi-directional I/O port. Clock input to the TMR0 timer/counter. RB0/INT : Bi-directional I/O port. External interrupt pin. RB1 - RB7 : Bi-directional I/O port. VSS : Ground VDD : Positive supply(+2.0V to +5.5V)