it-ebooks - Real-Time Programming Lecture Notes (Waterloo CS452)
Here you can read online it-ebooks - Real-Time Programming Lecture Notes (Waterloo CS452) full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2017, publisher: iBooker it-ebooks, genre: Romance novel. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:
Romance novel
Science fiction
Adventure
Detective
Science
History
Home and family
Prose
Art
Politics
Computer
Non-fiction
Religion
Business
Children
Humor
Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.
- Book:Real-Time Programming Lecture Notes (Waterloo CS452)
- Author:
- Publisher:iBooker it-ebooks
- Genre:
- Year:2017
- Rating:3 / 5
- Favourites:Add to favourites
- Your mark:
- 60
- 1
- 2
- 3
- 4
- 5
Real-Time Programming Lecture Notes (Waterloo CS452): summary, description and annotation
We offer to read an annotation, description, summary or preface (depends on what the author of the book "Real-Time Programming Lecture Notes (Waterloo CS452)" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.
Real-Time Programming Lecture Notes (Waterloo CS452) — read online for free the complete book (whole text) full work
Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Real-Time Programming Lecture Notes (Waterloo CS452)" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.
Font size:
Interval:
Bookmark:
From: CS452 - Real-Time Programming - Spring 2012
- Due date for assignment 0/1
- Combination to trains lab
- Ubuntu 10.10
Most of the mediation between the internal representations and thereal-world is done by embedded systems
- invisible computing
- sense and control
- billions and billions sold
Two box model
- develop on one box
- execute on a different box.
Development cycle
- edit & compile on one box
- download to second box
- execute
Problem one
- raw code that owns the hardware itself
- hardware-specific libraries provide access to hardware
- microcontroller/hopper example
Problem two
- OS-like abstraction of hardware
- looks like a bunch of libraries, plus a little more.
Actually real-world programming, which means
- World is measured in seconds, metres, etc.
- Programs manipulate bits, bytes, words, which must be translated into into real-world measures.
For example,- formatted output: translate from int, which computers manipulate, to decimal, which humans read
- out in the open: i2a( ), printf( )
- hidden: print, cout
- Banking: int translates into, e.g., number of cents
- program says dispense( 10000 ), which means `put five twemties into the hopper'.
- microcontrollers start
- activating motors
- sensing forces
- reading digitized video
- etc.
- Train control: contents of messages map into change speed, switch turn-out, sensor triggered
- formatted output: translate from int, which computers manipulate, to decimal, which humans read
- Throughput
- e.g., number of frames per second in a game
- e.g., frequency of sensor sampling in process control
- no solution except
- getting better hardware
- getting better algorithms
- restructuring the task
- Response time
- e.g., time from button press to gun firing in game
- e.g., time from sensor reading to control code executing in provess control
- several programming techniques exist
- busy-wait
- polling loop
tension between flexibility and performance
In cs452 we take guaranteed response time as the defining quality ofreal-time computation.
Uses a device called a UART,
- which is really just two shift registers
- with a one byte buffer in front of each one
- plus one bit in a control register for each. They mean
- read: there's a byte you haven't read yet
- write: the buffer is empty, you can write
This is used to synchronize with an external event, minimizing responsetime.
#define FOREVER for( ; ; )FOREVER { while( !ready( ) ) ; do-it( );}or in another form
FOREVER { if ( ready( ) ) do-it( );}Sometimes you only want to do the thing once, as you do when putting acharacter on a serial line.
#define UART1_BASE 0x808c0000#define UART_DATA_OFFSET 0x00 // low 8 bits#define UART_FLAG_OFFSET 0x18 // low 8 bits#define TXFF_MASK 0x20 // Transmit buffer full flags = (int *)( UART1_BASE + UART_FLAG_OFFSET ); data = (int *)( UART1_BASE + UART_DATA_OFFSET ); while( ( *flags & TXFF_MASK ) ) ; *data = c;From the time that the ready bit sets until the first instruction of do-itis executed
- execution time forwhile( !ready ) ;do-it;
- Even a moderately optimizing compiler will produce good machine code. Something likeready: ldb r0, STATUS-ADDRESS and r0, r0, READY-BIT beq _readydo-it: ldb r0, DATA-ADDRESS
Here do-it is acquiring a single byte from interface hardware when the status register indicates that valid data is available in the dara register.
- Worst case response time is the execution of
and
,beq
,ldb
,and
andbeq
- Normally code like this would be inside a loop, acquiring one byte after another until no more are available.
What if the CPU has to two things at once?
E.g.,
- collect bytes coming in a serial port
- maintain a clock
Unless the rate of bytes coming in and rate of clock ticks areidentical
you are guaranteed to lose something sooner or later.
Return to:
- Due date for assignment 0
- Ubuntu 10.10
- Caches, optimization, clock speed, FIFOs
- Libraries: memcpy in particular
Actually real-world programming, which means
- World is measured in seconds, metres, etc.
- Programs manipulate bits, bytes, words, which must be translated into into real-world measures.
For example,- formatted output: translate from int, which computers manipulate, to decimal, which humans read
- out in the open: i2a( ), printf( )
- hidden: print, cout
- Banking: int translates into, e.g., number of cents
- program says dispense( 10000 ), which means `put five twenties into the hopper'.
- microcontrollers start
- activating motors
- sensing forces
- reading digitized video
- etc.
- Train control: contents of messages map, sometimes indirectly, into changes in speed of trains, state changes (turn-outs, train locations), sensor reports.
- formatted output: translate from int, which computers manipulate, to decimal, which humans read
- Throughput
- e.g., number of frames per second in a game
- e.g., frequency of sensor sampling in process control
- no solution except
- getting better hardware
- getting better algorithms
- restructuring the task
- Response time
- e.g., time from button press to gun firing in game
- e.g., time from sensor reading to control code executing in process control
- several programming techniques exist
- busy-wait
- polling loop
tension between flexibility and performance
In cs452 we take guaranteed response time as the defining quality ofreal-time computation.
How does one keep time in a computer?
- crystal oscillator in a phase-locked loop
- interrupts from a timer
- ntp
This is used to synchronize with an external event, minimizing responsetime.
#define FOREVER for( ; ; )FOREVER { while( !ready( ) ) ; do-it( );}or in another form
FOREVER { if ( ready( ) ) do-it( );}Sometimes you only want to do the thing once, as you do when putting acharacter on a serial line.
#define UART1_BASE 0x808c0000#define UART_DATA_OFFSET 0x00 // low 8 bits#define UART_FLAG_OFFSET 0x18 // low 8 bits#define TXFF_MASK 0x20 // Transmit buffer full flags = (int *)( UART1_BASE + UART_FLAG_OFFSET ); data = (int *)( UART1_BASE + UART_DATA_OFFSET ); while( ( *flags & TXFF_MASK ) ) ; *data = c;Note. The volatile
keyword.
From the time that the ready bit sets until the first instruction of do-itis executed
Font size:
Interval:
Bookmark:
Similar books «Real-Time Programming Lecture Notes (Waterloo CS452)»
Look at similar books to Real-Time Programming Lecture Notes (Waterloo CS452). We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.
Discussion, reviews of the book Real-Time Programming Lecture Notes (Waterloo CS452) and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.