1. You can now buy finished microcontroller project from us, Check out the Store for the complete list of projects.
  2. Need a custom project, Send us some details about your project. So that we can quote the price for it.

PIC Mini Robot With IR Eyes

Mini Robot with IR eyes controlled by PIC microcontroller

  1. Indira
    Mini Robot with IR eyes controlled by PIC microcontroller. 2 Dc motors are used to drive the robot and the motors are derived with help of the H bridge circuit.

    Sponsored Links

    Circuit Diagram
    cerb_sch.gif
    Code
    Code (Text):
    1. ;CERBERES : MINI ROBOT WITH IR EYES ;
    2. ;USES PIC16F84 ┬ÁCONTROLLER ;
    3. ;MPLAB CAN BE DOWNLOADED FROM WWW.MICROCHIP.COM ;
    4.  
    5. ;***SET UP THE CONTANTS & VARIABLES****
    6.  
    7. LIST P=16C84
    8. ERRORLEVEL -302 ;SUPPRESS BANK SELECTION MESSAGES
    9.  
    10. STATUS EQU H'03' ;STATUS REGISTER
    11. TRISB EQU H'86' ;TRISB REGISTER FOR SETUP OF PORTB
    12. PORTB EQU H'06' ;PORTB REGISTER TO DRIVE PORT B
    13. COUNT1 EQU H'0C' ;COUNT VARIABLE 1 IS IN GENERAL PURPOSE REG 08H
    14. COUNT2 EQU H'0D' ;COUNT VARIABLE 2 IS IN GENERAL PURPOSE REG 09H
    15.  
    16. ;***SET UP PORT B IN & OUTPUT****
    17. BSF STATUS,5 ;SWITCH TO BANK0 TO SET UP PORT B
    18. MOVLW B'11110000' ;RB7,6,5,4 IS INPUT
    19. MOVWF TRISB ;RB3,2,1,0 IS OUTPUT
    20. BCF STATUS,5 ;SWITCH BACK TO BANK0 TO USE PORT B
    21.  
    22. ;***MAIN PROGRAM****
    23. START MOVLW B'00000101' ;MAKE RB0&2 HIGH: MOVE FORWARD
    24. MOVWF PORTB ;
    25. MOVLW H'FE' ;RESET COUNT1 TO 254
    26. MOVWF COUNT1 ;
    27. MOVLW H'FE' ;RESET COUNT2 TO 254
    28. MOVWF COUNT2 ;
    29. BTFSS PORTB,5 ;CHECK RB5 (INPUT); IF IT IS LOW
    30. CALL BACKL ;THEN EXECUTE BACKLEFT ROUTINE
    31. BTFSS PORTB,6 ;CHECK RB6 (INPUT); IF IT IS LOW
    32. CALL BACKR ;EXECUTE BACKRIGHT ROUTINE
    33. GOTO START ;RETURN TO LABEL START
    34.  
    35. ;***BACKLEFT ROUTINE****
    36. BACKL MOVLW B'00001010' ;MAKE RB1&3 HIGH: MOVE BACKWARD
    37. MOVWF PORTB ;
    38. CALL DELAY ;
    39. MOVLW B'00001001' ;MAKE RB2&3 HIGH: ROTATE LEFT
    40. MOVWF PORTB ;
    41. CALL DELAY ;
    42. RETURN
    43. ;***BACKRIGHT ROUTINE****
    44. BACKR MOVLW B'00001010' ;MAKE RB1&3 HIGH: MOVE BACKWARD
    45. MOVWF PORTB ;
    46. CALL DELAY ;
    47. MOVLW B'00000110' ;MAKE RB2&3 HIGH: ROTATE RIGHT
    48. MOVWF PORTB ;
    49. CALL DELAY ;
    50. RETURN
    51.  
    52. DELAY MOVLW H'EE' ;RESET ALL COUNTER VARIABLES
    53. MOVWF COUNT1
    54. MOVLW H'99'
    55. MOVWF COUNT2
    56.  
    57. LOOP1 CLRWDT ;RESET THE WATCHDOG TIMER
    58. DECFSZ COUNT1,1 ;this is a delay loop
    59. GOTO LOOP1 ;tuned to make Cerberes
    60. DECFSZ COUNT2,1 ;turn about 90 degrees
    61. GOTO LOOP1
    62. RETURN
    63.  
    64. END;
    MMIIHHOONN and midhun like this.
Tags: pic, mini robot, robot

Recent Reviews

  1. LOVEYDOVEY1122
    LOVEYDOVEY1122
    5/5,
    Thank you this is a great project