RM2F Input / Output (I/O) Pin grouping code!. I/O Pin Group Operations: The Spin language has provisions for assigning values to groups of bits in the.

Slides:



Advertisements
Similar presentations
Lab 11 : Memory System Fundamentals :
Advertisements

IR Communication Materials taken from a variety of sources including IR Remote for the Boe-Bot by Andy Lindsay.
10 Ways to Ruin Your Mini-Max microcontroller (and lose $69)
Electrical team Arduino tutorial I BY: JOSHUA arduini
Digital Pad Operation Christian Vega R. Jacob Baker UNLV Electrical & Computer Engineering.
Chapter 6: Digital Display
IR Control Materials taken from a variety of sources including IR Remote for the Boe-Bot by Andy Lindsay.
Bits and Bytes + Controlling 8 LED with 3 Pins Binary Counting and Shift Registers.
Indian Institute of Technology Hyderabad ROBOTICS LINE FOLLOWER HARI KISHAN TANDEY – ES12B1008 DILIP KONDAPARTHI – ES12B1010 SAI KARTIK – CE12B1015.
MICROCONTROLLERS MODULE 2 Programming, Controlling and Monitoring.
ELECTRICAL. Circuits Outline Power Hub Microcontroller Sensor Inputs Motor Driver.
Basic Stamp II is kinda cool Bytes of EEPROM(non-volatile) - Clock speed of 20 MHz. - Holds 600 lines of code in EEPROM - executes an average of.
Copier Jam Detector Design Problem
DIGITAL CIRCUITS Dr. L M Head Sophomore Clinic Fall 2004.
Lab 6 :Digital Display Decoder: 7 Segment LED display Slide #2 Slide #3 Slide #4 Slide #5 Slide #6 Slide #7 Display Decoder Fundamentals LT Control Input.
Input and Output Developed by: Electronic Systems Technologies College of Applied Sciences and Arts Southern Illinois University Carbondale
Designs and Implementation Ring Detector circuit Design: Ring Detector circuit Design:
Parallel Ports of PC Methods of interfacing Examples.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Lecture 5: Sensors. A sensor is any element that provides information from the to the robot, either about the environment or about the robot itself. Sensing.
Boolean math is the cornerstone of digital communications, whether you are talking computers, PLC, or Cisco Routers on the Internet. ©Emil Decker, 2009.
Do Now Describe what you think happens electrically when you dim a light.
Introduction to Digital Works. The Digital Works Window.
A Simple Tour of the MSP430. Light LEDs in C LEDs can be connected in two standard ways. Active high circuit, the LED illuminates if the pin is driven.
Computer Sensing and Control How is binary related to what we are trying to accomplish in electronics? The PC GadgetMaster II uses binary to communicate.
RM2D Let’s write our FIRST basic SPIN program!. The Labs that follow in this Module are designed to teach the following; Turn an LED on – assigning I/O.
Bits, Bytes, Words Digital signal. Digital Signals The amplitude of a digital signal varies between a logical “0” and logical “1”. – The information in.
The 3 parts of an electronic system are :
IR Communication Materials taken from a variety of sources including IR Remote for the Boe-Bot by Andy Lindsay.
ME456: Mechatronics Systems Design Lecture 3 Chapter 2: Lights On –Lights Off Prof. Clark J. Radcliffe Mechanical Engineering Michigan State University.
PHY 201 (Blum)1 Microcode Source: Digital Computer Electronics (Malvino and Brown)
Microcontrollers Module 3: Digital Display. 7 – Segment Display A seven-segment display (SSD), or seven- segment indicator, is a form of electronic display.
IR Communication Materials taken from a variety of sources including IR Remote for the Boe-Bot by Andy Lindsay.
Projects 8051.
MECH1500 Chapter 3.
ECE Lecture 1 1 L15 –I/O Part II Department of Electrical and Computer Engineering The Ohio State University ECE 2560.
Counting with the Count.
 A transistor is the basic building block of electronic components.  The average computer may have millions of them within its circuits.  Essentially,
Programming PIC 16F84A in Assembly. PIC16F84 pin-out and required external components.
5-2-3 Analogue to Digital Converters (ADC). Analogue to Digital Conversion The process is now the opposite of that studied in Topic Now we wish.
1 Transistor. 2 Transistors are used to turn components on and off They come in all different shapes and sizes.
Logic Gates Unit 16.
Logic Gates Binary Day 3 PEOPLE 2016.
Fundamentals of Computer Engineering
IR Communication Materials taken from a variety of sources including IR Remote for the Boe-Bot by Andy Lindsay.
Arduino Development for Beginners
Chapter 7.2 Computer Architecture
Arduino Part 1 Topics: Microcontrollers Programming Basics
Arduino Uno and sensors
Introduction to Handshaking Communication with SSC-32
IR Control Materials taken from a variety of sources including IR Remote for the Boe-Bot by Andy Lindsay.
Lighting LEDs with a RASPBERRY PI
EET 2261 Unit 11 Controlling LCD and Keypad
ARDUINO     What is an Arduino? Features 14 Digital I/O pins 6 Analogue inputs 6 PWM pins USB serial 16MHz Clock speed 32KB Flash memory 2KB SRAM.
PLC Hardware Components.
Internet-of-Things (IoT)
EET 2261 Unit 11 Controlling LCD and Keypad
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
Welcome to Digital Electronics using the Arduino Board
The RGB LED.
SINKING AND SOURCING Two terms most frequently mentioned when discussing connections to inputs or outputs are “sinking” and “sourcing“. These two concepts.
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Let’s work with the SYSTEM CLOCK!
Let’s use a PUSH-Button!
ECE 352 Digital System Fundamentals
ECE 352 Digital System Fundamentals
2019 Investing Now Summer Program
Presentation transcript:

RM2F Input / Output (I/O) Pin grouping code!

I/O Pin Group Operations: The Spin language has provisions for assigning values to groups of bits in the dira and outa registers. Instead of using a single digit between the brackets next to the outa command, two values separated by two dots can be used to denote a contiguous group of bits. The binary number indicator % provides a convenient way of defining the bit patterns that get assigned to the group of bits in the outa or dira registers. For example; dira[20..25] := % will set bits 20 through 25 in the dira register (to output.) Another example, outa[20..25] := % sets P20, clears P21, sets P22, and so on. The result should be that the LEDs connected to P20, P22, and P24 turn on while the others stay off.

Lets write some more code! ‘File: GroupIOSet.spin PUB LedsOn dira[20..25] := % outa[20..25] := % repeat In the Propeller Tool Program go to the File tab and select “NEW”. Type the following code into the new window. Load the program GroupIOSet.spin into RAM or EEPROM by selecting F10 or F11. Go to the next slide!

So what happened? 1. How many LED’s lit up? 2. Which ones lit up? 3. Why do you think this happened? 4. Was it a “0” or a “1” that caused the LED’s to come ON? 5. How do you know? 6. Could you reverse it? If so…do it now!

Notice that outa[20..25] := % causes the state of the outa register’s bit 20 to be set (to 1), bit 21 cleared (to 0), and so on. If the pin group’s start and end values are swapped, the same bit pattern will cause bit 21 to be set, bit 20 to be cleared, and so on…

It doesn’t matter what value is in an outa register bit if its dira register bit is zero. That’s because the I/O pin functions as an input instead of an output when its dira register bit is cleared. An I/O pin functioning as an input detects high and low signals instead of sending them. While a pin configured to function as an output either transmits 3.3 or 0 V, a pin configured to input doesn’t transmit at all because it is instead monitoring the voltage applied to the pin.

An I/O pin set to output-high connected to an LED circuit turns the light on when it applies 3.3 V to the LED circuit. Since the other end of the LED circuit is connected to ground (0 V), the electrical pressure across the LED circuit causes current to flow through the circuit, which turns the light on. An I/O pin set to output-low turns the light off because it applies 0 V to the LED circuit. With 0 V at both ends of the circuit, there is no electrical pressure across the circuit, so no current flows through it, and the light stays off. The light also stays off when the I/O pin is set to input, but for a different reason. An I/O pin set to input doesn’t apply any voltage at all because it is instead sensing voltage applied to it by the circuit. The result is the same, the LED stays off.

Since an I/O pin set to input doesn’t apply any voltage to a circuit, it doesn’t matter what value is in the corresponding outa register bit. The LED circuit connected to that pin will remain off. Above is an example that sets all the bits in outa[20..25] but not all the bits in dira[20..25]. The LEDs connected to P22 and P23 will not turn on because their I/O pins have been set to input with zeros in the dira register. outa[20..25] := % dira[20..25] := % Modify your EXISTING code with this code!