Calculator 9S12DP256 Lab 2. \ Convert counted string at addr1 to double number ud2 \ ud1 normally zero to begin with \ addr2 points to first invalid character.

Slides:



Advertisements
Similar presentations
CS110 Programming Language I
Advertisements

LC-3 Assembly Language Programming Examples
Introduction to Computers and Programming Lecture 7:
Introduction to Computers and Programming Lecture 8: More Loops New York University.
Digilab DIO2 LCD Module F5.1. DIO2 circuit board block diagram.
Lab 7 strings as arrays of chars. #include #include #include using namespace std; int printMenu( ); int hexSymbolValue( char c ); int readBinValue( bool.
Introduction to Computers and Programming More Loops  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course.
Java Coding 3 David Davenport Computer Eng. Dept.,
Introduction to C Programming Overview of C Hello World program Unix environment C programming basics.
Random Sampling using RAN#. Random Sampling using Ran# The Ran#: Generates a pseudo random number to 3 decimal places that is less than 1. i.e. it generates.
LCD Display DIO2 Board CPLD. DIO2 Board CPLD Interface LCD Display.
1 Chapter 1 Measurements 1.4 Significant Figures in Calculations Copyright © 2009 by Pearson Education, Inc.
The Serial Peripheral Interface (SPI) Chapter 8 CML9S12-DP256.
Scientific Notation Why Do We Need It?.
Java Coding 3 David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. Over & over again!
Functions Parameters & Variable Scope Chapter 6. 2 Overview  Using Function Arguments and Parameters  Differences between Value Parameters and Reference.
Standard Form.
CS-280 Dr. Mark L. Hornick 1 ASCII table. 2 Displaying Numbers as Text Problem: display numerical values as text Consider the numerical value 0x5A held.
Microsoft Visual Basic 2005 CHAPTER 5 Mobile Applications Using Decision Structures.
A453 Exemplar Password Program using VBA
General, Organic, and Biological Chemistry Fourth Edition Karen Timberlake 1.6 Significant Figures in Calculations Chapter 1 Chemistry and Measurements.
Objectives Data Representation Binary number system Binary Coded Decimal (BCD) Boolean Values Analogue & Digital data Use of ASCII code Memory addressing.
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
Data Representation - Part II. Characters A variable may not be a non-numerical type Character is the most common non- numerical type in a programming.
Significant Figures What do you write?
Lecture 4 Introduction to Programming. if ( grade ==‘A’ ) cout
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 3A Integral Data (Concepts)
Required Functions for Program 3 int readUntilValidBaseRead( ); int readNumbersReturningValue( int base ); int decimalValueOf( char chDigit ); bool isValid(
Introduction to Pascal The Basics of Program writing.
Using Decimal Types. What are the data types that you can use? Decimal Number: Single -Is used for decimal values that will not exceed six or seven digits.
Computing with Decimals. Adding and Subtracting Decimals.
Computer Science 1620 boolean. Types so far: Integer char, short, int, long Floating Point float, double, long double String sequence of chars.
Data Types and Variables. Data Type! Computers are all about Data! Data can be in the form of Text Dates Sounds Pictures.
Computer Science Binary. Binary Code Remember the power supply that is inside your computer and how it sends electricity to all of the components? That.
Aim: How can we express a large or small number?
PHY-102 SAPVariables and OperatorsSlide 1 Variables and Operators In this section we will learn how about variables in Java and basic operations one can.
Characters and Strings. Characters  New primitive char  char letter; letter = ‘a’; char letter2 = ‘C’;  Because computers can only represent numbers,
1. 2 Sales tax is calculated by finding the percent of the total purchase.
Scis.regis.edu ● CS-361: Control Structures Week 6 Dr. Jesús Borrego Lead Faculty, COS Regis University 1.
More about Strings. String Formatting  So far we have used comma separators to print messages  This is fine until our messages become quite complex:
Programming with Visual C++: Concepts and Projects Chapter 3A: Integral Data (Concepts)
Other Variable Types Dim lab as String makes a box that can store a label tag Dim ColHead As String ColHead = “function” ColHead function Dim lab as Boolean.
Java Programming, Second Edition Chapter Two Using Data Within a Program.
ITEC 109 Lecture 7 Operations. Review Variables / Methods Functions Assignments –Purpose? –What provides the data? –What stores the data? –What type of.
Before we get started…. First, a few things… Weighted Grading System Programming Style Submitting your assignments… The char and string variable types.
Words. Characters and Strings Character –A single character inside of single quotes char letter = 'A' ; char digit = '0' ; – Strings Zero or more character.
SCIENTIFIC NOTATION. Convert to scientific notation       Convert to standard notation  1.92 X 10 3 
Calculations in Chemistry Scientific Math. I CAN convert number to and from SCIENTIFIC NOTATION.
CMPS 1371 Introduction to Computing for Engineers CHARACTER STRINGS.
A: A: double “4” A: “34” 4.
DATA TYPES, VARIABLES AND CONSTANTS. LEARNING OBJECTIVES  Be able to identify and explain the difference between data and information  Be able to identify,
Microsoft Visual Basic 2012 CHAPTER FIVE Decision Structures.
What is Binary Code? Computers use a special code of their own to express the digital information they process. It's called the binary code because it.
Lesson Seven: Using Flags. What Are Flags? Flags are Variables or Switches Used to Help With Logic Control of your character. Normally, Flags are used.
Variables. A variable is a space in your robot’s memory where you can store data, such as whole numbers, decimal numbers, and words. Variable names follow.
Java String Methods - Codehs
Multiplying Decimals.
Scientific Notation Scientific Notation is a number written as the product of 2 numbers: a coefficient and 10 raised to a power. This is useful for writing.
BINARY CODE.
Example 10 ASCII String to Binary Conversion
Control Statement Examples
Loops The loop blocks you've used in Scratch can all be recreated in C! Loops allow for the repetition of code until a condition is met. There are three.
Review Operation Bingo
Standard and Scientific Notation
Multiplying Decimals.
Standard Form.
C++ Pointers and Strings
Variables Here we go.
Data Types and Maths Programming Guides.
Section 6 Primitive Data Types
Presentation transcript:

Calculator 9S12DP256 Lab 2

\ Convert counted string at addr1 to double number ud2 \ ud1 normally zero to begin with \ addr2 points to first invalid character : >NUMBER ( ud1 addr1 -- ud2 addr2 ) \Calculator (add) LOAD lcd256.whp LOAD keypad12.whp VARIABLE ptr VARIABLE first VARIABLE kbuf 20 ALLOT : init( -- ) kbuf ptr ! SPI.INIT init.key lcd.init TRUE first ! ; kbufptr

\ Convert counted string at addr1 to double number ud2 \ ud1 normally zero to begin with \ addr2 points to first invalid character : >NUMBER ( ud1 addr1 -- ud2 addr2 ) kbuf ptr : display( n -- ) if first digit IF init\ clear display FALSE first ! THEN hex2asc DUP >data8\ display digit 1 ptr +! \ update ptr C! ; Enter decimal number 123

\ Convert counted string at addr1 to double number ud2 \ ud1 normally zero to begin with \ addr2 points to first invalid character : >NUMBER ( ud1 addr1 -- ud2 addr2 ) kbuf ptr : enter( n -- d ) DROP kbuf - \ get no. of chars kbuf C!\ make counted string 1 ptr +! 0 C!\ make asciiz string 0 0 kbuf \ convert ascii string >NUMBER DROP\ to double number TRUE first ! ; Press E 3 0

: add( d1 n -- d2 ) clear.lcd enter D+ 2DUP (D.) type.lcd ; : calc( -- ) init BEGIN wait.for.keyup getkey DUP 14 =\ E key IF enter ELSE DUP 10 =\ A key IF add ELSE DUP 12 =\ C key IF init ELSE display THEN AGAIN ;