ELEC3730 Embedded Systems Lecture 7: C for Embedded ...
Recommend Documents
1. Role of This Book. 1. Benefits of C in Embedded Systems. 2. Outline of the
Book. 3. Typographical Conventions. 3. Updates and Supplementary Information.
4.
C programming for embedded microcontroller systems. Assumes experience with
assembly language programming. V. P. Nelson. Spring 2013.
1.1 What's Special About Embedded Systems? 1 ... 2.1.4 How to Read Design
Patterns in This Book. 46 ... Chapter 3 Design Patterns for Accessing Hardware.
Sep 26, 2011 - system (RFID). It involves the use of the student card to get student attendance. The author tried to solve the problem of manual computation of ...
in electronic systems integrated in devices that we use every day, like cars, mobile phones ...... be investigated in deeper detail; if necessary, enable the saving of temporary data in files;. ⢠run the ...... In these days, trading is under press
Feb 25, 2002 ... Preface xi. 1 Programming embedded systems in C 1 ..... 'design patterns' to
support the development of embedded systems based on the.
A few years ago almost all electronic equipment was built using analog ..... USB uses two communication channels to interface a keyboard to a digital system.
embedded software design as a model of computation, and to ... PATTERNS. Software engineering has advanced considerably in recent .... C, Java, and VHDL.
Lab reports: Demo usually required, sometimes questions. ▫ Ratios: ❑ Lab: 50%.
❑ Exams ... An embedded system is preprogrammed to perform a narrow range
of functions with .... http://www.ti.com/litv/pdf/slau144e. (link is on the Textbook ...
Oct 28, 2013 ... Embedded Systems/8051 Microcontroller. 88 ... Embedded Systems/Atmel AVR
... Embedded Systems/Cypress PSoC Microcontroller ...... Very inefficient,
especially if you need to push the data manually over the bus ... Very clean
solut
Brief Explanation of Embedded System. • System Designed to handle specific
task or set of tasks. • Difficult To ... History of Embedded Systems. • 1961:US Air ...
0.2.2 Building an Embedded System xxxvii. 0.3. The Embedded Design and
Development Process xl. 0.4. Summary vi. 0.5. Review Questions xlvi. 0.6.
Thought ...
Embedded system is a combination of Hardware and Software. Microcontroller like AT89SX, PIC, ARDUINO which places a vital role on this.
Introduction to Embedded Systems - A Cyber-Physical Systems Approach, .....
how to (partially) accomplish our objectives with today's technology. Embedded
..... pensating for paper stretch, which will typically depend on the type of paper,
the
ComTrade Embedded Systems Development centre helps hi-tech vendors
expand into new technologies and shorten the time to market. With deep
knowledge ...
Mar 2, 2012 ... Embedded systems are growing in popularity due to: ▻ Technology ... a system.
▷ In respect to security, embedded designs are different from.
May 2, 2009 - code starting from the original application sequen- tial C code. ..... this research are part of the Mosart (Mapping Opti- mization for Scalable ...
Nov 27, 2007 - Apps. Hypervisor. Figure 2.1. A virtual machine. The hypervisor (or .... code is typically developed by application programmers, who are not ...
Collaborative Subjects for Embedded Systems. Learning in the EHEA Frame: A Practical Approach. Pablo GarcÃa, Jose A. Cancelas, Victor M. González.
18 Jan 2002 ... In the last years the deployment of embedded real-time systems has ... real-time
system must fulfill requirements both from an embedded ...
... Innovations (Integrated Circuits and Systems) Free PDF Online, Embedded ..... split-gate memory cell technologies ba
Book Description A âcrash courseâ on the basics of feedback control theory in embedded environment! ... Browse Compu
GSM phone with an LCD graphical display, a Qwerty layout keyboard and a ... conference calls, e-mail, and faxes All this support for mobile professionals can be ...
A Remote Home Security System Based on Wireless Sensor Network and GSM
.... 84 Simulation Of Earthquakes And Tsunami Through GSM Network. 85.
ELEC3730 Embedded Systems Lecture 7: C for Embedded ...
1. ELEC3730 Embedded Systems. Lecture 7: C for Embedded Programming. •
Bitwise Operations. •Setting,Inverting,Toggling,Clearing,Extracting + Inserting bits
.
ELEC3730 Embedded Systems Lecture 7: C for Embedded Programming • Bitwise Operations •Setting,Inverting,Toggling,Clearing,Extracting + Inserting bits •Structures •Unions
ELEC3730 Callaghan Campus
1
Boolean and Binary Operators
•
Operation
Boolean Operator
Bitwise Operator
AND
&&
&
OR
||
|
NOT
!
~
XOR
N/A
^
LEFT SHIFT
N/A
Boolean operators used to for conditional expressions (eg: if statement) • C does not contain a Boolean data type. • Boolean operators yield results of type int, with true and false represented by 1 and 0. • Any numeric data type may be used as a Boolean operand. • Zero is interpreted as false; any non-zero value is interpreted as true.
• Bitwise operators are used to manipulate bits. • Bitwise operators operate on individual bit positions within the operands; • The result in one bit position is independent of all the other bit positions. ELEC3730 Callaghan Campus
2
Boolean versus bitwise operations
(5 || !3) && 6
(5 | ~3) & 6
= (true OR (NOT true)) AND true
= (00..0101 OR ~00..0011) AND 00..0110 = (00..0101 OR 11..1100) AND 00..0110
= (true OR false) AND true = (true) AND true = true =1
ELEC3730 Callaghan Campus
= (11..1101) AND 00..0110 = 00..0100 =4
3
Bitwise-AND: Forces 0’ 0’s where they occur in mask
m p m AND p Interpretation If bit m of the mask is 0, 0 0 bit p is cleared to 0 in 0 0 1 0 the result. 1
0 0 1 1
p
If bit m of the mask is 1, bit p is passed through to the result unchanged.
ELEC3730 Callaghan Campus
4
Bitwise-OR: Forces 1’ 1’s where they occur in mask
m p m OR p 0 0 0 p 1 1 1
0 1 1 1
1
Interpretation If bit m of the mask is 0, bit p is passed through to the result unchanged. If bit m of the mask is 1, bit p is set to 1 in the result.
ELEC3730 Callaghan Campus
5
Bitwise-XOR: Forces bit flip where 1’ 1’s occur in mask
m p m XOR p Interpretation If bit m of the mask is 0, 0 0 bit p is passed through 0 p 1 1 to the result unchanged. If bit m of the mask is 1, 0 1 bit p is passed through 1 ~p 1 0 to the result inverted.
ELEC3730 Callaghan Campus
6
Testing Bits • Form a mask with 1 in the bit position of interest; • Bitwise AND the mask with the operand. • The result is non-zero if and only if the bit of interest was 1: if
((bits
&
• Same as: if (bits &
64) != 0) 0x64)
/* check to see if bit 6 is set */ /* check to see if bit 6 is set *
• Same as if (bits & (1 right_shift kybd->left_shift kybd->ctrl kybd->alt kybd->left_alt kybd->left_ctrl
= = = = = =
(hit (hit (hit (hit (hit (hit
& & & & & &
(1 (1 (1 (1 (1 (1
alt = bits->alt kybd->left_alt = bits->left_alt kybd->left_ctrl = bits->left_ctrl
!= != != != != !=
0 0 0 0 0 0
; ; ; ; ; ;
}
ELEC3730 Callaghan Campus
17
Variant Access with Pointers, Casts, & Subscripting
• Given an address: − −
Cast it as a pointer to data of the desired type, Then dereference the pointer by subscripting.
• Without knowing the data type used in its declaration: −
Read or write various parts of an object named operand using:
((char *) &operand)[k]
ELEC3730 Callaghan Campus
18
Keyboard Revisited - Using Pointers+Cast+Subscripting #define #define
FALSE TRUE
BOOL get_keys(KEYS
0 1
typedef unsigned char
BOOL ;
typedef struct { char lo ; char hi ; short both ; } KEYS;
*) ;
void main(){ KEYS kybd ; do{ /* wait for both shift keys*/ get_keys(&kybd) } while (!kybd.left_shift || !kybd.right_shift) ; } void get_keys(KEYS { int hit, *addr;