diff options
| author | Avi Levkovich <avi@twine-s.com> | 2020-08-31 18:30:24 +0300 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2020-08-31 18:30:24 +0300 |
| commit | 636615fd69d4cb758fdf51d35baad73ed71d8236 (patch) | |
| tree | c943b50d87c1cc9ea5afeb3c8f88e1021b96958c /Software/Embedded_SW/Embedded/Common | |
| parent | 5c19a9bef046ff080a9a7008bd4f39e2a13e4ccb (diff) | |
| download | Tango-636615fd69d4cb758fdf51d35baad73ed71d8236.tar.gz Tango-636615fd69d4cb758fdf51d35baad73ed71d8236.zip | |
Add functions to read and wrie the setup temperature in Shinko's controller
Diffstat (limited to 'Software/Embedded_SW/Embedded/Common')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Common/Utilities/ASCII.c | 32 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Common/Utilities/ASCII.h | 1 |
2 files changed, 32 insertions, 1 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/ASCII.c b/Software/Embedded_SW/Embedded/Common/Utilities/ASCII.c index 403db1460..80035b588 100644 --- a/Software/Embedded_SW/Embedded/Common/Utilities/ASCII.c +++ b/Software/Embedded_SW/Embedded/Common/Utilities/ASCII.c @@ -4,7 +4,10 @@ * Created on: 31 Aug 2020 * Author: avi */ - +#include "include.h" +#include <stdint.h> +#include <stdbool.h> +#include <DataDef.h> // Convert ASCII HEX to decimal int ASCII_Hex_To_Decimal(char hexVal[], int len) @@ -45,4 +48,31 @@ int ASCII_Hex_To_Decimal(char hexVal[], int len) return dec_val; } +// function to convert decimal to ASCII hexadecimal +uint32_t Decimal_To_ASCII_Hex(int n) +{ + Word_to_Bytes Word2Bytes; + + // counter for hexadecimal number array + int i = 0; + while (n != 0) + { + // temporary variable to store remainder + int temp = 0; + + // storing remainder in temp variable. + temp = n % 16; + + Word2Bytes.Byte[i] = temp + 0x30; + i++; + + n = n / 16; + } + + for( ;i<4 ;i++) + Word2Bytes.Byte[i] = 0x30; + + return Word2Bytes.Word; +} + diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/ASCII.h b/Software/Embedded_SW/Embedded/Common/Utilities/ASCII.h index 05bd967a3..2c3ad1a55 100644 --- a/Software/Embedded_SW/Embedded/Common/Utilities/ASCII.h +++ b/Software/Embedded_SW/Embedded/Common/Utilities/ASCII.h @@ -9,6 +9,7 @@ #define COMMON_UTILITIES_ASCII_H_ int ASCII_Hex_To_Decimal(char hexVal[], int len); +uint32_t Decimal_To_ASCII_Hex(int n); |
