In case you need in your design beside the classical peripherals of a MCU additional hardware like OpAmps, comparators, digital components (gates, registers, counters, flipflops, etc.) a closer look to the Cypress PSoC family is recommended.
The best way to get familiar with a new MCU family is to realize a project. As a meaningful project with a lot of challenges the author decided to build a robot. In the first development phase, the robot should be just controlled by an infrared remote control, in later phases an autonomous operation should be developed.
What are the tools used for this robot: A PSoC 4200 on a breakout board in Dip40-format including a USB-TTY converter for bootloading , which cost 4$. This MCU is equipped with a 32 bit ARM cortex M0 core, running at 48 Mhz. Besides the classical peripherals like GPIOs, UART, SPI, Timers and I2C it has 4 so called Universal Digital Blocks (UDBs).
UDBs are programmable logic blocks that provide functionalities similar to CPLD and FPGA blocks. The UDBs allow you to create a variety of digital functions such as timer, counter, PWM, PRS, CRC, shift register, SPI, UART, and custom combinational and sequential logic circuits.
For development, Cypress offers its PSoC Creator, an IDE with included gcc 4.7.3 compiler. With a graphic editor, you can design easily your project. It is easy, to include a lot of components out of a library with more than 100 items. Pin layout is very flexible, you can assign name and function to most of the pins.
The mechanical base of the robot is a platform with two gear motors, powered by a dedicated motor driver controlled by the MCU via PWM. In order to measure the wheel speed, two fork photoelectric sensors deliver impulses to the MCU. In the front and back are ultrasonic modules installed for distance measuring. The firmware for speed control and distance metering will be implemented in later phases.
The robot is controlled by an infrared panel, as used for television. The author has chosen a device with NEC encoding, because it has some redundancy and short repetition pulses. The speed can be regulated from zero to 4.5 wheel turns per second in 0.5 steps back and forward. Right and left direction will be done in reducing or redirecting the speed of the appropriate motor.
The firmware is written in C and has a multithreading structure. Thread 1 handles the remote control, thread 2 controls the motors, thread 3 switches and blinks the front and back LEDs. Incoming sensor pulses are reshaped by comparators and processed from interrupt routines. A complete project for PSoC Creator is attached, as well as some photos and screen shots.
Have fun with your developments!