Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of WaG by
Diff: display.cpp
- Revision:
- 13:8936b2f64aa2
- Parent:
- 12:a947a6609a23
- Child:
- 14:be27f6e21a8a
--- a/display.cpp Tue Feb 27 14:22:49 2018 +0000 +++ b/display.cpp Tue Feb 27 16:16:04 2018 +0000 @@ -18,8 +18,8 @@ #include <stdio.h> #include <string.h> -//#define VERSION1 -#define VERSION2 +#define VERSION1 +//#define VERSION2 /* @@ -88,34 +88,29 @@ #ifdef VERSION1 /* * void bin2bcd_array(int num); - * Description: + * Description: Converts to BCD array using modulo method. * * Inputs: * Parameters: - * int num: + * int num: number to push to display + char bcd[]: BCD array that will be written to * Globals: * * Outputs: - * Parameters: + * Parameters: * Globals: * Returns: void */ void bin2bcd_array(int num, char bcd[]) { int size = 4; - int dec_arr[size]; - int place = 3; + int place = 0; while (num != 0) { //converts decimal input to decimal array using %mod int val = num % 10; //dec_arr[place] = val; bcd[place] = val; num = num/10; - place--; + place++; } - /* - for (int i = size - 1; i >= 0; i--) { //converts decimal array to binary array - bcd[i] = convert(dec_arr[i]); - } - */ } #endif