Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering...
-
Upload
nathaniel-cummings -
Category
Documents
-
view
216 -
download
0
Transcript of Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering...
![Page 1: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/1.jpg)
RobotrafficRobotraffic
software and programming aidssoftware and programming aids
Robotics LaboratoryRobotics Laboratory
Faculty of Mechanical EngineeringFaculty of Mechanical Engineering
Technion Israel Institute of Technion Israel Institute of TechnologyTechnology
![Page 2: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/2.jpg)
![Page 3: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/3.jpg)
![Page 4: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/4.jpg)
PICKit 2
RS232
IrDA
Encoder
Run/Stop
5Vdc out
Power input
Strip sensor Distance Sensor Servo Motor
DC Motor
Select
rs232 Select
rs232 or IrDA
BUS jumpers
Fuse 5A
Car main boardCar main board
Reset
![Page 5: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/5.jpg)
PICKit 2 (J3)1 - pin Vpp2 – pin Vdd3 – pin Gnd4 – pin PGD5 - pin PGC
RS232 (J1)1 – pin RX2 - pin Gnd3 – pin TX
IrDA (J9)1 –pin Vdd2 – pin Gnd3 – pin RXIr4 – pin TXIr
Encoder (J13)1 – pin Vdd2 – pin Gnd3 – pin QEA4 – pin QEB5 – pin Index
Run/Stop (J15)Open RC2->HighClose RC2 -> Low
5Vdc out (J16)1 – pin +5Vdc2 - Gnd
Reset (J6)1 – pin Reset2 - Gnd
Power input (J2)1 – pin (+) Battery2 – pin (-) Battery
Strip sensor (J11)1 – pin Vdd2 – pin Gnd3 – pin Left4 – pin BL5 – pin BR6 – pin Right7 – pin Stop
Distance Sensor (J12)1 – pin Vdd2 – pin Gnd3 - pin Left4 – pin Right
Servo Motor (J14)1 –pin Vm2 – pin Input3 – pin Gnd
DC Motor (J10)1 – pin (+)Motor2 – pin (-)Motor
BUS jumpers
Fuse 5A
1-2 close RS232
2-3 close IrDA
Car main boardCar main board
![Page 6: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/6.jpg)
PIC18F4431 external device connection jumpersPIC18F4431 external device connection jumpers
![Page 7: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/7.jpg)
![Page 8: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/8.jpg)
PIC18F4431 PORTAPIC18F4431 PORTA
TRISA = 0x00; TRISA0 = 0; PORTA = 0xFA; RA0 = 1;TRISA = 0xFF; TRISA0 = 1; char a = PORTA;
![Page 9: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/9.jpg)
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;
}
![Page 10: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/10.jpg)
![Page 11: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/11.jpg)
![Page 12: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/12.jpg)
![Page 13: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/13.jpg)
![Page 14: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/14.jpg)
#include<htc.h>#include<htc.h>char a;char a;void initialization (void);void initialization (void);void interrupt ISR(void);void interrupt ISR(void);
/*==============================================================*//*==============================================================*/void initialization (void)void initialization (void)
{{/* Interrupt init *//* Interrupt init */
IPENIPEN = 1;= 1; /* Interrupt Priority Enable bit, 1 = Enable priority levels on interrupts /* Interrupt Priority Enable bit, 1 = Enable priority levels on interrupts */*/
/* 0 = Disable priority levels on interrupts *//* 0 = Disable priority levels on interrupts */ GIEHGIEH = 1;= 1; /* Enables all high priority interrupts *//* Enables all high priority interrupts */GIELGIEL = 1;= 1; /* Enables all low priority peripheral interrupts *//* Enables all low priority peripheral interrupts */
/* init TMR0 *//* init TMR0 */T0CONT0CON = 0x46;= 0x46; /* 16-bit 1:2 prescale value *//* 16-bit 1:2 prescale value */TMR0LTMR0L = 0x80;= 0x80; /* prescaler for the Timer0 module *//* prescaler for the Timer0 module */TMR0HTMR0H = 0x00;= 0x00; /* prescaler for the Timer0 module *//* prescaler for the Timer0 module */
TMR0IPTMR0IP = 1;= 1; /* TMR0 Overflow Interrupt Priority bit, High priority *//* TMR0 Overflow Interrupt Priority bit, High priority */TMR0IETMR0IE = 1;= 1; /* Enables the TMR0 overflow interrupt *//* Enables the TMR0 overflow interrupt */TMR0IFTMR0IF = 0;= 0; /* TMR0 Overflow Interrupt Flag bit *//* TMR0 Overflow Interrupt Flag bit */
/* I/O ports *//* I/O ports */TRISATRISA = 0xff;= 0xff; /* Port A data direction *//* Port A data direction */TRISBTRISB = 0x00;= 0x00; /* Port B data direction *//* Port B data direction */
}}/*==============================================================*//*==============================================================*/void interrupt ISR(void)void interrupt ISR(void)
{{if((TMR0IF)&&(TMR0IE))if((TMR0IF)&&(TMR0IE))
{{ PORTB = a;PORTB = a; a++;a++;
TMR0LTMR0L = 0x80;= 0x80; /* prescaler for the Timer0 module *//* prescaler for the Timer0 module */ TMR0HTMR0H = 0x00;= 0x00; /* prescaler for the Timer0 module *//* prescaler for the Timer0 module */
TMR0IFTMR0IF = 0;= 0; /* TMR0 Overflow Interrupt Flag bit *//* TMR0 Overflow Interrupt Flag bit */}}
}}
/*==============================================================*//*==============================================================*/void main (void)void main (void){{ initialization ();initialization (); TMR0ON = 1; /* Timer0 On/Off Control bit, 1 = Enables Timer0 */TMR0ON = 1; /* Timer0 On/Off Control bit, 1 = Enables Timer0 */ while(1)while(1) { { } } }}
![Page 15: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/15.jpg)
![Page 16: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/16.jpg)
ENHANCED UNIVERSAL SYNCHRONOUS ASYNCHRONOUS RECEIVER TRANSMITTER (EUSART)
![Page 17: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/17.jpg)
![Page 18: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/18.jpg)
![Page 19: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/19.jpg)
![Page 20: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/20.jpg)
![Page 21: Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.](https://reader034.fdocuments.us/reader034/viewer/2022051416/56649eb55503460f94bbe5bb/html5/thumbnails/21.jpg)