morry 0 Posted March 9, 2013 Share Posted March 9, 2013 Hey guys, this was my very first project on the awesome TI Stellaris Launchpad. I don't know if these Carrera Slot Cars are famous all over the world, but in Germany this was a Must-Have for every kids toy collection. :-) (Picture from Wikipedia, looping is missing ;-) ). You set two cars on the track and control their speed with a small controller. The fastest car wins the race but main goal is actually to stay on track. 1. The Mission I wanted to have a display, that shows me the current time for each track and the best driven time for each track. 2. How to detect the cars? After some considerations about light switches etc. I realized that the cars are hold on track by a small magnet in the back of each car. Perfect for use with Reed-Contacts. In the picture you can see the mechanical lap counter and the adaptor board to the Stellaris launchpad. The Reed contacts are mounted from the bottom side next to each track. 3. Display There might be good LCD-libraries even for Cortex M4, but for better learning I decided to write my own routines for the display. It's a 4 Line LCD with a KS0066 controller (HD44780 compatible) in "good old" 4Bit mode. Here's the display with the launchpad adaptor board (and poti for contrast control): 4. The code Basically there are two timers set to 1ms intervall, one for each track. The reed contacts trigger a GPIO-interrupt, which starts the timers. A third timer sets a displayrefresh-flag, which is polled in the main loop. Here is the code as CCS-Project: https://dl.dropbox.com/u/773191/TI/carrera/carrera.zip 5. LCD-Library If you want to use a KS0066 or HD44780-Display, here are my LCD.c and LCD.h for it: https://dl.dropbox.com/u/773191/TI/carrera/LCD.c https://dl.dropbox.com/u/773191/TI/carrera/LCD.h Works also for displays with 1 or 2 lines of course. 6. Some more pictures "The Sandwich": Complete setup: Greets Moritz bluehash 1 Quote Link to post Share on other sites
bluehash 1,581 Posted March 10, 2013 Share Posted March 10, 2013 Good stuff! Nicely integrated into the Launchpad. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.