1 / 21

Robotraffic software and programming aids

Robotraffic software and programming aids. Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology. Strip sensor. Distance Sensor. Servo Motor. PICKit 2. Reset. RS232. 5Vdc out. Run/Stop. Select rs232 or IrDA. Select rs232. Encoder. IrDA.

gafna
Télécharger la présentation

Robotraffic software and programming aids

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Robotrafficsoftware and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology

  2. Strip sensor Distance Sensor Servo Motor PICKit 2 Reset RS232 5Vdc out Run/Stop Select rs232 or IrDA Select rs232 Encoder IrDA BUS jumpers Fuse 5A DC Motor Power input Car main board

  3. Strip sensor (J11) 1 – pin Vdd 2 – pin Gnd 3 – pin Left 4 – pin BL 5 – pin BR 6 – pin Right 7 – pin Stop Distance Sensor (J12) 1 – pin Vdd 2 – pin Gnd 3 - pin Left 4 – pin Right Servo Motor (J14) 1 –pin Vm 2 – pin Input 3 – pin Gnd PICKit 2 (J3) 1 - pin Vpp 2 – pin Vdd 3 – pin Gnd 4 – pin PGD 5 - pin PGC Reset (J6) 1 – pin Reset 2 - Gnd RS232 (J1) 1 – pin RX 2 - pin Gnd 3 – pin TX 5Vdc out (J16) 1 – pin +5Vdc 2 - Gnd Run/Stop (J15) Open RC2->High Close RC2 -> Low 1-2 close RS232 2-3 close IrDA Encoder (J13) 1 – pin Vdd 2 – pin Gnd 3 – pin QEA 4 – pin QEB 5 – pin Index IrDA (J9) 1 –pin Vdd 2 – pin Gnd 3 – pin RXIr 4 – pin TXIr BUS jumpers Fuse 5A DC Motor (J10) 1 – pin (+)Motor 2 – pin (-)Motor Power input (J2) 1 – pin (+) Battery 2 – pin (-) Battery Car main board

  4. PIC18F4431 external device connection jumpers

  5. PIC18F4431 PORTA TRISA = 0x00; TRISA0 = 0; PORTA = 0xFA; RA0 = 1; TRISA = 0xFF; TRISA0 = 1; char a = PORTA;

  6. Exercise_1 Port setup #include<htc.h> char a = 0x55; void main(void) { TRISA = 0xf0; // b11111111 all bits, are input TRISA6 = 0; // bit RA6 set to output PORTA = a; }

  7. #include<htc.h> char a; void initialization (void); void interrupt ISR(void); /*==============================================================*/ void initialization (void) { /* Interrupt init */ IPEN = 1; /* Interrupt Priority Enable bit, 1 = Enable priority levels on interrupts */ /* 0 = Disable priority levels on interrupts */ GIEH = 1; /* Enables all high priority interrupts */ GIEL = 1; /* Enables all low priority peripheral interrupts */ /* init TMR0 */ T0CON = 0x46; /* 16-bit 1:2 prescale value */ TMR0L = 0x80; /* prescaler for the Timer0 module */ TMR0H = 0x00; /* prescaler for the Timer0 module */ TMR0IP = 1; /* TMR0 Overflow Interrupt Priority bit, High priority */ TMR0IE = 1; /* Enables the TMR0 overflow interrupt */ TMR0IF = 0; /* TMR0 Overflow Interrupt Flag bit */ /* I/O ports */ TRISA = 0xff; /* Port A data direction */ TRISB = 0x00; /* Port B data direction */ } /*==============================================================*/ void interrupt ISR(void) { if((TMR0IF)&&(TMR0IE)) { PORTB = a; a++; TMR0L = 0x80; /* prescaler for the Timer0 module */ TMR0H = 0x00; /* prescaler for the Timer0 module */ TMR0IF = 0; /* TMR0 Overflow Interrupt Flag bit */ } } /*==============================================================*/ void main (void) { initialization (); TMR0ON = 1; /* Timer0 On/Off Control bit, 1 = Enables Timer0 */ while(1) { } }

  8. ENHANCED UNIVERSAL SYNCHRONOUS ASYNCHRONOUS RECEIVER TRANSMITTER (EUSART)

More Related