You are viewing an older revision! See the latest version

Day1_Labexercizes

Day 1 : Getting to know your controller

In order to use your micro-controller you need to know a little about what it can do. Here's the diagram you can find on the mbed website that shows what each pin of the KL25Z can be used for.

As you can see there are a lot of outputs with functions like PWM (pulse-width modulation), Analog In (ie ADC) and lots of communication ports. These are

  • 1. Serial (TX,RX UARTn n=0-2) which are simple two wire ports for transferring serial data using ASCII codes.
  • 2. I2C – this is a standard interface for communication between discrete ICs and also uses two wires. Lots of peripheral devices use I2C and it can form a fairly complex network with a little effort. In this case one device has to be set up as a master controller and everything else is its slave (speaks only when spoken to....)
  • 3. SPI – there’s only one of these but SPI is a faster serial protocol than UART and offers very high bandwidth for things like displays.

Its also worth noting here that all the pins with labels like PTXX can be used as simple digital inputs or outputs and can sink about 20mA each but only source about 5mA. In other words they will light up and LED but not drive a motor...

On top of these the board itself has some useful bits. There are several built in systems

  • 1. RGB LED – you can program this by defining its pins which are referenced as LED1,LED2, LED3.
  • 2. Accelerometer – this measures tilt and offers useful tricks for a user interface.
  • 3. Linear touchpad – That black rectangular area at the bottom of the board is a touchpad – it can read the position of a finger along its length.

The exercises here are aimed at getting everyone some basic familiarity with the mbed system. Once you have completed a task get a demonstrator to come check it out and sign off on it.


All wikipages