2021-09-10

Announcements

  • hw05 due Monday

Class time

Ideas

Check out one possible taxonomy to categorize these different ways (right-click and Open image in new tab to zoom+scroll):

paradigms

The C-language style you learned from ECE 251 is classified as imperative -> procedural. A.K.A. you tell it to do stuff.

Here are some examples of languages and the common paradigms they are used in. Note that most languages support several ways of programming (paradigms)

  • imperative

    • procedural — C, python

      • concatenative — Forth, PostScript

    • object-oriented — C++, Python, JavaScript, Java

  • declarative

    • functional — Forth, JavaScript, Lisp / Scheme /Clojure / CHICKEN

    • reactive — JavaScript frameworks (e.g. React)

  • data-driven — AWK (input -> transformedTo -> output)

Event-driven

Is similar to declarative -> reactive, different from, or close enough to event-driven depending on who you ask.

Time-ordered behavior

The book introduces "time-ordered" concept that is super common in embedded systems. Sequence of things that happen in time (measured in seconds, even!). A state machine captures this behavior and the constellation of triggers and actions that happen in a conditional sequence.

RI Tools (RIMS, RIBS, etc)

License to these tools as part of the zyBook!

  • zyBook -> under Table of contents -> About this material

  • Copy the license key string to somewhere safe.

  • RI Tools download, download v2.8.0 beta

  • Need to install .NET 3.5 somehow (notes are WIP)

    • Registry Editor HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU

    • UseWUServer -> 0 (default is 1)

    • restart

Activity

Air bag enable and indicator

zyBook 2.3.4 Airbag system

A car has a sensor that sets A to the passenger’s weight (e.g., if the passenger weighs 130 pounds, A7..A0 will equal 10000010). Write a RIM C program that enables the car’s airbag system (B0=1) if the passenger’s weight is 105 pounds or greater. Also, illuminate an "Airbag off" light (by setting B1=1) if weight > 5 pounds but weight < 105 pounds.

Write your own version of this specification as bullet-points or something that is easier to read and less RIMS-specific.

Draw a state machine diagram for this system with a partner.

  • How many states?

  • What triggers a change of state?

  • What are the outputs and under what conditions?


  • How do you verify that the code works correctly? This is different than merely compiling, loading,and executing without errors.

  • How many tests does this require? # conditions or transitions?

Keurig coffee maker

What is the state machine diagram for this product?