Exercise 4: Kinetis Random Number Generator

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Exercise 4: Kinetis Random Number Generator

Exercise 4: Kinetis Random Number Generator

To do:

The development platform is Eclipse. The EVAL Board is the Kinetis Tower TWR K60. On the Tower, you find 2 pushbuttons and 4 LEDs.

a) Generate a hexadecimal random number from 0x0 to 0xF as long as pushbutton1 is pressed. Display the result with the 4 LEDs for about 3 seconds.

b) Replace the code for recognizing a pressed key by a macro "KEY1_PRESSED".

c) Replace the access to the 4 LEDs by a macro "LEDx_TOGGLE" with x = 0...3".

Use active wait loops instead of the timer in this Kinetis exercise.

Result: TWR_K60_RANDOM.zip

Attachments
%3CLINGO-SUB%20id%3D%22lingo-sub-1100558%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EExercise%204%3A%20Kinetis%20Random%20Number%20Generator%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1100558%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%20class%3D%22abs05%22%3ETo%20do%3A%3C%2FP%3E%3CP%20class%3D%22abs05%22%3E%3C%2FP%3E%3CP%20class%3D%22abs05%22%3EThe%20development%20platform%20is%20Eclipse.%20The%20EVAL%20Board%20is%20the%20Kinetis%20Tower%20TWR%20K60.%20On%20the%20Tower%2C%20you%20find%202%20pushbuttons%20and%204%20LEDs.%20%3C%2FP%3E%3CP%20class%3D%22abs05%22%3E%3C%2FP%3E%3CP%20class%3D%22abs05%22%20style%3D%22margin-left%3A%2014.2pt%3B%20text-indent%3A%20-14.2pt%3B%22%3Ea)%20Generate%20a%20hexadecimal%20random%20number%20from%200x0%20to%200xF%20as%20long%20as%20pushbutton1%20is%20pressed.%20Display%20the%20result%20with%20the%204%20LEDs%20for%20about%203%20seconds.%3C%2FP%3E%3CP%20class%3D%22abs05%22%20style%3D%22margin-left%3A%2014.2pt%3B%20text-indent%3A%20-14.2pt%3B%22%3Eb)%20Replace%20the%20code%20for%20recognizing%20a%20pressed%20key%20by%20a%20macro%20%22KEY1_PRESSED%22.%3C%2FP%3E%3CP%20class%3D%22abs05%22%20style%3D%22margin-left%3A%2014.2pt%3B%20text-indent%3A%20-14.2pt%3B%22%3Ec)%20Replace%20the%20access%20to%20the%204%20LEDs%20by%20a%20macro%20%22LEDx_TOGGLE%22%20with%20x%20%3D%200...3%22.%3C%2FP%3E%3CP%20class%3D%22abs05%22%20style%3D%22margin-left%3A%2014.2pt%3B%20text-indent%3A%20-14.2pt%3B%22%3E%3C%2FP%3E%3CP%20class%3D%22abs05%22%3EUse%20active%20wait%20loops%20instead%20of%20the%20timer%20in%20this%20Kinetis%20exercise.%20%3C%2FP%3E%3CP%20class%3D%22abs05%22%3E%3C%2FP%3E%3CP%20style%3D%22margin-top%3A%20auto%3B%20margin-bottom%3A%20auto%3B%22%3E%3CSPAN%20lang%3D%22EN-US%22%20style%3D%22font-family%3A%20'Arial'%2C'sans-serif'%3B%22%3EResult%3A%20TWR_K60_RANDOM.zip%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
No ratings
Version history
Last update:
‎05-14-2014 08:21 AM
Updated by: