ELEC1004-ELEC1004电气入门代写
时间:2023-03-19
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 1
ELEC1004
Practical Introduction to Electrical
Engineering
Week 3: Arduino microcontroller and programming
Semester 1, 2023
Dr C She
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 2
Topics of the Week
› Introduction to micro controllers
- Analog Vs Digital system
- Number system, Binary system and digital logic
- Functional block diagram of a microcontroller
- Programming of a microcontroller
- Arduino microcontroller
- Sample programs
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 3
Analog and Digital signals
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 4
Advantages of the Digital Approach
› Provided that the noise amplitude is not too large, the logic values represented
by a digital signal can still be determined after noise is added.
› With modern IC technology, it is possible to manufacture exceedingly complex
digital circuits economically.
› Digital Words
- Finite word length eg: 8 bits,16 bits, 32 bits, 64 bits,
› In parallel transmission, an n-bit word is transferred on n wires, one wire for
each bit, plus a common or ground wire. In serial transmission, the successive
bits of the word are transferred one after the other with a single pair of wires.
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 5
Number system
• Encoding
• Music
• Video
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 6
Octal and Hexadecimal Numbers and Binary
Equivalent
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 7
Combinational Logic Circuits
AND Gate
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 8
Logic Inverter
0=AA
AA =
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 9
OR Gate
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 10
NAND, NOR, and XOR Gates
Explain Boolean expressions, Boolean Algebra!
Application of combinational logic circuits:
Adder, Subtracter, Comparator, Encoder, Decoder etc.
Implement AND gate using only NOR gates(NAND gates)
https://www.youtube.com/watch?v=eCyiZg6kVeU
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 11
Combinational logic and Sequential logic
› Sequential Circuits:
› Refer:
- https://www.youtube.com/watch?v=Z2I2TKFlmTs
- https://www.youtube.com/watch?v=SzV4l0_1MCQ
› Digital Computer
› A computer is a sequential machine which performs arithmetic and logic
operations which may be sequenced by the tick of the clock signal.
› The input is discrete rather than continuous
› The information is represented by binary digits.
- https://www.youtube.com/watch?v=7pCRYXEgMPQ
- https://www.youtube.com/watch?v=_etLrF5f-uM
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 12
Introduction
› Desktop computer
› Laptop computer
› A microcomputer or microcontroller is a complete computer containing the
CPU, memory, and I/O on a single silicon chip.
› An embedded computer is part of a product, such as an automobile,
printer, or bread machine, that is not called a computer.
Ref: Chapter 8 ‘Electrical and Electronic Technology’ by Hughes
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 13
Computer Organisation
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 14
How computer works?
This computer, in which the instructions and data are stored in the same
memory, has von Neumann architecture (also known as Princeton
architecture ).
Programs (Instructions):
System programs
Application Programs
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 15
Computer memory
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 16
Reading from memory
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 17
Memory chip
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 18
Memory Types
(1)Read-and-write memory (RAM)
(2) Read-only memory (ROM)
(3) Mass storage
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 19
Selection of Memory
›1. The trade-off between speed and cost
›2. Whether the information is to be stored
permanently or must be changed frequently
›3. Whether data are to be accessed in random
order or in sequence
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 20
Controlling a physical Process
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 21
Arduino Uno microcontroller
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 22
Pin Mapping
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 23
Blink LED
/*
Blink
Turns on an LED on for one second, then off for one second,
repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the
voltage LOW
delay(1000); // wait for a second
}
System Programs:
Compiler
Assembler
Hex converter
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 24
SIK Experiment Guide for Arduino - V3.2
› Experiment 1: Blinking an LED****
› Experiment 2: Reading a Potentiometer****
› Experiment 3: Driving an RGB LED****
› Experiment 4: Driving Multiple LEDs****
› Experiment 5: Push Buttons****
› Experiment 6: Reading a Photoresistor****
› Experiment 7: Reading a Temperature Sensor****
› Experiment 8: Driving a Servo Motor**
› Experiment 9: Using a Flex Sensor
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 25
Hardware-in-the-loop
› Use MATLAB/Simulink with Arduino-uno
ELEC1004 Practical Introduction to Electrical Engineering Week 3 Slide 26
Deploy to hardware
Use of HMI blocks
essay、essay代写