Home
here - Adam Morse
Contents
1. Specifications Motor rated voltage 7 2V Motor stall current 2 5A Output shaft stall torque 10Kg cm Gearbox ratio 86 8 1 Encoder type Quadrature Encoder resolution 1000 state changes per 3 wheel rotations Speed 1Km hr Motor Driver Freescale MC33926 m AC ccc Freescale Semiconductor Document Number MC33926 Advance Information Rev 8 0 4 2009 VRoHS 5 0 A Throttle Control H Bridge The 33926 is a monolithic H Bridge Power IC designed primarily for automotive electronic throttle control but is applicable to any low voltage DC servo motor control application within the current and voltage limits stated in this specification The 33926 is able to control inductive loads with currents up to 5 0 A peak RMS current capability is subject to the degree of heatsinking provided to the device package Internal peak current limiting regulation is activated at load currents above 6 5 A 1 5 A Output loads can be pulse width modulated PWM ed at frequencies upto
2. 48 mmm fe fe s falee fs ele Jefe fs fa ja a e s fe el jej gt T3CKI muttplexed In fuses 26 mutplexed in tses CCP3 P3 multiplexed In fuses 2010 2012 Microchip Technology Inc Preliminary DS41412E page 8 PIC18 L F2X 4XK22 TABLE 2 PIC18 L FAXK22 PIN SUMMARY m 3 2 7 fa s 15 17 17 1 11 14 jJ ee pz gt 22 e 41 ___ 27 2 2 2 raes gt RETE es es RD6 RX2 DT2 RED Note 1 CCP2mutpiexed in fuses 2 T3CKI muttpiexed in fuses 3 In fuses 4 n fuses 2010 2012 Microchip Technology Inc Preliminary DS41412E page 0 PIC18 L F2X 4XK22 TABLE 2 18 1 4 22 PIN SUMMARY CONTINUED HE ooo SS
3. 43 Test Plan and 48 CONCIUSIONS MH 52 Madii ce D 53 EE 54 M 54 User 55 Datasheets asii 58 igo DR 58 Motor Driver Freescale 33926 60 Ultrasonic Distance Sensor MaxBotics XL MaxSonar AE4 1340 85 MCU Microchip PIC18FA6K22 Partial 90 Buzzer Mallory 5 1240 11 0 94 Introduction An Autonomous Vehicular Trailer is a vehicle designed to be a trailer that follows behind a lead vehicle adjusting its velocity as necessary to maintain its relative position with the lead vehicle This trailer is autonomous in that there are no direct communications controls from the lead vehicle to the trailer The trailer itself senses the location of the lead vehicle and adjusts its own velocity to automatically follow behind the lead vehicle We will construct the trailer using a kit based tracked vehicle with two DC motors one for each track connected to a motor control unit that is in turn controlled by our PIC18 microcontroller In
4. M DS41412E page 10 Preliminary 2010 2012 Microchip Technology Inc Buzzer Mallory AST1240MLTRQ Mallory Sonalert Products Inc AST1240MLTRQ Sales Outline Drawing TAS A Specifications Resonant Frequency Hz 4000 500 Operating Voltage Vp p 25 Rated Voltage Vp p 3 Current Consumption mA max 5 at Rated Voltage Sound Pressure Level Min dB 75 at 10cm at Rated Voltage Capacitance pF 16 000 30 at 120 Hz Operating Temperature C 20 70 Storage Temperature C 30 80 Housing LCP Plastic Resin Color Black Type of Connection Terminals SMD Tin Plated Brass Condition by reflow soldering C 245 5 C 1 min Condition by hand soldering C 350 20 C within 5 sec Weight Grams 1 Options For other options contact factory PS Vp p 1 2duty square wave RoHS Compliant Dimensions units mm Recommended Foot Pattern Sound AS 1240MLQ Recommend Driving Circuit LIL Doty 1 2 Square wave Packaging Parts are supplied on reels 1000 per tape and reel Units do not come with wash label and are not appropriate for aqueous wash 4411 South High School Road Indianapolis Indiana 46241 USA Phone 317 612 1000 Fax 317 612 1010 http www mallory sonalert com
5. 15 subwf PD SensorDist W A Set zero flag if diff is not zero clear zero flag bsf PD Status PDSTAT TGT ZERO A tstfsz WREG A bcf PD Status PDSTAT TGT ZERO A Remember our distance change movwf PD DistOff A Now to determin if we are closer to the LV or not Start by clearing closer flag bcf PD Status PDSTAT CLOSER TGT p both TgtBelow and SensorHiger are true H or both TgtBelow and SensorHiger are false we are closer btfss PD Status PDSTAT TGT BELOW A bra PD MV CL CheckNotHigh btfss PD Status PDSTAT SENSOR HIGHER A bra PD MV CL Done bra PD MV CL SetCloser PD MV CL CheckNotHigh btfsc PD Status PDSTAT SENSOR HIGHER A bra PD MV CL Done fall through to set closer flag PD MV CL SetCloser are closer so set closer flag 5 PD Status PDSTAT CLOSER TGT PD MV CL Done we now have all the inputs we need so lets go figure out any motor power and or direction changes that we need if we exactly on target AND distance hasn t changed btfss PD Status PDSTAT TGT ZERO A bra PD MV CheckForward btfss PD Status PDSTAT DIST ZERO A bra PD MV CheckForward there s no change to made PD Done PD MV CheckForward First take look at what we need to do if are moving forward we are moving backward go to CheckReverse 14 btfsc PD S
6. Title Dual motor driver SC3 Document N Revision A 0001 1 0 Date 2012 05 05 Sheet 4 of 5 ____ __ gt 2 11 1 SONAR AN IN BUZZER_OUT RA0 AN0 C12IN0 RA1 AN1 C12IN1 RA2 AN2 C2IN VREF DACOUT RA3 AN3 C1IN VREF RA4 C1OUT SRQ TOCRI RAS AN4 CZOUI SRNQ HLVDIN 331 RAE OSC2 CLRO 1 RB0 AN12 SRI FLIO INIO RB1 AN10 C12IN3 INT1 RB2 ANE CTED1 INT2 RB3 ANS C12IN2 CTED2 CCP2 P2A RB4 AN11 T5G IOC RB5 AN13 CCP3 P3A TIG T3CKI IOC RB6 IOC RB7 IOC 332 0 5 8 RE1 AN6 P3B RE2 AN7 CCES MCLR RE3 VEP RDO AN20 3DK2 SCL2 RD1 AN21 CCP4 SDI2 SDA2 RD2 AN22 P2B RD3 AN23 P2C 332 RD4 AN24 P2D 3D02 RDS AN25 P1B RDE AN26 P1C TX2 CK2 RD7 AN27 P1D RX2 DT2 2 6 1 2 2 303 RC2 AN14 CTPLS CCP1 P1A TSCRI HAZARD_LED 0 2 M2DIR1 M2DIRO RC3 AN15 SCK1 SCL1 RC4 AN16 SD11 SDA 2 RC5 AN17 3DOi M1DIR1 RC6 AN18 TX1 CK1 RC7 AN19 RX1 DT1 PIC18F46K22 Final Project Smart Trailer Group Conor Cahil Adam Morse and Steve Hopkins Title MCU SC6 Document N 0001 Date 2012 05 05 Test Plan and Results The objective in testing the Autonomous Trailer is to determine the success of both the hardware and software design Each functional component of the syste
7. bsf HZ PORT HZ PIN the countdown counter HZ CYCLE ON COUNT movwf HZ Counter A flag that they are bsf HZ Status HZSTAT ON A 70 Done return end Utilities asm Functions Purpose Parameters Returns Notes Delay 8 Delay S Outer Delay S Inner Function Purpose Parameters Returns Notes LIST P PIC18F46K22 list directive to define processor INCLUDE P18F46K22 INC processor specific variable definitions INCLUDE AutonomousTrailer inc Definitions for our project Define entry points that will be accessible from outside this file global Delay S Delay MS Start of the code section Delay S to delay exeuction for a specified number of seconds Argl of seconds to delay nothing of any value We use the thousandths of a second delay function to do the movff Argl p 10 105 movwf Util movlw D 100 movwf Arg real work and just loop through successive calls of delays of 100 thousandths of a second UtilDS Outer call Delay_MS decfsz Util 105 _5 decfsz Util IDS Outer F bra Delay S Outer return Delay MS to delay exeuction for a specified number of thousandths of a second 1 255 so 10 1 100 second Argl of hundredths of a second to delay not
8. btfss MainStatus MSTAT BIT LOST A bra MainProcess Turn off hazards motor will clear after process data Call HazardsDisable clear lost status MainStatus MSTAT LOST A Go process the sensor data and calculate the motor movff MainSensorReading Argl Call ProcessData remember if ProcessData set the reverse direction bcf MainStatus MSTAT BIT NEED BKWRD A tstfsz Result2 A bsf MainStatus MSTAT BIT NEED BKWRD A Update the motor settings with results from ProcessData movff Resultl Argl movff Result2 Arg2 Call MotorUpdate if the backward bit isn t set skip backwards code 14 btfsc MainStatus MSTAT NEED BKWRD A bra MainMovingForward backward status is alread set skip setup code F btfss MainStatus MSTAT BIT BKWRD A bra MainBackward Process Set backward status 7 bsf MainStatus MSTAT BIT BKWRD A enable the backward beeper call BackupBeeperEnable bra MainLoopDone no args return MainBackward Process Update the backward beeper Call BackupBeeperUpdate MainMovingForward MainLoopDone FINISHED we were not moving backwards skip past cleanup code btfsc MainStatus MSTAT BIT BKWRD A bra MainLoopDone Turn off backup beeper 11 BackupBeeperDisable clear backup status bcf MainStatus MSTAT BIT BKWRD A Delay 50
9. at 2 meters Conditions 1 5 Target ranges at 200cm 20 C 5V meter wide hallway with cluttered sides ANALOG ENVELOPE V 8 1 5 meter wide hallway Object clutter from many objects at the sides of the 10ms DIV MaxBotix Inc MaxBotix MaxSonar EZ4 amp AE4 are trademarks of MaxBotix Inc XL EZ4 XL AE4 v1 5b Patents 7 679 996 Copyright 2005 2011 ANALOG ENVELOPE V MB1240 MB1340 Analog Envelope Output Clutter 3 3V N Transmit Burst 20 C 3 3V or MB1240 internal Target ranges 8t 2 meters at 200cm Realtime on Pin 2 of MB1340 Target 30cm sq Conditions 1 5 meter wide hallway with cluttered sides 1 5 meter Object clutter from wide hallway any objects at sides ofthe 10ms DIV Page 5 Email info maxbotix com Web www maxbotix com PD10018b MCU Microchip PIC18F46K22 Partial S MICROCHIP PIC18 L F2X 4XK22 28 40 44 Pin Low Power High Performance Microcontrollers with nano Watt XLP Technology High Performance RISC CPU C Compiler Optimized Architecture Optional extended instruction set designed to optimize re entrant code Up to 1024 Bytes Data EEPROM Up to 64 Kbytes Linear Program Memory Addressing Up to 3896 Bytes Linear Data Memory Address ng Up to 16 MIPS Operation 16 bit Wide Instruction
10. 42 42 42 42 42 42 UtilDMS Inner F decfsz UtilDMS Middle F bra MiddleLoop decfsz UtilDMS Outer F bra OuterLoop return end AutonomousTrailer inc Global defined values and register definitions for the Autonomous Trailer project Sensor definitions SNSR LOSTVEHICLE equ OxFF ProcessData definitions PD DIRECT equ D 0 PD DIRECT REV equ D 1 Motor control Definitions 51 DIR equ 0 Set to 1 if we are moving backwards Function Call Interface Registers Argl set 0x01 Arg2 set 0x02 Arg3 set 0x03 Result1l set 0x05 Result2 set 0x06 Result3 set 0x07 Main Loop registers MainStatus set 0x10 MainSensorReading set 0 11 Sensor Hazard Beeper registers HZ Status set 0x20 HZ Counter set 0x21 BE Status set 0x22 BE Counter set 0x23 Motor Control Registers MotorStatus set 0x30 MotorSettings set 0x31 g Utility Registers 7 061105 Outer set 0x40 UtilDS Inner set 0x41 UtilDMS Outer set 0x42 UtilDMS Middle set 0x43 UtilDMS Inner set 0x44 ProcessData Registers PD Status set 0x50 PD PrevMPower set 0x51 the current motor setting PD NewMPower set 0x52 PD NewDir set 0x53 PD_PrevDir set 0x54 PD_DistChange set 0x55 PD DistOff PD Tmp PD SensorDist set 0x56 set 0x57 set 0x58 PD PowerChange set 0x59 PD PrevDist Timers P Timer2 Set 0x5A cont
11. IN2 D1 internal pull ups VIL 80 20 Notes 10 Device specifications are characterized over the range of 8 0 V lt Vpyyg x 28 V Continuous operation above 28 V may degrade device reliability Device is operational down to 5 0 V but below 8 0 V the output resistance may increase by 50 percent 11 Device will survive the transient overvoltage indicated for a maximum duration of 500 ms Transient not to be repeated more than once every 10 seconds 12 lpwm sLEEp is with Sleep mode activated and D2 INV SLEW logic 0 and IN1 2 D1 logic 1 or with these inputs left floating 13 SLEW input voltage hysteresis is guaranteed by design 33926 Analog Integrated Circuit Device Data Freescale Semiconductor 7 ELECTRICAL CHARACTERISTICS STATIC ELECTRICAL CHARACTERISTICS Table 3 Static Electrical Characteristics continued Characteristics noted under conditions 8 0 V lt Vpwr x 28 V 40 C lt Ta lt 125 C GND 0 V unless otherwise noted Typical values noted reflect the approximate parameter means at T4 25 under nominal conditions unless otherwise noted POWER OUTPUTS OUT1 OUT2 Output ON Resistance 19 I 3 0 A Vpwr 8 0 V Ty 25 C Vpwn 8 0 V 150 C 5 0 V 150 C Output Current Regulation Threshold lum lt Tre gt Fold back Region see Figure 9 and Figure 11 09 rn High Side Short circuit Detection Thre
12. absolute value If SensorDistance lt PrevDistance movf PD PrevDist W A cpfslt PD SensorDist bra PD MV SD GT diff PrevDist SensorDistance clrf STATUS A clear borrow bits subfwb PD SensorDist W A SensorDistance is not higher than PrevDistance so clear flag PD Status PDSTAT SENSOR HIGHER bra PD MV SD Done diff SensorDistance PrevDistance 14 subwf PD SensorDist W A if distance same wreg 0 tstfsz WREG A bra PD MV SD SetHigher set zero bit and clear higher bit bof PD Status PDSTAT SENSOR HIGHER bsf PD Status PDSTAT DIST ZERO A bra PD MV SD Done PD SD SetHigher PD MV SD Done PD MV TGT GT PD MV TGT Done higher flag and clear zero flag bsf PD Status PDSTAT SENSOR HIGHER bcf PD Status PDSTAT DIST ZERO A Remember our distance change movwf PD DistChange A calculate how far we are off the target distance remember if we are below above same as target distance SensorDistance lt TargetDistance TARGET DIST cpfslt PD SensorDist bra PD MV TGT GT diff TargetDistance SensorDistance PD Status closer TRUE clrf STATUS A clear borrow bits subfwb PD SensorDist W A bsf PD Status PDSTAT TGT BELOW A bra PD MV TGT Done we aren t Tgt so clear below flag bcf PD Status PDSTAT TGT BELOW A diff SensorDistance
13. according to the standards listed below Note For package dimensions refer to the 33926 data sheet STANDARDS Table 6 Thermal Performance Comparison Thermal Resistance Cw 1 0 ame 0500 of ojo o Fo o o o measurements 1 Per JESD51 2 at natural convection still air eife oTo o o o o in millimeters condition 2 2s2p thermal test board JESD51 5 and JESD51 7 3 Per JEDEC JESD51 8 with the board temperature on the center trace near the center lead 4 Single layer thermal test board per JEDEC JESD51 3 and JESD51 5 Figure 15 Surface Mount for Power 5 Thermal resistance between the die junction and the with Exposed Pads exposed pad surface cold plate attached to the package bottom side remaining surfaces insulated 33926 Analog Integrated Circuit Device Data Freescale Semiconductor 21 ADDITIONAL DOCUMENTATION THERMAL ADDENDUM REV 2 0 E 2 d 0 o Zeger 58555 5 gt IN2 NC x IN1 PGND SLEW PGND 5 VPWR PGND AGND SF VPWR PGND INV PGND FB PGND 0 0 0 NC NC 2 u y Y 33926 Pin Connections 32 0 80 mm Pitch 8 0 mm x 8 0 mm Body Figure 16 Thermal Test Board
14. and MCU 16MHz device frequency therefore use Fosc 32 as the ADC clock giving a period of 2microsecond p299 ACQT 2 0 100 If we assume maximum temp of 50C utilizing TACQ formula there is a still good deal of variation depending on the sensor impedance unknown at this point But based on a 2 5kohm impedance the text p577 calculates TACQ 13microsec be conservative we can use 8 TAD ADFM 1 right justify results in ADRESL ADRESH ADCON2 B 10100010 Read Sensor Value readSensor 4 Begin acquisition conversion sampling loop Start conversion ADCONO lt set GO bit Test if conversion is finished before proceeding If ADCONO lt GO DONE gt 1 Return to test again with branch loop Test for system error by testing ADRESH value If bits or 1 are set then WREG must give error code OxFF If there is no error place ADRESL into WREG as returned value If ADRESH 0 1 poll for errors in the first bit of ADRESH WREG OxFF set error code Else WREG ADRESL ADRESH 1 1 poll for errors in the first bit of ADRESH WREG OxFF set error code Else WREG ADRESL Delay 2TAD before returning to readSensor start Motor Control Pseudo code MotorControl txt pseudocode for MotorControl functions MotorInit called to initialize the Motor Control system F We are using PWMs to control each mot
15. i Function ProcessDataLost Purpose To reset things when we ve lost the LV Parameters none Returns Nothing of any value Notes Just call ProcessDataInit to do the work ProcessDataLost call ProcessDataInit return Function ProcessData Purpose To process the sensor distance data an determine a motor control power setting that will maintain the desired following distance Parameters argl the distance to the lead vehicle in centimeters Returns Resultl a pwer setting from 0 to 1005 for the motor control Result2 a direction bit l reverse 0 forward Notes Our goal is to follow along 50cm behind the lead vehicle LV and we allow 10cm range 5CM that we consider to be within range As the distance increases we increase the power to the motor in order to catch up and get A withiin the appropriate distance When we start catching up we start to decrease the power so that we ease into the desired range rather than having A an abrupt power change once we re in range when the vehicle does go out of the desired range we try to bring it back to the exact midpoint of the range and then allow the range to take place In order to prevent radical jerky changes in motor power we will limit the power change per operation to 20 ProcessData Save the parameter distance sensor reading movff Argl PD SensorDist ge
16. 1 Logic input control of OUT1 e g when is logic HIGH OUT1 is set to Vpwg and when IN1 is logic LOW OUT1 is set to PGND Schmitt trigger Input with 780 pA source so default condition HIGH Slew Rate Logic input to select fast or slow slew rate Schmitt trigger input with 80 pA sink so default condition 7 slow Positive Power These pins must be connected together physically as close as possible and Supply directly soldered down to a wide thick low resistance supply plane on the PCB Analog Signal The low current analog signal ground must be connected to PGND low Ground impedance path 10 0 Hz to 20 kHz Exposed copper pad is also the main heatsinking path for the device Sets IN1 IN2 to logic LOW TRUE Schmitt trigger input with 80 uA sink so default condition non inverted Load current feedback output provides ground referenced 0 2496 of H Bridge high side output current Tie pin to GND through a resistor if not used When EN is logic HIGH the device is operational When EN is logic LOW the device is placed in Sleep mode logic input with 80 uA sink so default condition 2 Sleep mode 33926 Analog Integrated Circuit Device Data Freescale Semiconductor 3 5 Table 1 33926 Pin Definitions continued A functional description of each pin can be found in the Functional Description section beginning on page 12 12 13 OUT1 Power H Bridge Out
17. 20 kHz A load current feedback feature provides a proportional 0 2496 of the load current current output suitable for monitoring by a microcontroller s A D input A Status Flag output reports under voltage over current and over temperature fault conditions Two independent inputs provide polarity control of two half bridge totem pole outputs Two independent disable inputs are provided to force the H Bridge outputs to tri state high impedance off state An AUTOMOTIVE THROTTLE H BRIDGE ACTUATOR MOTOR EXCITER Bottom View inverted input changes the IN1 and IN2 inputs to LOW true logic PNB SUFFIX Pb FREE 98ARL10579D Features 32 PIN PQFN 80to28 V continuous operation transient operation from 5 0 to 40 V 225 maximum 150 C each H Bridge MOSFET ORDERING INFORMATION 3 0Vand 5 0 5 logic compatible inputs Temperature Over current limiting Regulation via an internal constant off time R Output short circuit protection short to VPWR ground MC33926PNB R2 40 C to 125 C 2 Temperature dependent current limit threshold reduction All Inputs have an internal source sink to define the default floating input states Sleep mode with current draw lt 50 pA with inputs floating or set to match default logic states Pb free packaging designated by suffix code PNB Figure 1 33926 Simplifi
18. Hozan Lights Disable them Enabled No Process Data Adjust Motor Setting s Moving Yes Backwards Beeper No Backup Beeper Yes Enabled Beeper No Loop Delay Sensor Control Pseudo code Algorithm for initializing and reading ultrasonic distance sensor Parameters None Outputs WREG and ADRESL will contain a regularly updated 8 bit value representing distance in cm 1 bit per cm Global Data Oscillator will be configured to 16MHz Persistent Data When bits 0 or 1 ADRESH are set this indicates a distance sensor error and error code WREG OxFF is given Temporary Data Algorithm FR IR RR RE A AE REI RAE RID IS AE BE ASAE IS ER AE IR ISIE RECS ITE EGRE TI e eee eee Initialize Sensor initSensor Set TRISA pin RA2 to input and ANSELA pin RA2 to configure analog TRISA set bit 2 ANSELA set bit 2 Configure ADCONO ADCON1 ADCON2 ADCONO comments move right to left from LSB ignoring unused bits lt 0 gt 1 initialize ADC CHS 4 0 00010 Channel select AN2 ADCONO B 00001001 ADCON1 PVCFG 1 0 00 positive voltage reference set to MCU internal 5V NVCFG 1 0 00 negative voltage reference set to MCU internal ADCON1 lt B 00000000 ADCON2 ADCS 2 0 010 Assume TAD gt 1 6microsecond from lecture
19. addition we plan to use an ultrasonic sensor to determine the distance between the trailer and the lead vehicle and LED indicators to represent hazard lights The trailer will only adjust itself to movement in a straight line direction It will not turn to follow the lead vehicle should the lead vehicle turn If the trailer does not sense the lead vehicle or loses track of the lead vehicle it will stop and turn on its hazard lights and await the return of the lead vehicle The software control will continuously monitor the distance between the lead vehicle and the trailer and will use this information to also calculate the relative velocity and relative acceleration In addition separate wheel sensors will be used to monitor the absolute velocity of the trailer The absolute velocity of the trailer will be used to define a target distance range for the trailer getting higher as the velocity increases to allow for additional response distance The distance relative velocity and relative acceleration will be used to control the power provided to the motors in order to control the acceleration of the trailer in an efficient manner We plan to use a proportional integral derivative PID algorithm to determine the amount of power to send to the motors in order to maintain the appropriate distance from the lead vehicle The motors will also be used to provide braking force when necessary in order to maintain the appropriate separation distance when th
20. flag is SET logic LOW Upon under voltage recovery status flag is reset automatically or automatically cleared and the outputs are restored to their original operating condition 31 When short circuit over temperature condition is detected the power outputs are tri state latched OFF independent of the input signals and the status flag is latched to logic LOW To reset from this condition requires the toggling of either D1 D2 EN or NI N N N N NTN x x x x Forward High Side Recirculation Reverse Low Side Recirculation VPWR Forward VPWR VeWR Forward v 9 VPWR VewR D VPWR PWR Load Current Load Current PGND PGND Figure 12 33926 Power Stage Operation 33926 Analog Integrated Circuit Device Data 16 Freescale Semiconductor FUNCTIONAL DEVICE OPERATION PROTECTION AND DIAGNOSTIC FEATURES PROTECTION AND DIAGNOSTIC FEATURES SHORT CIRCUIT PROTECTION If an output short circuit condition is detected the power outputs tri state latch OFF independent of the input IN1 and IN2 states and the fault status output flag SF is SET toa logic LOW If the D1 input changes from a logic HIGH to logic LOW or if the D2 input changes from a logic LOW to logic HIGH the output bridge will become operational again and the fault status flag will be reset cleared to a logic HIGH state The output stage will always switch into the mode defined by the input pins IN1 IN2 D1 and D2 p
21. half bridge outputs An input invert INV changes IN1 and IN2 to LOW true logic Two different output slew rates are selectable via the SLEW input Two independent disable inputs D1 and D2 provide the means to force the H Bridge outputs to a high impedance state all H Bridge switches OFF An EN pin controls an enable function that allows the IC to be placed in a power conserving Sleep mode The 33926 has Output Current Limiting via Constant OFF Time PWM Current Regulation Output Short circuit Detection with Latch OFF and Over temperature Detection with Latch OFF Once the device is latched OFF due to a fault condition either of the Disable inputs D1 or D2 Vpwn or EN must be toggled to clear the status flag Current limiting Load Current Regulation is accomplished by a constant OFF time PWM method using current limit threshold triggering The current limiting scheme is unique in that it incorporates a junction temperature dependent current limit threshold This means that the current limit threshold is reduced to around 4 2 A as the junction temperature increases above 160 C When the temperature is above 175 C over temperature shutdown latch OFF will occur This combination of features allows the deviceto continue operating for short periods of time 30 seconds with unexpected loads while still retaining adequate protection for both the device and the load FUNCTIONAL PIN DESCRIPTION POWER GROUND AND AN
22. kHz Peripheral Module Disable Special Microcontroller Features Full 5 5V Operation PIC18FXXK22 devices 1 8V to 3 6V Operation PICT8LEXXK22 devices Self Programmable under Software Control High Low Voltage Detection HLVD module Programmable 16 Level Interrupt on High Low Voltage Detection Programmable Brown out Reset With software enable option Configurable shutdown in Sleep Extended Watchdog Timer WDT Programmable period from 4 ms to 131s In Circuit Serial Programming ICSP V Single Supply 3V Debug ICD Peripheral Highlights Up to 35 Pins plus 1 Input Only Pin High Current Sink Source 25 mA 25 mA Three programmable external interrupts Four programmable interrupt on change Nine programmable weak pull ups Programmable slew rate SRLatch Multiple Set Reset input options Two Capture Compare PWM CCP modules Three Enhanced CCP ECCP modules One two or four PWM outputs Selectable polarity Programmable dead time Auto Shutdown and Auto Restart PWM steering Two Master Synchronous Serial Port MSSP modules 3 wire SPI supports all 4 modes Master and Slave modes with address mask 2010 2012 Microchip Technology Inc Preliminary DS41412E page 3 PIC18 L F2X 4XK22 PIC18 L F2XK22 PIN SUMMARY TABLE 1 em uses m Im mum mug m m m du ui
23. the power dissipation thermal resistance and heat sinking provided Brief non repetitive excursions of junction temperature above 150 C can be tolerated provided the duration does not exceed 30 seconds maximum Non repetitive events are defined as not occurring more than once in 24 hours 33926 Analog Integrated Circuit Device Data Freescale Semiconductor 5 ELECTRICAL CHARACTERISTICS MAXIMUM RATINGS Table 2 Maximum Ratings continued All voltages are with respect to ground unless otherwise noted Exceeding these ratings may cause a malfunction or permanent damage to the device These parameters are not production tested Approximate Junction to Case Thermal Resistance 9 7 Pin soldering temperature limit is for 10 seconds maximum duration Not designed for immersion soldering Exceeding these limits may cause malfunction or permanent damage to the device 8 Freescale s Package Reflow capability meets Pb free requirements for JEDEC standard J STD 020C for Peak Package Reflow Temperature and Moisture Sensitivity Levels MSL 9 Exposed heatsink pad plus the power and ground pins comprise the main heat conduction paths The actual Rag junction to PC board values will vary depending on solder thickness and composition and copper trace thickness and area Maximum current at maximum die temperature represents 16 W of conduction loss heating in the diagonal pair of output MOSFETs Therefore the Raya must be 5 0 CAW for maximum cu
24. turn on the output DUTYC movwf CCPR3L BANKED F reset BSR 0 00 return s Functions BackupBeeperDisable Purpose To Enable the backup Beeper Parameters None Returns None Notes g BackupBeeperDisable SFRs for the backup beeper are outside of the access bank so we need to load the BSR and use it for operations movlb turn off the PWM g movlw BE_PWM_OFF_DUTYC movwf CCPR3L BANKED turn off the bcf BE PORT BE PIN set status to disabled bcf BE Status BESTAT ENABLED A reset BSR movlb 0x00 return Function BackupBeeperUpdate Purpose To update the BackupBeeper status turn on off each iteration Parameters None Returns None Notes BackupBeeperUpdate decrement the countdown counter and return if not zero decfsz BE Counter F A bra BEU Done if we get here the counter has run out so time to change the State of the beeper The SFRs for the backup beeper are outside of the access bank so we need to load the BSR and use it for operations movlb Oxf if they are on btfss BE Status BESTAT ON A bra BEU TurnEmOn turn off the OFF DUTYC CCPR3L BANKED set the off countdown counter movlw CYCLE OFF COUNT movwf BE Coun
25. width representation of is shown to provide the user with detailed range To calculate distance use the scale factor of 58uS per cm connection information 1340 AE This pin outputs the analog voltage envelope of the acoustic wave form Pin3 AN This pin outputs analog voltage with a scaling factor of Vcc 1024 per A supply of 5V yields 4 9mV cm and 3 3V yields 3 2mV cm Hardware limits the maximum reported range on this output to 700 at 5V and 600 at 3 3V The output is buffered and corresponds to the most recent range data Pin 4 This pin is intemally pulled high The MB1240 amp MB1340 will continually measure range and output if the pin is left unconnected or held high If held low the MB1240 amp MB1340 will stop ranging Bring high 20uS or more for range reading Pin 5 TX When Pin 1 is open or held high the Pin 5 output delivers asynchronous serial with RS232 format except voltages 0 The output is an ASCII capital followed by three ASCII character digits representing the range in centimeters up to a maximum of 765 followed by a carriage return ASCII 13 The baud rate is 9600 8 bits no parity with one stop bit Although the voltage of 0 Vcc is outside the RS232 standard most RS232 devices have sufficient margin to read 0 Vee serial data If standard voltage level RS232 is desired invert and connect an RS232 converter such as 232 When Pin 1 is hel
26. zero clrf bra PD NewMPower MV RedDone PD MV RedSubtract PD MV RedDone PD MV OKPower PD Done add the pwer change into the motor power movf PD PowerChange W A subwf PD NewMPower F A bra PD Done Nothing to do power is already PD Done if NewMPower is greater than 100 limit it to 100 movlw D 100 cpfslt PD NewMPower A movwf PD NewMPower A save the old distance value movff PD SensorDist PD PrevDist Save the new settings for power 5 direction place them in the return registers movff PD NewMPower PD PrevMPower movff PD NewMPower Resultl1 movff PD NewDir PD PrevDir movff PD NewDir Result2 return end MotorControl asm MotorControl asm definition of functions used to setup control the motors LIST P PIC18F46K22 list directive to define processor INCLUDE P18F46K22 1NC processor specific variable definitions INCLUDE AutonomousTrailer inc Definitions for our project Local definitions MSTAT REVERSE equ 0x01 MOTOR SET FWD equ b 11010000 MOTOR SET REV equ b 10101000 MOTOR SET OFF equ b 01010000 Define entry points that will be accessible from outside this file global MotorInit MotorUpdate MotorEmergencyStop Start of the code section Function MotorInit Purpose Initialize the Motor Controls Parameters None Returns
27. 00 Lowesr 100 nF VPWR B ye ee UT 33 1 33 V LOGIC SUPPLY TO GATES HS1 o Nt th 151 H 52 02 GATE DRIVE 7152 o mien L PROTECTION CURRENT MIRRORS FLAG Ux T PE SF JUUL PWM CURRENT REGULATOR ADC Rfg 270 Se t i Figure 14 33926 Typical Application Schematic 33926 Analog Integrated Circuit Device Data 18 Freescale Semiconductor PACKAGING PACKAGE DIMENSIONS PACKAGING PACKAGE DIMENSIONS For the most current package revision visit www freescale com and perform a keyword search using the 98 listed below PIN 1 INDEX AREA EXPOSED METAL PAD DETAIL N 0 100 e soi OE ENOL OUTLINE VERSON SOM DOCUMENT 98ARL10579D REV 31 OCT 2006 TE POWER QUAD FLAT NON LEADED PACKAGE PWR QFN 32 TERMINAL 0 8 8 8 2 1 PNB SUFFIX 98ARL10579D 32 PIN PQFN ISSUEC 33926 Analog Integrated Circuit Device Data 19 Freescale Semiconductor PACKAGING PACKAGE DIMENSIONS 28X 0 05 0 92 2X 0978 4 PLACES 910 14 0 056 CORNER CONFIGURA TION 22 220 20 1 9
28. 1240 intemal Targets 0 6 dia at 66cm 2 5cm dia at 111cm 8 9cm dia at 189cm and a 1m by 2m flat panel at 704cm Target First target ranges at 66cm Conditions acoustic test chamber B 10ms DIV are trademarks of MaxBotix Inc XL E24 XL AE4 v1 5b Patents 7 679 996 Copyright 2005 2011 MB1240 MB1340 Analog Envelope Output Dowels 3 3V 2 Transmit ANALOG ENVELOPE V T 20 C 3 3V Real time on Pin 2 of MB1340 or MB 1240 intemal Targets 0 6 dia at 66cm 2 5cm dia at 111cm 8 9cm dia at 189cm and a 1m by 2m flat panel at 704cm First target ranges at 66cm Conditions 7 acoustic test chamber 10ms DIV Analog Envelope Output Dowels 3 3V 0 6 Burst a Ta e ANALOG ENVELOPE V gt a 0 4 Transmit dia at 66cm T 20 C vec 33v 2007 Real time on Pin 2 of MB1340 MB1240 internal rgets Targets 2 5cm dia at 111 8 9cm dia at 189 and 1m by 2m flat panel at 704cm First target ranges at 66cm Conditions 7 acoustic test chamber 4 10ms DIV Page 4 Email info maxbotix com Web www maxbotix com PD10018b Typical Performance Clutter Analog Envelope Output Clutter 5V _ Transmit Burst 3 Realtime on Pin 2 of MB1340 or MB 1240 intemal Target 30cm sq
29. 5 SEATING PLANE DETAIL G VIEW ROTATED 90 CW FREESCALE SEMICONDUCTOR INC MECHANICAL OUTLINE PRINT VERSION NOT SCALE TITLE POWER QUAD FLAT DOCUMENT 98ARL10579D REV NON LEADED PACKAGE PWR QFN 31 2006 32 TERMINAL 0 8 PITCH 8X8X2 1 STANDARD JEDEC MO 251A ADDB 1 PNB SUFFIX 98ARL10579D 32 PIN PQFN ISSUEC 33926 Analog Integrated Circuit Device Data 20 Freescale Semiconductor ADDITIONAL DOCUMENTATION THERMAL ADDENDUM REV 2 0 ADDITIONAL DOCUMENTATION THERMAL ADDENDUM REV 2 0 Introduction This thermal addendum is provided as a supplement to the 33926 technical datasheet The addendum provides thermal performance information that may be critical in the design and development of system applications All electrical application and packaging information is provided in the datasheet Packaging and Thermal Considerations The 33926 is offered in a 32 pin PQFN single die package There is a single heat source P a single junction temperature T j and thermal resistance Raja Ty di Ron PNB SUFFIX 98ARL10579D The stated values are solely for a thermal performance comparison of one 32 PQFN package to another in a standardized environment This methodology is not meant 8 0 mm x 8 0 mm to and will not predict the performance of a package in an application specific environment Stated values were obtained by measurement and simulation
30. ALOG GROUND PGND AND AGND The power and analog ground pins should be connected together with a very low impedance connection POSITIVE POWER SUPPLY VPWR VPWR pins are the power supply inputs to the device VPWR pins must be connected together on the printed circuit board with as short as possible traces offering as low impedance as possible between pins Transients on Vpyg which go below the Under voltage Threshold will result in the protection activating It is essential to use an input filter capacitor of sufficient size and low ESR to sustain Vpyg greater than Vyy_o when the load is Switched See 33926 Typical Application Schematic on page 18 STATUS FLAG SF This pin is the device fault status output This output is an active LOW open drain structure requiring a pull up resistor to Vpp The maximum Vpp is 7 0 V Refer to Table 5 Truth Table page 16 for the SF Output status definition INPUT INVERT INV The Input Invert Control pin sets IN1 and IN2 to LOW TRUE This is a Schmitt trigger input with 80 sink the default condition is non inverted If IN1 and IN2 are set so 33926 12 thatthe current is being commanded to flow through the load attached between OUT1 and OUT2 changing the logic level at INV will have the effect of reversing the direction of current commanded Thus the INV input may be used as a forward reverse command input If both IN1 and IN2 are the same logic level then chang
31. Autonomous Vehicular Trailer EE 452 Final Project Spring 2012 Conor Cahill Steven Hopkins and Adam Morse Abstract Today s vehicles with cruise control typically lock the speed to a fixed set point Problems arise when the speed of the lead traffic varies causing the drivers to have to manually adjust the set speed A simple addition of a distance sensor opens up the possibility to follow the leading vehicle and maintain a fixed safe distance This project implements one such method of following a lead vehicle using an ultrasonic distance sensor to measure the distance A microcontroller plus code contain the algorithm necessary to adjust the power of the motors to maintain the proper distance In the future this algorithm could be expanded to take other variables into account such as requested speed and collision avoidance Table of Contents EP E 2 Technical L 3 Block RERO ERE 3 Software Systems ste oe dde 4 Algorithm sostener E 4 COME D 10 Hardware Systems eet de 42 Hardware 42 CS
32. Bridge high side drivers When running in the forward or reverse direction a ground referenced 0 2496 of load current is outputto this pin Through the use of an external resistor to ground the proportional feedback current can be converted to a proportional voltage equivalent and the controlling microcontroller can read the current proportional voltage with its analog to digital converter ADC This is intended to provide the user with only first order motor current feedback for motor torque control The resistance range for the linear operation of the FB pin is 100 Reg 300 Q If PWM ing is implemented using the disable pin inputs either D1 or D2 a small filter capacitor 1 0 may be required in parallel with the Reg resistor to ground for spike suppression 33926 13 FUNCTIONAL INTERNAL BLOCK DESCRIPTION FUNCTIONAL PIN DESCRIPTION FUNCTIONAL INTERNAL BLOCK DESCRIPTION GATE CONTROL LOGIC ANALOG CONTROL AND PROTECTION H BRIDGE OUTPUT DRIVERS OUT1 OUT2 Figure 10 Functional Internal Block Diagram ANALOG CONTROL AND PROTECTION CIRCUITRY The on chip voltage regulator supplies 3 3 V tothe internal logic The charge pump provides gate drive for the H Bridge MOSFETSs The current and temperature sense circuitry provides detection and protection for the output drivers Output under voltage protection shuts down the MOSFETS GATE CONTROL LOGIC The 33926 is a monolithic H Bridge P
33. Device on Thermal Test Board Table 7 Thermal Resistance Performance Material Single layer printed circuit board FRA 1 6 mm thickness Cu traces 0 07 mm thickness Outline 80 mm x 100 mm board area including edge connector for thermal testing Resa is the thermal resistance between die junction and Area A Cu heat spreading areas on board ambienta surface Ambient Conditions Natural convection still air 33926 Analog Integrated Circuit Device Data 22 Freescale Semiconductor ADDITIONAL DOCUMENTATION THERMAL ADDENDUM REV 2 0 Thermal Resistance C W 0 300 600 Heat Spreading Area A Figure 17 Device on Thermal Test Board Thermal Resistance CAN 1 00E 03 100602 1 00601 1 00 00 1 00 1 1 0062 1 0063 1 00 4 Time s Figure 18 Transient Thermal Resistance Roja 1 0 W Step response Device on Thermal Test Board Area A 600 mm 33926 Analog Integrated Circuit Device Data Freescale Semiconductor 23 REVISION HISTORY REVISION HISTORY 2 2007 Updated formatting and technical content throughout entire document Changed Human Body Model Charge Pump Voltage E Capacitor 33 No PWM 20kHz Slew Rate Fast Output Rise and Fall Time 27 Added second paragraph to Positive Power Supply VPWR Added Low ESR to 100uF on 33926 Typical Application Schematic 33926 Analog Integrated Circuit De
34. ERATURE SHUTDOWN AND HYSTERESIS If an over temperature condition occurs the power outputs are tri stated latched OFF and the fault status flag SF is SET to a logic LOW To reset from this condition D1 must change from a logic HIGH to logic LOW or D2 must change from a logic LOW to logic HIGH When reset the output stage switches ON again provided that the junction temperature is now below the over temperature threshold limit minus the hysteresis Important Resetting from the fault condition will clear the fault status flag Powering down and powering up the device will also reset the 33926 from the fault condition OUTPUT AVALANCHE PROTECTION If VPWR were to become an open circuit the outputs would likely tri state simultaneously due to the disable logic This could result in an unclamped inductive discharge The VPWR input to the 33926 should not exceed 40 V during this transient condition to prevent electrical overstress of the output drivers This can be accomplished with a zener clamp or MOV and or an appropriately valued input capacitor with sufficiently low ESR see Figure 13 Figure 13 Avalanche Protection 33926 17 TYPICAL APPLICATIONS INTRODUCTION TYPICAL APPLICATIONS INTRODUCTION A typical application schematic is shown in Figure 14 For environments the Vpyyg by pass capacitor may need to precision high current applications in harsh noisy substantially larger Vewr 1 1 1
35. Nothing of any value Notes MotorInit Configure the Timer 2 period register for mode have a 16Hz clock and desire a 15 frequency so 16M 4 4 15K 1 66 moviw d 66 movwf PR2 A configure and 2 pin on PORT C for output bcf TRISC CCP1 A bcf TRISC CCP2 PORTC A Clear Timer2 count and configure Timer2 as follows b72 0 unimplemented M b6 32 0000 no ouput post scaling H b2 1 enable timer H b1 02 01 prescaler is 4 so Timer FOSC 4 4 1Mhz 2 movlw b 00000101 movwf T2CON A Associate Timer2 with PWM1 and PWM2 movlb 0 0 movf CCPTMRSO W A andlw b 11100100 both C2TSEL and C1TSEL set to 0 movwf CCPTMRSO BANKED 0 00 2 b7 6 00 unimplmented b5 42 00 LOW order bits of Duty Cycle b3 02 1100 Enable Mode movlw 0 0 movwf movwf CCP2CON A Configure pins 7 3 on PortC for use as output motor control We are using 7 EN enable bit on motor control board RCO Motor 1 input 1 H RCS INZ 1 Motor 1 input 2 2 Motor 2 input 1 2 2 Motor 2 input 2 movf TRISC W A andlw b 00000111 clear TRISC bits lt 7 3 gt to set pins as output movwf TRISC A Start with the motor o
36. RG 0x0008 RETFIE ISRL ORG 0x0018 RETFIE Set clock to 16 mhz movf OSCCON W A andlw b 10001111 Clear bits iorlw b 01110000 set IRCF to 111 16 MHz movwf OSCCON A clear initialize our registers clrf MainStatus Initialize all of the components Call SensorInit Call MotorInit Call HazardsInit Call BackupBeeperInit Call ProcessDataInit Slight delay to let everything quiesce before starting processing movlw D 200 movwf Argl A Call Delay MS MainLoop Read the distance sensor no parameters to pass in 7 Call SensorRead Save the results movff Resultl MainSensorReading if there isn t an error skip the error handling code SNSR LOSTVEHICLE cpfseq MainSensorReading A bra MainSensorGood we are already lost btfsc MainStatus MSTAT BIT LOST A bra MainAlertDone Set the lost status bit 7 bsf MainStatus MSTAT LOST A We ve lost our lead vehicle so we need to enable the hazards lights and stop the trailer 11 HazardsEnable Call MotorEmergencyStop tell ProcessData we lost the vehicle Call ProcessDataLost MainAlertDone MainSensorGood MainProcess Update the hazard lights blinks them on off periodically r Call HazardsUpdate Skip to the end of the main loop bra MainLoopDone if we aren t in lost mode
37. The output load s inductance capacitance and resistance characteristics affect the total switching period OFF time ON time and thus the PWM frequency during current limit 23 Output Delay is the time duration from 1 5 on the IN1 or IN2 input signal to the 20 or 80 point dependent on the transition direction of the OUT1 or 2 signal If the output is transitioning HIGH to LOW the delay is from 1 5 V on the input signal to the 8096 point of the output response signal If the output is transitioning LOW to HIGH the delay is from 1 5 V on the input signal to the 2096 point of the output response signal See Figure 4 page 10 24 The time during which the internal constant OFF time PWM current regulation circuit has tri stated the output bridge 25 Thetime during which the current regulation threshold is ignored so that the short circuit detection threshold comparators may have time to act 26 Disable Delay Time measurement is defined in Figure 5 page 10 27 Rise Time is from the 10 to the 9096 level and Fall Time is from the 90 to the 10 level of the output signal with Vpyyp 14 V RLoan 3 0 ohm See Figure 6 page 10 28 Load currents ramping up to the current regulation threshold become limited at the value see Figure 7 The short circuit currents possess di dt that ramps up to the or lsc threshold during the 1 blanking time registering as a short circuit event detection and causing the shutdown ci
38. ated SF set Low 6 5 lour CURRENT A 0 0 Figure 8 Short circuit Detection Turn OFF Time Nominal Current Limit Threshold Current Limit Threshold Foldback Operation within this region must be limited to non repetitive events not to exceed 30s per 24 hr gt Thermal Shutdown CURRENT Figure 9 Output Current Limiting Foldback Region 33926 Analog Integrated Circuit Device Data Freescale Semiconductor 11 FUNCTIONAL DESCRIPTION INTRODUCTION FUNCTIONAL DESCRIPTION INTRODUCTION Numerous protection and operational features speed torque direction dynamic breaking PWM control and closed loop control make the 33926 a very attractive cost effective solution for controlling a broad range of small DC motors The 33926 outputs are capable of supporting peak DC load currents of up to 5 0 A from a 28 Vpwr source An internal charge pump and gate drive circuitry are provided that can support external PWM frequencies up to 20 kHz The 33926 has an analog feedback current mirror output pin the FB pin that provides a constant current source ratioed to the active high side MOSFETs current This can be used to provide real time monitoring of output current to facilitate closed loop operation for motor speed torque control or for the detection of open load conditions Two independent inputs IN1 and IN2 provide control of the two totem pole
39. ckMax for the high pwer options shift PD PowerChange 1 position to left 2 so we set it to l1cm 2 RLNCF PD PowerChange F A PD MV IncCheckMax if the result is greater than max increment set it to max increment POWERINC cpfslt PD PowerChange A movwf PD PowerChange A add the pwer change into the motor power movf PD PowerChange W A addwf PD NewMPower F A bra PD Done PD MV ReducePower 50 now we know we need to reduce power start with 1 cm power change Fr movff PD DistOff PD PowerChange if we are beyond the low pwer range movlw DIST LOW POWER INC cpfsgt PD DistOff A bra PD MV RedCheckMax for the high pwer options so we set it to lcm 2 shift PD PowerChange 1 position to left 2 bcf rlcf STATUS C A PD PowerChange F A PD MV RedCheckMax if the result is greater than max increment set it to max increment movlw POWERINC cpfslt PD PowerChange A movwf PD PowerChange A if the decrement is larger than the current power setting 8 movf PD PowerChange W A cpfslt PD NewMPower A bra PD MV RedSubtract if the current power is lt 5 set it to zero H D 5 cpfsgt PD NewMPower A bra PD MV RedSetZero Otherwise Set power to half of its existing value bcf STATUS C A TICE PD_NewMPower F A bra PD_MV_RedDone PD_MV_RedSetZero set power to
40. collision avoidance systems Yet with all electrical systems there are important safety considerations to keep in mind Setup Adult Supervision the Autononmous Trailer should not be used without adult supervision Pinch Points exercise caution when handling the robot as the tracks can begin moving unexpectedly creating a pinch point between the wheels and the tracks Unintended Additions make no modifications to the existing system in particular do not power the device by anything other than the supplied 9V battery Shock Hazard the Autonomous Trailer operates at low voltages yet it still important not to contact exposed terminations and not to remove the 9V battery while the tracks are in motion The Trailer is easy to set up straight out of the box Its programming is done in advance and all the pieces come pre assembled The following elements are all that is involved If you must operate the vehicle outside only do so in a clean environment Avoid operating the vehicle in the rain or in dusty dirty conditions Pick the vehicle up by the chassis and avoid touching PCB boards whenever possible Ensure that the microcontroller demoboard always is firmly attached to the chassis assembly via the supplied rubber bands or other means Place the car on your knee or similar block for setup such that the treads do not make contact with any surface Adjust the ultrasonic distance sensor so that it is level to the ground and points directly a
41. crease power btfsc PD Status PDSTAT TGT BELOW A bra PD MV IncreasePower else if we aren t getting closer to the TargetDistance we need to go decrease power Fr btfss PD Status PDSTAT CLOSER TGT A bra PD MV ReducePower if we NOT catching up closing the distance e g if Diff lt 16 55 SensorDist Diff 8 gt TargetDistance Catching Up is defined as distance difference gt 16 or when if we keep going at the current power for 8 more iterations we would lt the target distance If we re already gaining 16cm since last iteration unlikely 4 No need to increase power so skip it movlw D 16 limit to 16 since we re gonna multiply by 8 cpfslt PD DistChange A bra PD MV OKPower if SensorDist DistChange 8 lt TargetDist we can skip changing as well movf PD DistChange W A bcf STATUS C A WREG W A WREG WREG 2 three times WREG 8 bcf STATUS C A WREG W A bcf STATUS C A rlcf WREG W A subwf PD SensorDist W A movwf PD Tmp A movlw TARGET DIST cpfsgt PD Tmp bra PD MV OKPower PD MV ReducePower PD MV IncreasePower SO now we know we need to increase power Start with a 1 power change movff PD DistOff PD PowerChange if we beyond the low pwer range movlw DIST LOW POWER INC cpfsgt PD DistOff A bra PD MV IncChe
42. d low the Pin 5 output sends a single pulse suitable for low noise chaining no serial data V Operates on 3 3V 5V The average and peak current draw for 3 3 V operation is 2 1mA 50mA peak and 5V operation is 3 4mA 100mA peak respectively Peak current is used during sonar pulse transmit GND Retum for the DC power supply GND amp V must be ripple andi noise free for best operation MB1240 amp MB1340 Real time Operation 175msS after power up the XL MaxSonar is ready to begin ranging If Pin 4 is left open or held high 20uS or greater the sensor will take a range reading XL MaxSonar checks the 4 at the end of every cycle Range data can be acquired once every 99mS Each 99mS period starts by Pin 4 being high or open after which the XL MaxSonar calibrates and calculates for 20 5mS and after which thirteen 42K Hz waves are sent Then for the MB1240 the pulse width PW Pin 2 is set high When an object is detected the PW pin is set low If no target is detected the PW pin will be held high for up to 44 4mS i e 5805 765cm For the most accurate range data use the PW output of the MB1240 product For the MB1340 with analog envelop output Pin 2 will show the real time signal return information of the analog waveform For both parts the remainder of the 99mS time less 4 7mS is spent adjusting the analog voltage to the correct level and allowing the high acoustic power to dissipate Durin
43. d max single iteration increment movlw DIST LOW POWER INC cpfslt PD DistOff A bra PD StopAdjustHighPower just use the distance for the lower power options so 1 movff PD DistOff PD NewMPower bra PD StopAdjustPowerDone PD StopAdjustHighPower for the high pwer options shift PD DistOff 1 position to left 2 So we set it to lcm 2 RLNCF PD DistOff F A if the result is greater than max increment set it to max increment movlw POWERINC cpfslt PD DistOff A movwf PD DistOff A remember the new motor setting movff PD DistOff PD NewMPower PD StopAdjustPowerDone PD CheckMoving PD MV SD GT OK we re done with dealing with the stopped trailer bra PD Done we know that we are moving and therefore we have to calculate if and by how much we should alter the power settings on the motors To determine this we need to calculate the following values PD_DistChange how far we moved since the last change PD Status higher true if our new dist is our prev dist PD_Status zero true if we ve stayed exactly the Same distance H PD DistOff how far we are off the target distance H PD Status TgtBelow true if we re below the target distance H PD Status TgtExact true if we re exactly on target PD Status CloserTGT true if we are closer to target distance calculate how far we ve moved in the last iteration
44. d set new return values to same values if the motors are stopped if the lead vehicle is beyond target range Save distance to target SensorDist TargetHigh in DistOff Set direction to forward else if the lead vehicle is below target range save distance to target TargetLow SensorDist in DistOff Set direction to reverse else the vehicle is within target range set NewMotorPower to zero endif if we are adjusting power beyond or below now to adjust power we are within the low power adjustment range 5 set NewMotorPower to 1 DistOff e g 1 cm else set NewMotorPower to 2 DistOff e g 2 endif if NewMotorPower is greater than max allowed 205 set NewMotorPower to 20 endif endif else the trailer is moving calculate some needed values for our operations comparisons set DistChange to how far we ve moved since last call set DistHigher flag to tru if our new distance is greater than prev dist set DistZero flag if our new distance is exactly the same set DistOff to the difference between our current distance and target distance set TgtBelow if we are below target distnce set TgtExact if we are exactly the target distance set CloserTgt if we are closer to target than we were before if we are not on target or distance has changed if moving forward if we are too close TgtBelow true set ReducePower flag esle if we aren t closer than we were before set ReducePower flag els
45. e PWM duty cycle was reduced to such a level that the motors could not overcome the resistance of the tracks and the friction of the floor We know 30cm is less than 5096 duty cycle and that appears to have been the threshold It was surely a success for us that the vehicle did not crash into the obstruction For our more sophisticated design we sought to achieve a more proportional control of the vehicle and maintain a fixed set point through incremental control The added functionality of moving in reverse hazard lights and a buzzer also improved on this early design For the second test we are interested in the ability of our control system and motors to respond to the gradual changes of speed in the lead vehicle We are interested in the ability of the Trailer to gradually increase in speed gradually decrease in speed and to switch to reverse 2 Direction and Speed Test For this test we observe the vehicle traveling slowly to maintain a distance and then accelerating to catch up with a speeding lead car Clearly the vehicle s max speed is often less than that of the moving obstruction This means that Autonomous Trailer is frequently operating at its peak speed One of the conditions we were concerned about was the vehicle s oscillation around a set point Because of the slow speed of the vehicle 10cm s overshooting the set point appeared not to be a problem Clearly the lower 96 PWM duty cycle values as low as 5096 were inhibited by t
46. e if we aren t catching up to correct position quickly enough set IncreasePower flag else set PowerOK flag endif else we are moving backward if we are too close TgtBelow set IncreasePower flag else if we aren t getting closer set ReducePower flag else if we aren t catching up to set IncreasePower flag else set PowerOK flag endif endif if IncreasingPower true than we were before correct position quickly enough If we are within the low power adjustment range 5 set power increment to 1 DistOff e g 1 cm else set power increment to 2 DistOff e g 2 endif if power increment is greater than max allowed 205 set power increment to 20 endif add power increment to NewMotorPower else if Reducing Power If we are within the low power adjustment range 5om set power decrement to 1 DistOff e g 1 cm else set power decrement to 2 DistOff e g 2 endif if power decrement is greater than max allowed 205 set power decrement to 20 endif if power decrement is existing power setting to PrevMotorPower 2 if current power is 5 set NewMotorPower to zero else set NewMotorPower endif else subtract power increment from NewMotorPower endif else power must be just right nothign to do endif endif reverse endif Moving if NewMotorPower 100 set NewMotorPower to 100 endif save direction flag save motor power save distance e
47. e internal AVdd for A D Vref b1 02 00 use internal Avss for A D Vref moviw B 00000000 movwf ADCON1 A Configure ADCON1 Internal ref Configure ADCONO b7 0 unimplemented H b6 22 00010 use for analog input H 1 0 No conversion in progress yet 5 ADC is enabled 00001001 Function Purpose Parameters Returns Notes SensorRead adcpoll movwf Configure ADCONO AN2 ADC ON return SensorRead To read the distance sensor None The low order 8 bits of the distance to the lead vehicle or if there was an error or the vehicle is too far ahead We do not delay within the sensor function Instead we depend upon a delay in the main loop between each iteration enable ADC conversion BSF ADCONO GO start conversion Loop until the conversion is done BTFSC ADCONO DONE BRA adcpoll Move the results into WREG and Resultl movf ADRESL W A movwf Resultl A if the high order register is not zero we have error Either the trailer is too far ahead or there was actuall an error in the sensor In both cases we flag an error tstfsz ADRESH A bra SensorRead SetError check to see if we are less than 20CM from the vehicle below the range for our sensor movlw D 20 cpfslt ADRESL A bra SensorRead Done fall through to set error code when l
48. e lead vehicle slows abruptly We plan to support both positive and negative velocity so that the lead vehicle can move forward and or backward and the trailer will maintain the appropriate separation distance Technical Approach Block Diagram The block diagram provides a high level graphic illustration of the components of the Autonomous Trailer The arrows connecting the blocks illustrate a flow of information The discrete elements of the system are the object to be followed Lead Car or similar provided by user an ultrasonic distance sensor a microcontroller a motor control board the motors that drive the vehicle and the hazard lights buzzer Power is provided to the distance sensor the microcontroller and the motor controller Software Systems Algorithm We have broken our algorithm and functionality into several pieces of functionality tied together by our main function The algorithm for each component is discussed separately Main Loop Start Initialize data structures Setup I O Ports devices attached to ports If Hazard Lights Enabled turn them on every Xth loop iteration for Y iterations i If backup beeper enabled turn beeper on every Uth loop for V iterations Get Distance Reading Yes No If no distance If Lost count gt data threshold 1 Y ves Enable Hazard Get Trailer Lights set motor Speed speed controls to zero stop Yes
49. e ratings may cause malfunction or permanent damage to the device These parameters are not production tested ama ELECTRICAL RATINGS Power Supply Voltage v Normal Operation Steady state Vewrcss Transient Over voltage 9 Tm Continuous Output Current e ESD Voltage 0 Human Body Model Machine Model Charge Device Model Corner Pins 1 9 17 25 All Other Pins THERMAL RATINGS Storage Temperature Lowe Operating Temperature 5 Ambient 40 to 125 Junction 40 to 150 1 Device will survive repetitive transient overvoltage conditions for durations not to exceed 500 ms duty cycle to exceed 10 External protection is required to prevent device damage in case of a reverse battery condition 2 Exceeding the maximum input voltage on IN1 IN2 EN INV SLEW D1 or D2 may cause a malfunction or permanent damage to the device 3 Exceeding the pullup resistor voltage on the open drain SF may cause permanent damage to the device 4 Continuous output current capability is dependent on sufficient package heatsinking to keep junction temperature 150 C 5 ESD 1 testing is performed in accordance with the Human Body Model 100 pF Rzap 1500 0 2502 testing is performed in accordance with the Machine Model 200 pF Rzap 0 and the Charge Device Model CDM Robotic Czap 4 0pF 6 Thelimiting factor is junction temperature taking into account
50. eading 100 Observed analog reading 491mV Observed digital reading 0x67 or 48 Conclusions The conclusions for the distance sensor are impressive The inaccuracies of the voltmeter and the manually measured distances may account for the differences between expected and observed results We were also impressed at how well our ADC translated the analog values to accurate digital ones A future study might be made of the accuracy of ultrasonic sensors versus other types of sensors eg infrared 2 Data Processing This software section of the system translates information from the distance sensor to a useable value for the motor control stage It needs to compare the digital distance sensor values it receives to a pre defined set point for our purposes 50cm and adjust the motor output value to force the vehicle to better approximate the set point through its speed By simulating different distance situations we can show the processing stages ability to adjust the speed of the vehicle either up or down Some of the situations are as follows When the distance sensor is continually out of range high we want the processing stage to recognize this as an error bring the vehicle to a stop and put the hazards on When the distance is high but not out of range we want the processing unit to output a high incremented speed value When the distance is low we expect a lower incremented value When the distance is right on 50cm we want to ma
51. ed Application Diagram This document contains certain information on a new product Specifications and information herein are subject to change without notice PS Freescale Semiconductor Inc 2007 2009 rights reserved fr eescale INTERNAL BLOCK DIAGRAM INTERNAL BLOCK DIAGRAM VOLTA WT rao ee Te RA DN Aa pp dv CCP TO GATES HS1 LS1 HS2 EN IN1 IN2 02 GATE DRIVE 152 D1 AND PROTECTION INV VSENSE SLEW SF FB 0 L ILIM PWM JUL OUT1 OUT2 CURRENT MIRROR AND PWM CURRENT REGULATOR CONSTANT OFF TIME zi PGND Figure 2 33926 Simplified Internal Block Diagram 33926 Analog Integrated Circuit Device Data Freescale Semiconductor PIN CONNECTIONS PIN CONNECTIONS NN FEE gt gt 3 NC IN1 PGND SLEW PGND Transparent Top VPWR PGND View of Package AGND VPWR PGND INV PGND FB PGND NC NC gt 25555 amp oooo Figure 3 33926 Pin Connections Table 1 33926 Pin Definitions A functional description of each pin can be found in the Functional Description section beginning on page 12 Logic input control of OUT2 e g when IN2 is logic HIGH OUT2is set to Vpwr and when IN2 is logic LOW OUT2 is set to PGND Schmitt trigger input with 780 pA source so default condition OUT2 HIGH Input
52. ed application Buyer shall indemnify and hold Freescale Semiconductor and its officers employees subsidiaries affiliates and distributors harmless against all claims costs damages and expenses and reasonable attorney fees arising out of directly or indirectly any claim of personal injury or death associated with such unintended or unauthorized use even if such claim alleges that Freescale Semiconductor was negligent regarding the design or manufacture of the part Freescale and the Freescale logo are trademarks of Freescale Semiconductor Inc All other product or service names are the property of their respective owners Freescale Semiconductor Inc 2007 2009 rights reserved XL MaxSonar EZ4 1240 XL MaxSonar AE4 MB1340 Sonar Range Finder with High Power Output Noise Rejection Auto Calibration amp Ultrasonic Distance Sensor MaxBotics XL MaxSonar AE4 MB1340 MB1240 MB1340 vens bred approximately actual size Short Range Narrow Detection Zone Hardware gain of 250 The MB1240 amp MB1340 have a new high power output along with real time auto calibration for changing conditions temperature voltage or acoustic or electrical noise that ensure you receive the most reliable in air ranging data for every reading taken The MB1240 amp MB1340 low power 3 3V 5V operation provides very short to long range detection and ranging in a tin
53. efined in Utilities asm extern Delay MS Delay S Hardware Systems Hardware Description The hardware consists of a dual motor tracked chassis made by Dagu Electronics called the Rover 5 This kit came with 2 DC motors with 87 1 gear ratios to provide extra torque and optional wheel encoders Other kits came with 4 motors but the front 2 motors were disabled by removing one of the interconnecting gears in the transmission The optional encoders were omitted because this project did not require absolute speed control To maintain a fixed distance from the lead object an ultrasonic distance sensor was used The XL MaxSonar AE4 made by MaxBotics emits a 44 kHz tone and internally measures the time between the transmission and the echo to determine the distance Using this distance as the feedback mechanism to the MCU we are able to control the speed of the motors to maintain a fixed distance of 50 cm to our target The motor control consists of a motor driver chip by Freescale MC33926 and the PWM function in the Microchip PIC18F46K22 MCU The MCU is the heart of the system It ties together the sensor readings motor speed back up beeper and hazard lights Power Circuits A single 9V battery is fed into an LM2940S 5 0 voltage regulator It converts the 9 VDC to 5 VDC used to power the MCU and peripherals A separate battery pack with six 1 2 VDC NiMH batteries connected in series provides up to 7 2 VDC to the motor driver H bridge FET switc
54. eter dowel 30 sq 1 ft Beam characteristics are approximate MB1240 amp MB1340 Mechanical Dimensions 785 19 9mm t 0735 18 7mm 0870 22 1mm 0 065 1 7 0 100 2 54mm 0 038 1 0MM 0100 2 54 0 5377 13 64mm a 0 670 17 0mm a 0 304 7 72mm 0 610 155 0 351 8 92 S 0413 10 5 0 0637 1 6 0 368 9 36 0 645 164 0 492 12 5 values are nominal Weight 5 9 grams age MaxBotix Inc Email info maxbotix com MaxBotix MaxSonar EZ4 amp AE4 are trademarks of MaxBotix Inc XL EZ4 XL AE4 v1 5b Patents 7 679 996 Copyright 2005 2011 Web www maxbotix com PD10018b Typical Performance to Targets ANALOG ENVELOPE 15 w ANALOG ENVELOPE V io i 07 MaxBotix Inc MaxBotix MaxSonar EZ4 amp AE Analog Envelope Output Dowels 5V Tra nsmit Burst Targets T 20 5 Real time on Pin 2 of MB1340 __ or MB1240 intemal Targets 0 6cm dia at 66cm 2 5cm dia at 111cm 8 9cm dia at 189cm and a 1m by 2m flat panel at 704cm Target First target ranges at 66cm Conditions acoustic test chamber 10ms DIV Analog Envelope Output Dowels 5V Burst Transmit Targets 206 Vec 5y Real time on Pin 2 of MB1340 or MB
55. ff 7 moviw MOTOR SET OFF Functions Purpose Parameters Returns Notes MotorUpdate movwf PORTC A return MotorUpdate Update the motor control settings based on a desired increase or decrease in power as indicated in Argl Argl the desired motor power percentage 0 100 Arg2 the desired direction l reverse O0 forward nothing of any value Notes From the spec CPRxH doesn t need to set it s read only mode n The low order 2 bits of duty cycle settings are in CCPxCON b5 4 default settings are for the motor to be turned off this will get changed as we parse the input most likely movlw MOTOR SET OFF movwf MotorSettings A get the passed in power percentage movf Argl W A movwf CCPRIL A movwf movwf CCPR2L A movwf CCPR2H A if direction is forward tstfsz Arg2 A bra MotorReverse F Set motor settings to indicate forward MOTOR SET FWD MotorReverse clear the reverse bit in the status MotorStatus MSTAT REVERSE bra MotorSetup Set motor settings to indicate reverse movlw MOTOR SET REV set the status to indicate reverse bsf MotorStatus MSTAT REVERSE MotorSetup remember motor settings MotorSettings Pass the motor settings out the port MotorSettings PORTC return P nction MotorEmergenc
56. for mode have 16 2 clock and desire a 1300hz PWM frequency so 16M 4 16 1300 1 200 d 200 movwf PR4 BANKED configure RB5 pin on PORT B for output bcf TRISB RB5 A Clear Timer4 count and configure Timer4 as follows H 7 0 unimplemented H b6 32 0000 no ouput post scaling gt 2 1 enable timer b1 02 01 prescaler is 4 so Timer FOSC 4 4 1Mhz clrf TMR4 A moviw b 00000101 movwf T4CON BANKED Associate Timer4 with PWM3 CCPTMRSO W A andlw b 00111111 iorlw b 01000000 C3TSEL set to 01 Timer4 movwf CCPTMRSO BANKED Enable PWM Mode on CCPR3 5 b7 62 00 unimplmented b5 42 00 LOW order bits Duty Cycle 2 b3 0 1100 Enable PWM Mode movlw 0 0 movwf CCP3CON BANKED clear the status word indicateds disabled BE Status reset BSR 0 00 return Function BackupBeeperEnable Purpose To Enable the backup Beeper Parameters None Returns None Notes BackupBeeperEnable Set status to enabled bsf BE Status BESTAT ENABLED A set the indicator bsf BE Status BESTAT ON A set the on cycle count down timer movlw BE CYCLE ON COUNT movwf BE Counter A The SFRs for the backup beeper are outside of the access bank load the BSR Oxf and use it for operations we need to movlb
57. g the last 4 7mS the serial data is sent MB1240 amp MB1340 Real time Auto Calibration Each time after the XL MaxSonar takes a range reading it calibrates itself The sensor then uses this data to range objects If the temperature humidity or applied voltage changes during sensor operation the sensor will continue to function normally The sensor does not apply compensation for the speed of sound change verses temperature to any range readings MaxBotix Inc il MaxBotix MaxSonar 24 8 4 are trademarks of MaxBotix Inc Email info maxbotix com XL EZ4 XL AE4 v1 5b Patents 7 679 996 Copyright 2005 2011 Web www maxbotix com PD10018b 1240 1340 MB1240 1340 Real time Noise Rejection While the XL MaxSonar is designed to operate in the presence of noise best operation is obtained when noise strength is low and desired signal strength is high Hence the user is encouraged to mount the sensor in such way that minimizes outside acoustic noise pickup In addition keep the DC power to the sensor free of noise This will let the sensor deal with noise issues outside of the users direct control in general the sensor will still function well even if these things are ignored Users are encouraged to test the sensor in their application to verify usability For every ranging cycle individual filtering for that specific cycle is applied In general noise from regularly occurring per
58. grated Circuit Device Data 8 Freescale Semiconductor ELECTRICAL CHARACTERISTICS DYNAMIC ELECTRICAL CHARACTERISTICS DYNAMIC ELECTRICAL CHARACTERISTICS Table 4 Dynamic Electrical Characteristics Characteristics noted under conditions 8 0 V lt 28 V 40 C lt Ta lt 125 C GND 0 V unless otherwise noted Typical values noted reflect the approximate parameter means at T4 25 C under nominal conditions unless otherwise noted a M gw qoe TIMING CHARACTERISTICS einn Seta __ _ Output ON Delay 29 Vpwn 14 V _ Output OFF Delay 29 us CIES Output Constant OFF Time 29 A Blanking Time 25 tone Output Rise and Fall Time 27 us SLEW SLOW 15 30 SLEW FAST 02 d 3 e wa Charge Pump Operating Frequency 29 70 Notes 21 The maximum PWM frequency is obtained when the device is set to Fast Slew Rate via the SLEW pin PWM ing when SLEW is set to SLOW should be limited to frequencies 11 kHz in order to allow the internal high side driver circuitry time to fully enhance the high side MOSFETs 22 The internal current limit circuitry produces constant OFF time Pulse Width Modulation of the output current
59. he resistance of the tracks We may incorporate this fact into future code A YouTube video of the vehicle in action has been uploaded to http www youtube com watch vzzsaG9s oie4 Conclusions The goal of this project was to prove the concept that you can follow a moving object with a microcontroller and a distance sensor to maintain a set distance The complexity was in creating the algorithm and associated software We each successfully built our own vehicles with all of the core features working To make this a more robust system a bit more code polishing may be required In the future adding in an encoder to measure and track the absolute speed could be implemented to improve on the design 5 PIC Microcontroller An Introduction to Software amp Hardware Interfacing Huang ISBN 1 4018 3967 3 www pololu com Appendixes Time Tracking Time was allocated evenly between all three group members Task Percentage of allocated time Total SIS Research and Planning 596 3 75 hrs Conor Cahill Adam Morse Algorithm Development and 70 52 5 hrs coding Simulation and Testing 20 15 hrs Documentation 5 3 75 hrs Total group hours 75 hrs 25hr 3 people User Manual 1 Safety Concerns 2 Setup 3 Using Your Autonomous Vehicle 4 Shutdown and Storage 5 Troubleshooting 6 System Components Safety Concerns Your new Autonomous Trailer is an easy to use fun demonstration tool for simulating
60. head of the vehicle Tuck all stray wires into the cab of the vehicle so they do not make contact with the tracks e lead car is to be used place it a couple of feet in front of where the Autonomous Trailer will begin its course Remove all obstructions from the straight path along where the cars will travel 3 Using Your Autonomous Vehicle e Attach the 9V battery to the demoboard e Plug the ENABLE pin plugged into the demoboard at e After the tracks have begun to turn place the vehicle on the floor behind the object that is to follow e The Autonomous Trailer is designed to track 50cm behind the lead vehicle e t will adjust its speed and move forward and backwards based on the movement of the lead vehicle 4 Shutdown and Storage e To shut the device off first lift it off the ground Remove the ENABLE at Remove the 9V battery from the demoboard Remove the tracks from the vehicle to lessen the strain on the wheels and gearbox e Store in a dry environment 5 Troubleshooting e Ifthe vehicle does not follow the target while in its operating range 45 cm to 55cm o Adjust the distance sensor so that it points more directly at the object o Modify the lead vehicle so that it can be better recognized by the trailer tape a vertical piece of cardboard on it for instance o Ensure that the lead vehicle does not exceed the Autonomous Trailer max speed of 10cm per second o Ensure that the dista
61. hes to power the motors Having separate power sources insures that the power hungry and noisy motors do not interfere with the logic systems and cause brownout conditions or intermittent behavior in the MCU Schematics Hazard LED R4 NA 2200 Back up beeper Buzzer AST1240MLTRQ Final Project Smart Trailer Group Conor Cahil Adam Morse and Steve Hopkins Title Smart Trailer Top Level no enc Document N Revision A Main page 1 0 Date 2012 05 05 Sheet 1 of 5 BEP ee XL MaxSonar AE4 0 Internal 10bit D A provides 4 9mV cm Final Project Smart Trailer Group Conor Cahil Adam Morse and Steve Hopkins Title MaxSonar SC5 Document N 0001 Date 2012 05 05 Using separate 9V battery to power everything except the motors This will allow the motors heavy load to discharge the NiMH batteries without effecting the other circuits 02 LM2940S 5 0 LINE VREG VOLTAGE COMMON 6 1 2V NiMH rechargable battieries in series provides up to 7 2VDC on a full charge Final Project Smart Trailer Group Conor Cahil Adam Morse and Steve Hopkins Title Power supply SC1 Document N 0001 M10UT1 M10UT2 M2IN2 M20UT1 1 pi M20UT2 a PWM M2D2 LI Final Project Smart Trailer Group Conor Cahil Adam Morse and Steve Hopkins
62. hing of any value We have a 16Mhz clock so for each hundredth of a second we need to execute approximately 4K instructions Given that our loop counters are 8 bit numbers we need 3 levels of loops The inner two levels create a 1 100 second delay while the outer loop works with the number of hundredths of a second parameter passed in To execute 4K instructions we have an inner loop that contains 17 instruction cycles 7 gotos one DECFSZ and one branch This loop is executed 25 times which gives 5 OuterLoop MiddleLoop InnerLoop us 25 17 1 424 instructions loop overhead the middle loop consists of 20 instruction cycles and this loop is executed 9 times 424421 9 1 3995 instruction cycles The outer loop will have 5 extra instruction cycles per loop execution bringing the total to 4000 cycles per outer loop The function function will have 5 instruction cycles of overhead 4 for the call return and one for saving of WREG so the delay will be slightly longer Save Argl in our outer loop counter r movfF movlw movwf Argl UtilDMS Outer 9 UtilDMS Middle A with 103 iterations of the inner loop we execute 2069 instructions per iteration of the middle loop movlw movwf goto goto goto goto goto goto goto decfsz bra InnerLoop goto goto goto goto goto goto goto nop DI PS UtilDMS Inner A 42 42 42 42 42 42 42 42
63. ia Constant OFF Time PWM 4 Moderate Current Load Current Limiting IN1 or IN2 IN2 or IN1 Outputs Tri stated Outputs Operation per Input Control Condition Time Figure 11 Operating States 33926 Analog Integrated Circuit Device Data Freescale Semiconductor 15 FUNCTIONAL DEVICE OPERATION LOGIC COMMANDS AND REGISTERS LOGIC COMMANDS AND REGISTERS Table 5 Truth Table The tri state conditions and the status flag are reset using D1 or D2 The truth table uses the following notations LOW HIGH HIGH or LOW and 2 High Impedance All output power transistors are switched off om uw qe m www E qu qs qu qu M 1 dm e mE pep pr pe p opm I x _ m x N x x x x N LLL 22 _ _ s gr _ je q d 2 2 2 x N x N Xx x P PIFI lii i i Mum LLL se Jw qp J Notes 30 the event of an under voltage condition the outputs tri state and status
64. ing the logic level at INV will have the effect of changing the bridge s output from freewheeling high to freewheeling low or vice versa SLEW RATE SLEW The SLEW pin is the logic input that selects fast or slow slew rate Schmitt trigger input with 80 pA sink so the default condition is SLOW When SLEW is set to SLOW PWM ing should be limited to frequencies less than 11 kHz in order to allow the internal high side driver circuitry time to fully enhance the high side MOSFETs INPUT 1 2 AND DISABLE INPUT 1 2 IN1 IN2 AND D1 D2 These pins are input control pins used to control the outputs These pins are 3 0 V 5 0 V CMOS compatible inputs with hysteresis IN1 and IN2 independently control and 0172 respectively D1 and 02 are complementary inputs used to tri state disable the H Bridge outputs When either 01 or D2 is SET D1 logic HIGH or D2 logic LOW in the disable state outputs OUT1 and OUT2 are both tri state disabled however the rest of the Analog Integrated Circuit Device Data Freescale Semiconductor device circuitry is fully operational and the supply IPWR STANDBY Current is reduced to few mA Refer to Table 3 Static Electrical ne page 7 H BRIDGE OUTPUT OUT1 OUT2 These pins are the outputs of the H Bridge with integrated freewheeling diodes The bridge output is controlled using the IN1 IN2 D1 and D2 inputs The outputs have PWM current limiting above the I iy threshold output
65. intain the trailer s current distance Likewise we want to test that the processing unit signals a deceleration when the distance is below the set point All of these tests can be verified by using the watch window functionality of the MPLAB environment 3 System Operation and Motor Control For this section we are interested in the system s ability as a whole to serve the defined objective That objective is to maintain a defined following distance from a lead vehicle or simulated obstruction This is a qualitative test For the first test the Collision Test we run the Autonomous Trailer with a simulated lead vehicle in front of it maintaining the defined 50cm When the lead vehicle comes to an abrupt stop we want to verify that the Autonomous Trailer quickly comes to a stop as well Our group tested with more primitive design than is currently under development improvements were conceived based partly on these tests In this case the PWM duty cycle for the motors was basically made identical to the value of the distance sensor 1 Collision Test After running smoothly at its max speed our Autonomous Vehicle came to a stop 30cm before the fixed obstruction Conclusion The reason for the 30cm stopping distance be interpolated from our design be clear this test was not run with the 50cm set point that we devised for later designs For this test the distance values directly controlled the PWM duty cycle At 30cm th
66. iodic noise sources such as motors fans vibration etc will not falsely be detected as an object This holds true even if the periodic noise increases or decreases such as might occur in engine throttling or an increase decrease of wind movement over the sensor Even so it is possible for sharp non periodic noise sources to cause false target detection In addition because of dynamic range and signal to noise physics as the noise level increases at first only small targets might be missed but if noise increases to very high levels it is likely that even large targets will be missed In high noise environments if needed use 5V power to keep acoustic signal power high In addition high acoustic noise environment may use some of the dynamic range of the sensor For applications with large targets consider a part with ultra clutter rejection like the MR7092 MB1240 amp MB1340 Beam Characteristics The MB1240 and MB1340 have a wide and long C sensitive beam that offers excellent detection of objects and people The MB1240 and MB1340 WV balances the detection of objects and people with B minimal side lobes Sample results for measured 9 33V 150 beam patterns are shown to the right on a 30 cm A 5 amp grid The detection pattern is shown for dowels of varying diameters that are place in front of the 0 sensor A 6 1 mm 0 25 inch diameter dowel B 2 54 cm 1 inch diameter dowel C 8 89 cm 3 5 inch diam
67. isabled HZ Status return Functions HazardsEnable Purpose To Enable the backup beeper Parameters None Returns None Notes HazardsEnable Set status to enabled bsf HZ Status HZSTAT ENABLED A set the lights on indicator bsf HZ Status HZSTAT ON A set the cycle count down timer movlw HZ CYCLE ON COUNT movwf HZ Counter A turn on the output pin bsf HZ PORT HZ PIN return Functions HazardsDisable Purpose To Enable the backup beeper Parameters None Returns None Notes HazardsDisable turn off the hazards bcf HZ PORT HZ PIN set status to disabled bof HZ Status HZSTAT ENABLED A return Function HazardsUpdate Purpose To update the Beeper status turn on off each iteration Parameters None Returns None Notes HazardsUpdate decrement the countdown counter and return if not zero decfsz HZ Counter F A bra HZU Done if get here the counter has run out so time to change the State of the hazards if they are btfss HZ Status HZSTAT ON A bra HZU TurnEmOn H turn them off P bcf HZ PORT HZ PIN set the off countdown counter movlw HZ CYCLE OFF COUNT movwf HZ Counter A flag that they are off bcf HZ Status HZSTAT ON A bra HZU Done HZU TurnEmOn P turn them on
68. m will have a test assigned to it and will be evaluated based on an appropriate criteria Some components cannot be adequately tested quantitatively and will be given a qualitative assessment After testing each component as independently as possible the system as a whole will be evaluated as far as it meets the design objectives 1 Distance Sensor 2 Data Processing 3 System Operation and Motor Control 1 Distance Sensor The distance sensor will be tested under three physical conditions 20cm 50cm and 100cm 20cm indicates the smallest value that the sensor can reliably read and 100cm represents a high value for what we d expect to measure For our purposes we also test the sensor at 50cm because that is our Trailer s defined set point At each distance with an obstruction appropriately placed an analog and digital reading will be taken Analog measurement will be taken directly from the sensor output with a digital multimeter while digital measurements will be taken using the watch window in the MPLAB development environment 20cm Expected analog reading 98mV 4 9mV cm per datasheet Expected digital reading 20 Observed analog reading 108 mV Observed digital reading 16 or 22 50cm Expected analog reading 245mV 4 9mV cm per datasheet Expected digital reading 50 Observed analog reading 246mV Observed digital reading 0x30 or 36 100cm Expected analog reading 490mV 4 9mV cm per datasheet Expected digital r
69. ms between loop iterations movlw D 50 movwf Argl A Call Delay MS goto MainLoop GOTO stop here END ProcessData asm ProcessData asm Functions used to process the sensor data and calculate motor configuration settings LIST P PIC18F46K22 INCLUDE lt P18F46K22 INC gt INCLUDE AutonomousTrailer inc list directive to define processor processor specific variable definitions Definitions for our project Define entry points that will be accessible from outside this file global ProcessData ProcessDataInit ProcessDataLost Local definitions TARGET DIST equ TARGET DIST HIGH equ TARGET DIST LOW equ MAX POWERINC equ DIST LOW POWER INC equ 50 Disa D 45 720 DM target follwing distance high allowed range low allowed range maximum power change in one operation low pwer increases for DistOff this Bit positions used to store data in PD Status PDSTAT DIR equ 0 PDSTAT DIST ZERO equ Dp i PDSTAT CLOSER equ D 2 PDSTAT TGT BELOW equ PDSTAT ZERO equ 4 PDSTAT SENSOR HIGHER equ Start of the code section Function ProcessDataInit Purpose To Initialize the registers used by ProcessData Parameters Returns Nothing of any value Notes ProcessDataInit Initialize ProcessData variables clrf PD PrevMPower clrf PD Status return
70. nce sensor wires are firmly plugged into the demoboard o Confirm that wires are in the correct terminals see Hardware Schematic e Ifthe vehicle struggles to move o Relocate to a surface with less friction o Ensure the all terminations between the motor controller battery pack and demoboard adequately connected 6 System Components Distance Sensor 9V Battery Microcontroller Terminal Motor location Demoboard Block Control Robot Chassis Board Datasheets Rover 5 Rover 5 is a new breed of tracked robot chassis designed specifically for students and hobbyist Unlike conventional tracked chassis s the clearance can be adjusted by rotating the gearboxes in 5 degree increments Stretchy rubber treads maintain tension as the clearance is raised Each gearbox has an 87 1 ratio includes an optical quadrature encoder that gives 1000 pulses over 3 revolutions of the output shaft The chassis can be upgraded to include four motors and encoders making it ideal for mecanum wheels Inside of the chassis are 4 noise suppression coils at the bottom and a battery holder that accepts 6x AA batteries It is recommended to use NiMh batteries as they last longer and higher current output than Alkaline batteries Video of the chassis in action can be seen here Video indoors autonomous http v youku com v show id XMjESNzkwODAO html Video outdoors RC mode http v youku com v_show id_XMjlwMTkxODk2 html Dimensions
71. nd current setting is OK out of range high Source Code Main asm pudore esse eub colo e Be eA deb abo sede abb ao n Filename Main asm Date 272372022 Authors Adam Morse Steve Hopkins Conor P Cahill H Company UND 452 Spring 2012 e 1 ee PROCESSOR DECLARATION LIST P PIC18F46K22 list directive to define processor INCLUDE lt P18F46K22 INC gt processor specific variable definitions include AutonomousTrailer inc Definitions for our project include Utilities inc get the processor configuration setup include ConfigProcessor inc external function references extern BackupBeeperInit BackupBeeperEnable BackupBeeperDisable BackupBeeperUpdate extern HazardsInit HazardsEnable HazardsDisable HazardsUpdate extern MotorInit MotorUpdate MotorEmergencyStop extern SensorInit SensorRead extern ProcessData ProcessDataLost ProcessDataInit extern Delay MS Local definitions 5 LOST 5 BKWRD equ 5 NEED BKWRD equ Reset Vector RES ORG 0 0000 processor reset vector GOTO START go to beginning of program High amp Low priority interrupt vectors just return for now ISRH O
72. or and need to configure them for our use and for our motors Set the period Register for Timer 2 to be 66 which gets us 15Khz freq Configure and CCP2 on Port C for output Enable Timer2 and set it s pre scaler to 4 so our input is 16M 4 4 or 1Mhz Associate Timer2 with PWM1 and PWM2 Enable PWM Mode on CCP1 and CCP2 Configure pins 7 3 on PortC for output Set the motor to off end MotorUpdate called to update the motor settings Parameters Argl the desired motor power percentage 0 100 Arg2 the desired direction l reverse O0 forward Set the motor duty cycle to the value from Argl on Motor 1 and Motor 2 If the desired direction is forward set MotorSettings to Forward clear Reverse status indicator else set MotorSettings to Reverse Set Revers status indicator endif write the new MotorSettings to PortC end MotorEmergencyStop called when we ve lost track of Lead Vehicle Set motor duty cycle to zero for both Motor 1 and Motor 2 Set MotorSettings to OFF write the new MotorSettings to PortC end Process Data Pseudo code ProcessData txt algorithms for ProcessData subroutines end end ProcessDataInit called at start of program and to reset ProcessData Initialize ProcessData variables to zero ProcessDataLost called when lead vehicle is lost Call ProcessDataInit to initialize variables ProcessData Save parameter to SensorDist Get our previous return values an
73. ower IC designed primarily for any low voltage DC servo motor control application within the current and voltage limits stated for the device Two independent inputs provide polarity control of 33926 14 two half bridge totem pole outputs Two independent disable inputs are provided to force the H Bridge outputs to tri state high impedance off state H BRIDGE OUTPUT DRIVERS OUT1 AND OUT2 The H Bridge is the power output stage The current flow from OUT1 to OUT2 is reversible and under full control of the user by way of the Input Control Logic The output stage is designed to produce full load control under all system conditions protective and control features are integrated into the control and protection blocks The sensors for current and temperature are integrated directly into the output MOSFET for maximum accuracy and dependability Analog Integrated Circuit Device Data Freescale Semiconductor IN1 2 2 or IN1 sop a 65 5 o 5 a E 5 2 o z o 9 1 2 0 j 1 9 10 la o Ei 19 i 8 1 2 Outputs Tri stated l5 0 7 FUNCTIONAL DEVICE OPERATION OPERATIONAL MODES FUNCTIONAL DEVICE OPERATION OPERATIONAL MODES Typical Short Circuit Detection Threshold Typical Current Limit Threshold High Current Load Being Regulated v
74. put 1 Source high side MOSFET1 and drain of low side MOSFET1 14 15 Output Logic Input Disable Input 2 When 02 is logic LOW both OUT1 and 0072 are tri stated Schmitt trigger Active Low input with 80 uA sink so default condition disabled High current power ground pins must be connected together physically as close as possible and directly soldered down to a wide thick low resistance ground plane on the PCB Status Flag Open drain active LOW status flag output requires an external pull up resistor Active Low to Maximum permissible load current lt 0 5 mA Maximum Vcesat lt 0 4 V 0 3 mA Maximum permissible pullup voltage 7 0 V Logic Input Disable Input 1 When D1 is logic HIGH both OUT1 and OUT2 are tri stated Schmitt trigger Active High input with 80 uA source so default condition disabled 27 28 OUT2 Power H Bridge Output 2 Source of high side MOSFET2 and drain of low side MOSFET2 29 30 Output Analog Charge Pump External reservoir capacitor connection for internal charge pump connected to Output Capacitor VPWR Allowable values are 30 to 100 Note This capacitor is required for the proper performance of the device 33926 Analog Integrated Circuit Device Data 4 Freescale Semiconductor ELECTRICAL CHARACTERISTICS MAXIMUM RATINGS ELECTRICAL CHARACTERISTICS MAXIMUM RATINGS Table 2 Maximum Ratings All voltages are with respect to ground unless otherwise noted Exceeding thes
75. r to design or fabricate any integrated circuits or integrated circuits based on the information in this document Freescale Semiconductor reserves the right to make changes without further notice to any products herein Freescale Semiconductor makes no warranty representation or guarantee regarding the suitability of its products for any particular purpose nor does Freescale Semiconductor assume any liability arising out ofthe application or use ofany product or circuit and specifically disclaims any and all liability including without limitation consequential or incidental damages Typical parameters that may be provided in Freescale Semiconductor data sheets and or specifications can and do vary in different applications and actual performance may vary over time All operating parameters including Typicals must be validated for each customer application by customer s technical experts Freescale Semiconductor does not convey any license under its patent rights nor the rights of others Freescale Semiconductor products are not designed intended or authorized for use as components in systems intended for surgical implant into the body or other applications intended to support or sustain life or for any other application in which the failure ofthe Freescale Semiconductor product could create a situation where personal injury or death may occur Should Buyer purchase or use Freescale Semiconductor products for any such unintended or unauthoriz
76. rcuitry to force the output into an immediate tri state latch OFF see Figure 8 Operation in Current Limit mode may cause junction temperatures to rise Junction temperatures above 160 C will cause the output current limit threshold to fold back or decrease until 175 C is reached after which the T thermal latch OFF will occur Permissible operation within this fold back region is limited to non repetitive transient events of duration not to exceed 30 seconds see Figure 9 29 Parameter is guaranteed by design 33926 Analog Integrated Circuit Device Data Freescale Semiconductor 9 ELECTRICAL CHARACTERISTICS TIMING DIAGRAMS TIMING DIAGRAMS o o 2 1 2 lt 79 Figure 4 Output Delay Time 50V 2 S IDDISABLE E 51 3 Figure 5 Disable Delay Time m tr tg VewR S 9096 9096 10 10 gt _ Figure 6 Output Switching Time Overload Condition Short Circuit Detection Threshold Blanking Time ta Constant OFF Time OUT1 and OUT2 Tri Stated lour CURRENT A 0 0 Figure 7 Current Limit Blanking Time and Constant OFF Time 33926 Analog Integrated Circuit Device Data 10 Freescale Semiconductor ELECTRICAL CHARACTERISTICS TIMING DIAGRAMS Short Circuit Condition FAULT Short Circuit Detection Threshold Hard Short Occurs OUT1 OUT2 Tri St
77. rnally or internally Sensor reports the range reading directly frees up user processor Fast measurement cycle User can choose any of the sensor outputs No calibration requirement is perfect for when objects may be directly in front of the sensor during power up Small size allows for easy mounting Inc MaxBotix MaxSonar EZ4 amp AE4 are trademarks of MaxBotix Inc XL EZ4 XL AE4 v1 5b Patents 7 679 996 Copyright 2005 2011 Applications and Uses UAV blimps micro planes and some helicopters e Bin level measurement Proximity zone detection People detection Robot ranging sensor Autonomous navigation Environments with acoustic and electrical noise Multi sensor arrays Distance measuring Short range object detection Users who prefer to process the analog voltage envelope MB1340 40 C to 65 C operation 85 C limited operation Page 1 Email info maxbotix com Web www maxbotix com PD10018b MB1240 MB1340 MB1240 amp MB1340 Pin Out MB1240 amp MB1340 Circuit Pin 1 Leave open or high for serial output on the Pin 5 output When The sensor functions using active components Pin 1 is held low the Pin 5 output sends a pulse instead of serial data consisting of an LM324 and PIC16F690 together suitable for low noise chaining with a variety of other components The schematic Pin 2 240 PW This pin outputs a pulse
78. rol for moters I O Port reservations p Borg AI A 2 Port Be RB2 H RBS P Port Ce H RCC RCS H RC4 2 TS RC2 H RGI used for ADC input port AN2 Hazards CCP3 P3A Beeper pwm EN IN1_M1 2 1 IN1 M2 IN2 M2 Motor 1 CCP2 P2A Motor 2 PWM ConfigProcessor inc PORTD2 Configuration bit settings cop Setup CONFIG11H CONFIG FOSC INTIO7 PLLCFG Setup CONFIG2L CONFIG PWRTEN OFF BOREN Setup CONFIG2H CONFIG WDTEN OFF WDTPS Setup CONFIG3H CONFIG MCLRE EXTMCLR CCP2 Setup CONFIG4L CONFIG STVREN OFF LVP 0 Setup CONFIGSL CONFIG OFF OFF Setup 5 CONFIG CPB OFF CPD OFF Setup CONFIG6L CONFIG OFF OF Setup CONFIG6H CONFIG WRTB OFF WRTC OF Setup CONFIG7L CONFIG EBTRO OFF 1 Setup CONFIG7H CONFIG EBTRB OFF Utilities inc External symbols and definition ied from template OFF PRICLKEN OFF FCMEN OFF IESO OFF BORV 190 1 MX PORTB5 5 OFF 5 2 WRT2 OFF OFF WRID OFF OFF EBTR2 OFF EBTR3 OFF S used by Utlities asm OFF T3CMX 5 2 This should included by code modules that want to invoke functions d
79. rovided the device junction temperature is within the specified operating temperature range INTERNAL PWM CURRENT LIMITING The maximum current flow under normal operating conditions should be less than 5 0 A The instantaneous load currents will be limited to via the internal PWM current limiting circuitry When the iy threshold current value is reached the output stages are tri stated for a fixed time T 4 of 20 us typical Depending on the time constant associated with the load characteristics the output current decreases during the tri state duration until the next output ON cycle occurs The PWM current limit threshold value is dependent on the device junction temperature When 40 C T lt 160 C lum is between the specified minimum maximum values When T exceeds 160 C the threshold decreases to 4 2 Shortly above 175 C the device over temperature circuit will detect and over temperature shutdown will occur This feature implements a graceful degradation of operation before thermal shutdown occurs thus allowing for intermittent unexpected mechanical loads on the motor s gear reduction train to be handled Important Die temperature excursions above 150 C permitted only for non repetitive durations 30 seconds Provision must be made at the system level to prevent prolonged operation in the current foldback region Analog Integrated Circuit Device Data Freescale Semiconductor OVER TEMP
80. rrent at 70 C ambient Module thermal design must be planned accordingly 33926 Analog Integrated Circuit Device Data 6 Freescale Semiconductor ELECTRICAL CHARACTERISTICS STATIC ELECTRICAL CHARACTERISTICS STATIC ELECTRICAL CHARACTERISTICS Table 3 Static Electrical Characteristics Characteristics noted under conditions 8 0 V lt 28 40 C lt lt 125 C GND 0 V unless otherwise noted Typical values noted reflect the approximate parameter means at T4 25 C under nominal conditions unless otherwise noted POWER INPUTS VPWR Operating Voltage Range 79 Steady state 8 0 28 Transient t lt 500 ms 17 40 Quasi functional May Increase by 50 5 0 8 0 Sleep State Supply Current 12 IPWR SLEEP nA EN D2 INV SLEW Logic 0 IN1 IN2 01 Logic 1 and lout 0A Standby Supply Current Part Enabled Ipyrcst ANDBY mA lout Ven 50 V 20 Under voltage Lockout Thresholds VPWR FALLING VUVLO ACTIVE v VPWR RISING VUVLO INACTIVE v Hysteresis VUVLO HYS mV CHARGE PUMP Charge Pump Voltage CP Capacitor 33 Vpwn 5 0 V Vpwn 28 V CONTROL INPUTS Input Voltage IN1 IN2 D1 D2 INV SLEW 29 Logic Threshold HIGH 20 Logic Threshold LOW ViL 1 0 Hysteresis Vuys 250 Logic Input Currents VPWR 8 0 V pA Inputs EN D2 INV SLEW internal pull downs Vin 50V 80 200 Inputs IN1
81. s 8 bit Wide Data Path Priority Levels for Interrupts 31 Level Software Accessible Hardware Stack 8 x 8 Single Cycle Hardware Multiplier Flexible Oscillator Structure Precision 18 MHz Internal Oscillator Block Factory calibrated to 1 Selectable frequencies 31 kHz to 16 MHz 64 MHz performance available using PLL no external components required Four Crystal modes up to 64 MHz Two External Clock modes up to 64 MHz 4X Phase Lock Loop PLL Secondary Oscillator using Timer1 2 32 kHz Fail Safe Clock Monitor Allows for safe shutdown if peripheral clock stops Two Speed Oscillator Start up Analog Features Analog to Digital Converter ADC module 10 bit resolution up to 30 external channels Auto acquisition capability Conversion available during Sleep Fixed Voltage Reference FVR channel independent input multiplexing Analog Comparator module Two rail to rail analog comparators Independent input multiplexing Digital to Analog Converter DAC module Fixed Voltage Reference FVR with 1 024V 2 048V and 4 096V output levels 5 bit rail to rail resistive DAC with positive and negative reference selection Charge Time Measurement Unit CTMU module Supports capacitive touch sensing for touch screens and capacitive switches Extreme Low Power Management with nanoWatt XLP Sleep mode 20 nA typical Watchdog Timer 300 nA typical Timert Oscillator 800 nA 32
82. s also have thermal shutdown tri state latch OFF with hysteresis as well as short circuit latch OFF protection A disable timer time tg is incorporated to distinguish between load currents that are higher than the threshold and short circuit currents This timer is activated at each output transition CHARGE PUMP CAPACITOR CCP This pin is the charge pump output pin and connection for the external charge pump reservoir capacitor The allowable value is from 30 nF to 100 nF This capacitor must be connected from the CCP pin to the VPWR pin The device cannot operate properly without the external reservoir capacitor ENABLE INPUT EN The EN pin is used to place the device in a Sleep mode so as to consume very low currents When the EN pin voltage is Analog Integrated Circuit Device Data Freescale Semiconductor FUNCTIONAL DESCRIPTION FUNCTIONAL PIN DESCRIPTION a logic LOW state the device is in Sleep mode The device is enabled and fully operational when the EN pin voltage is in logic HIGH An internal pulldown resistor maintains the device in Sleep mode in the event EN is driven through a high impedance or an unpowered microcontroller or the EN input becomes disconnected FEEDBACK FB The 33926 has a feedback output FB for real time monitoring of H Bridge high side output currents to facilitate closed loop operation for motor speed and torque control The FB pin provides current sensing feedback of the H
83. shold Short circuit to GND 14 Le D Ts Low Side Short circuit Detection Threshold Short circuit to VPWR 14 99 Output Leakage Current 19 Outputs off 28 V Vout Vewr 100 Vout Ground 60 Output Body Diode Forward Voltage Drop lout 3 0A 2 0 Over temperature Shutdown 19 ec Thermal Limit Ty 175 200 Hysteresis Ty Tuvs pow _____ w HIGH SIDE CURRENT SENSE FEEDBACK Feedback Current pin FB sourcing current 17 lout 0 lout 300 mA lout 5500 mA lout 1 5 lout 3 0A lout 6 0A STATUS FLAG 18 Status Flag Leakage Current 79 ISFLEAK nA Vge 50V Status Flag SET Voltage 29 VsFLOW v 1 300 pA 5 14 This parameter is guaranteed by design 15 Output ON resistance as measured from output VPWR and from output to GND 16 Outputs switched OFF via D1 or D2 17 Accuracy is better than 20 from 0 5 to 6 0 A Recommended terminating resistor value Reg 270 Q 18 Status Flag output is an open drain output requiring a pull up resistor to logic 19 Status Flag Leakage Current is measured with Status Flag HIGH and not SET 20 Status Flag Set Voltage measured with Status Flag LOW and SET with IFS 300 Maximum allowable sink current from this pin is lt 500 Maximum allowable pull up voltage 7 0 V 33926 Analog Inte
84. t 20CM SensorRead SetError Set errror code in 1 movlw SNSR LOSTVEHICLE movwf bra SensorRead Done SensorRead Done end return Beeper asm BackupBeeper asm Functions used to manage the backup Beeper LIST P PIC18F46K22 list directive to define processor INCLUDE lt P18F46K22 INC gt processor specific variable definitions INCLUDE AutonomousTrailer inc Definitions for our project Define entry points that will be accessible from outside this file global BackupBeeperInit BackupBeeperEnable BackupBeeperDisable BackupBeeperUpdate local definitions BESTAT ENABLED equ 20 equ 277 BE CYCLE ON COUNT equ 5740 approx 5 seconds BE CYCLE OFF COUNT equ D 20 approx 1 second BE PWM FREQ equ D 200 1300hz from 16M 4 16 1300 BE PWM ON DUTYC equ 100 moderate volume 255 of FREQ BE PWM OFF DUTYC equ 50 Beeper is connected to PORTA 5 BE PIN equ RA5 BE PORT CTRL equ TRISA Start of the code section gt Functions BackupBeeperInit Purpose To initialize the backup Beeper Parameters Returns Notes BackupBeeperInit SFRs for the backup beeper are outside of the access bank so we need to load the BSR and use it for operations 0 0 Configure the Timer 4 period register
85. t the current settings for the direction motor power movff PD PrevDir PD NewDir movff PD PrevMPower PD NewMPower if the motors aren t currently off e g we are not stopped go to check moving tstfsz PD PrevMPower bra PD CheckMoving if the lead vehicle is beyond the allowinable range TARGET DIST HIGH cpfsgt PD SensorDist bra PD StopCheckSD LT calculate the distance off target and set direction to forward movlw TARGET DIST subwf PD SensorDist W A movwf PD DistOff A PD Status PDSTAT DIR A movlw PD DIRECT FWD movwf PD NewDir A bra PD StopAdjustPower PD StopCheckSD LT if the lead vehicle is below the allowinable range TARGET DIST LOW cpfslt PD SensorDist bra PD StopCheckSD calculate the distance off target and set direction to reverse DistOff TargetDistance SensorDistance 14 movlw TARGET DIST movwf PD DistOff A movf PD SensorDist W A subwf PD DistOff F A bsf PD Status PDSTAT DIR A PD DIRECT REV movwf PD NewDir A bra PD StopAdjustPower PD StopCheckSD EO Else we re within range should stay stopped PD NewMPower bra PD Done PD StopAdjustPower Time to adjust our power based on the makeup distance if it s a small distance increment increment power 1 per cm othersie incrment power 2 per cm check to make sure we don t excee
86. tatus PDSTAT DIR A bra PD MV CheckReverse else if we re at SensorDistance lt TargetDistance we re too close go reduce power btfsc PD Status PDSTAT TGT BELOW A bra PD MV ReducePower else if we are gaining on the LV go immediately to reduce power btfss PD Status PDSTAT CLOSER TGT A bra PD MV ReducePower if we are NOT catching up closing the distance e g if Diff lt 16 amp amp SensorDist Diff 8 gt TargetDistance H Catching Up is defined as a distance difference 16 or when if we keep going at the current power for 8 more iterations we would be H lt the target distance If we re already gaining 16cm since last iteration unlikely n No need to increase power so skip it movlw D 16 limit to 16 since we re gonna multiply by 8 cpfslt PD DistChange A bra PD MV OKPower if SensorDist DistChange 8 lt TargetDist we can skip changing as well g movf PD DistChange W A bcf STATUS C A ELGE WREG W A WREG WREG 2 three times WREG 8 bcf STATUS C A rlcf WREG W A bcf STATUS C A rlcf WREG W A subwf PD SensorDist W A movwf PD Tmp A movlw TARGET DIST cpfsgt PD Tmp bra PD MV OKPower go increase the power P bra PD MV IncreasePower PD MV CheckReverse Ok if got here we re going backwards so check to see if we need to increase or decrease power if we re at SensorDistance lt TargetDistance we re too close go in
87. ter A flag that they are off bcf BE Status BESTAT ON A bra BEU Done BEU TurnEmOn turn the PWM DUTYC movwf CCPR3L BANKED the countdown counter CYCLE COUNT movwf BE Counter A flag that they are bsf BE Status BESTAT ON A BEU Done reset BSR movlb 0x00 return end Hazards asm Hazards asm Functions used to manage the Hazard LEDs LIST P PIC18F46K22 list directive to define processor INCLUDE lt P18F46K22 INC gt processor specific variable definitions INCLUDE AutonomousTrailer inc Definitions for our project Define entry points that will be accessible from outside this file global HazardsInit HazardsEnable HazardsDisable HazardsUpdate Local definitions HZSTAT ENABLED equ D 0 HASTAT ON equ D 1 HZ CYCLE ON COUNT equ D 15 approx 75 seconds HZ CYCLE OFF COUNT equ D 20 approx 1 second HZ PORT equ PORTB Hazards are connected to PORTB 2 HZ PIN equ RB2 HZ PORT CTRL equ TRISB Start of the code section Functions HazardsInit Purpose To initialize the backup beeper Parameters Returns Notes The hazards are controlled by a relay connected to 1 digital port 5 HazardsInit enable the port for output ber HZ PORT CTRL HZ PIN A clear the status word indicateds d
88. vice Data 24 Freescale Semiconductor How to Reach Us Home Page www freescale com Web Support http Avww freescale com support USA Europe or Locations Not Listed Freescale Semiconductor Inc Technical Information Center EL516 2100 East Elliot Road Tempe Arizona 85284 1 800 521 6274 1 480 768 2130 www freescale com support Europe Middle East and Africa Freescale Halbleiter Deutschland GmbH Technical Information Center Schatzbogen 7 81829 Muenchen Germany 44 1296 380 456 English 46 8 52200080 English 49 89 92103 559 German 33 1 69 35 48 48 French www freescale com support Japan Freescale Semiconductor Japan Ltd Headquarters ARCO Tower 15F 1 8 1 Shimo Meguro Meguro ku Tokyo 153 0064 Japan 0120 191014 or 81 3 5437 9125 support japan freescale com Asia Pacific Freescale Semiconductor China Ltd Exchange Building 23F No 118 Jianguo Road Chaoyang District Beijing 100022 China 86 10 5879 8000 support asia freescale com For Literature Requests Only Freescale Semiconductor Literature Distribution Center P O Box 5405 Denver Colorado 80217 1 800 441 2447 or 303 675 2140 Fax 303 675 2150 LDCForFreescaleSemiconductor hibbertgroup com MC33926 Rev 8 0 4 2009 Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductor products There are no express or implied copyright licenses granted hereunde
89. y and compact form factor The MB1240 amp MB1340 detect objects from 0 cm to 645 cm 25 1 feet and provide sonar range information from 20 cm out to 645 cm with 1 resolution Objects from 0 cm to 20 cm typically range as 20 cm Objects from 0 mm to 1 mm may not be detected The interface output formats included are pulse width output MB1240 real time analog voltage envelope MB1340 analog voltage output and serial digital output Features e High acoustic power output Real time auto calibration and noise rejection for every ranging cycle Calibrated beam angle Continuously variable gain Object detection as close as 1 mm from the sensor e 33V to 5V supply with very low average current draw e Readings can occur up to every 100mS 10 Hz rate Free run operation can continually measure and output range information e Triggered operation provides the range reading as desired All interfaces are active simultaneously e Serial 0 to 9600Baud 81N Analog Vcc 1024 e Pulse Width MB1240 Real time analog envelope MB1340 e Sensor operates at 42KHz Benefits Acoustic and electrical noise resistance Reliable and stable range data Sensor dead zone virtually gone Low cost Quality controlled beam characteristics Very low power ranger excellent for multiple sensor or battery based systems Ranging be triggered exte
90. yStop Purpose Initialize the Motor Controls Parameters None Returns Nothing of any value Notes Just set the duty cycle to zero M torimergencystopi duty cycle to zero clrf CCPR1L A clrf clrf CCPR2L A clrf CCPR2H A turn the motors off movlw MOTOR SET OFF movwf MotorSettings A movff MotorSettings PORTC return end Sensor asm Sensors asm definitions functions used to configure and or read the sensors P mnction Purpose Parameters Returns Notes SensorInit LIST P PIC18F46K22 list directive to define processor INCLUDE lt P18F46K22 INC gt processor specific variable definitions INCLUDE AutonomousTrailer inc Definitions for our project Define entry points that will be accessible from outside this file global SensorInit SensorRead Start of the code section Code SensorInit To initialize the sensor configuration None Nothing of any value None Configure portA for input and set first bit for analog input clrf PORTA A clrf ANSELA A bsf ANSELA ANSA2 bsf TRISA RA2 Configure ADCON2 b72 1 Right justified output 0 unimplemented 5 b5 3 100 8 TAD b2 02 020 Conversion 1 FOSC 32 movlw B 10100010 movwf 2 Configure ADCON1 0 use CCP5 trigger b6 42 000 unimplemented b3 22 00 us
Download Pdf Manuals
Related Search
Related Contents
Extrait français du manuel de Nikon Manual de instrucciones User Manual - EPA Systemy Rapport du PAM sur la sécurité User`s Manual - WITS Dans les pages qui suivent, vous trouverez la fiche ZIFER ITALIA - Via Risorgimento, 23 46017 Rivarolo Mantovano (MN) USER`S MANUAL - Dave E. Marcial DENTAL SYSTEM™ BY 3SHAPE 16/32 channels digital pentaplex video recorder art. 49226 Copyright © All rights reserved.
Failed to retrieve file