network rc car
DESCRIPTION
Network RC Car. Seth Schwiethale James Crosetto James Ellison. C ar’s I nput. square pulse of 1.0-2.0 ms, repeats every 20 ms It is the same for both steering and acceleration width of the pulse determines the direction/speed w / 1.5 ms as the nominal center - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Network RC Car](https://reader035.vdocuments.site/reader035/viewer/2022062811/5681613f550346895dd0ab34/html5/thumbnails/1.jpg)
Network RC CarSeth Schwiethale
James CrosettoJames Ellison
![Page 2: Network RC Car](https://reader035.vdocuments.site/reader035/viewer/2022062811/5681613f550346895dd0ab34/html5/thumbnails/2.jpg)
square pulse of 1.0-2.0 ms, repeats every 20 ms
It is the same for both steering and acceleration
width of the pulse determines the direction/speed w/ 1.5 ms as the nominal center
the amplitude of the pulse is from the reference level of the Vcc (5v)
Car’s Input
![Page 3: Network RC Car](https://reader035.vdocuments.site/reader035/viewer/2022062811/5681613f550346895dd0ab34/html5/thumbnails/3.jpg)
1 “alarm” output
max activation is 100 times/sec (increments of 10 ms)
Camera’s Output
![Page 4: Network RC Car](https://reader035.vdocuments.site/reader035/viewer/2022062811/5681613f550346895dd0ab34/html5/thumbnails/4.jpg)
Camera’s output can’t produce a 20ms PWM signal that is high between 1-2ms
Car cannot be driven by Camera directly
need something that modifies the output signal of the camera so it can be used by the car
The Problem
![Page 5: Network RC Car](https://reader035.vdocuments.site/reader035/viewer/2022062811/5681613f550346895dd0ab34/html5/thumbnails/5.jpg)
Using a microprocessor (MC9S12DP256) has a clock signal rate of 24MHz has registers for a Pulse Width Modulator
and an Enhanced Capture Timer
Signal from the camera can be varied between 10-110ms for speed and 120-220ms for steering
The Solution
![Page 6: Network RC Car](https://reader035.vdocuments.site/reader035/viewer/2022062811/5681613f550346895dd0ab34/html5/thumbnails/6.jpg)
Pulse Width Modulation
car’s input
camera’s output
microprocessor
![Page 7: Network RC Car](https://reader035.vdocuments.site/reader035/viewer/2022062811/5681613f550346895dd0ab34/html5/thumbnails/7.jpg)
used to create correct output signal
uses CPU clock signal to generate signal lengths
current signal is 24MHz and we need a 50Hz (20ms) signal (Factor of 480000!)
Pulse Width Modulator
![Page 8: Network RC Car](https://reader035.vdocuments.site/reader035/viewer/2022062811/5681613f550346895dd0ab34/html5/thumbnails/8.jpg)
Initializing the Pulse Width Modulator
Determining the Output Signal
![Page 9: Network RC Car](https://reader035.vdocuments.site/reader035/viewer/2022062811/5681613f550346895dd0ab34/html5/thumbnails/9.jpg)
The pulse width modulator uses registers to decrease the frequency of the clock signal before it is used as an output signal
Two output signals can be generated from the clock signal
Modifying the Clock Frequency
Allows for finer control of signal
![Page 10: Network RC Car](https://reader035.vdocuments.site/reader035/viewer/2022062811/5681613f550346895dd0ab34/html5/thumbnails/10.jpg)
The periods of both SA and SB need to be 20ms
Setting the Period
![Page 11: Network RC Car](https://reader035.vdocuments.site/reader035/viewer/2022062811/5681613f550346895dd0ab34/html5/thumbnails/11.jpg)
The duty cycle (the part of the PWM signal that is high) needs to be 1-2ms in length
Initialized to 1.5 ms
Setting the Duty Cycle
Notice the difference!
![Page 12: Network RC Car](https://reader035.vdocuments.site/reader035/viewer/2022062811/5681613f550346895dd0ab34/html5/thumbnails/12.jpg)
Pulse Width Modulation Code
![Page 13: Network RC Car](https://reader035.vdocuments.site/reader035/viewer/2022062811/5681613f550346895dd0ab34/html5/thumbnails/13.jpg)
Used to trigger interrupts Set up to trigger an interrupt every time a
signal goes high or low on an input port (TCTL4 and TIE)
Enhance Capture Timer
![Page 14: Network RC Car](https://reader035.vdocuments.site/reader035/viewer/2022062811/5681613f550346895dd0ab34/html5/thumbnails/14.jpg)
Timer Register (TCNT) is incremented every clock cycle (24MHz clock = 24 million times per second)
Clock slowed to 187.5 KHz TCNT is 16-bit register (0-65535) Overflows about every 1/3 second
(65535/187500) Never overflows more than once per input
signal from camera
Counting
![Page 15: Network RC Car](https://reader035.vdocuments.site/reader035/viewer/2022062811/5681613f550346895dd0ab34/html5/thumbnails/15.jpg)
Interrupt
![Page 16: Network RC Car](https://reader035.vdocuments.site/reader035/viewer/2022062811/5681613f550346895dd0ab34/html5/thumbnails/16.jpg)
Conclusion