Download presentation
Published byAmy Leonard Modified over 9 years ago
1
Lab 1 – Data Types "Using C code, determine the size of signed and unsigned char, int, and long integral data types. Demonstrate the problems of overflow. Show how fractional numbers are represented in a computer. Demonstrate problems that arise when using floating point data types." BYU CS 124 Lab 1 - Data Types
2
Data Types Lab Lab 1 – Data Types Acquire a Texas Instruments MSP430 LaunchPad Development Tool (R1.5). Change RXD,TXD from vertical to horizontal position. BYU CS 124 Lab 1 - Data Types
3
Data Types Lab Lab 1 – Data Types Install (if necessary) and execute TI's Code Composer Studio v5.x. BYU CS 124 Lab 1 - Data Types
4
Lab 1 – Data Types Open a Terminal window in CCS Data Types Lab
BYU CS 124 Lab 1 - Data Types
5
Lab 1 – Data Types Compile and execute Lab01.c Data Types Lab
BYU CS 124 Lab 1 - Data Types
6
Lab 1 – Data Types Level of printf/scanf support = full Data Types Lab
BYU CS 124 Lab 1 - Data Types
7
TERMINAL Macros To output a string, use: TERMINAL(<string>);
Data Types Lab TERMINAL Macros To output a string, use: TERMINAL(<string>); To output a formatted number, use: TERMINAL1(<format string>,<exp>); To output a formatted number twice, use: TERMINAL2(<string>,<exp>); To output two different formatted numbers, use: TERMINAL3(<string>,<exp1>,<exp2>); Examples: TERMINAL("\n\r** INTEGERS **"); TERMINAL1("21+2=%d",21+2); TERMINAL2("char=%d (0x%2x)",127); TERMINAL3("Q4.4=%f (0x%2x)",(((long)32)/16.0), 32; BYU CS 124 Lab 1 - Data Types
8
Data Types Lab Lab 1 – Data Types 2 pts Your C program programmatically finds the largest values for signed and unsigned chars, ints, and longs and the most negative values for signed chars, ints, and longs. 2 pts Your C program programmatically demonstrates data type overflow for chars, ints, and longs. 2 pts Your C program programmatically finds the largest positive and most negative signed Q16.16 fixed point numbers. 2 pts Your C program programmatically illustrates floating point round-off errors and demonstrates why it's a bad idea to use equal comparisons with floating point numbers. (2 examples please.) 2 pts Your C program programmatically demonstrates that associate order of arithmetic operations is important. BYU CS 124 Lab 1 - Data Types
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.