Skip to content

Introduction-to-Computer-Engineering/final-project-assignment-8-week-13-este117

Repository files navigation

Oscilloscopes and serial protocols

Assignment 8, Part 2: Final Project

Part II (Week 13, Assignment #8)

Oscilloscope warmup:

  1. Visualize simple continuous signals: Visualize the following signals, using the Auto regime and default settings (trigger on a rising edge on CH1). For each signal, take a video of the setup (the source wire and connection of the oscilloscope probe) and the display of the oscilloscope, while varying one of the signal properties (wave shape, frequency, amplitude) using the controls of the source. Signals:

    i) Configure the OUT of the built-in function generator on the workstation:

    out.js

    Video: Out.js

    ii) Write a one-line micro:bit program to set an analog pin to emit PWM pulses:

    PWM_pulse

    Video: PMW Pulse

    iii) Write a loop that varies the duty cycle, up and down, between 5% and 95%, in steps of 5%:

    PMW_5percent

    iv)

    servo.js

I2C Warm Up

  1. What are the disadvantages of the other two serial communication channels, UART and SPI, and how does I2C improve on them?

The disadvantages of UART is that it requires two devices that have the same clock rate. It is also difficult to implement in terms of software due to the time complexity. The disadvantages of UART are the number of pins requiered due to the amount of devices needed. I2C improves them by allowing more than one master and being able to connect to 1008 slave devices. Software is also easier to implement.

  1. I2C is a two-wire serial communication channel. What are the two wires, SDA and SCL?

SDA is the data signal from the slave device and SCL is the clock signal from the master device.

  1. What distinguishes the master and the slaves?

The slave can write and read data to the slave, however, the slaves cannot do the same to the master. Slaves cannot initiate transfer and they have to obey when called opon by the master.

  1. How are the two types of protocol frames different?

The address frame first must be generated and lets the slave know where the information needs to be sent by the master. The data frame first is sent to the SDA which is chosen by the master or slave depending on either a read or write calling.

  1. What is the most appropriate trigger for capturing an I2C frame on the oscilloscope?

The most appropriate trigger for capturing an I2C frame on the oscilloscope is SDA becasue of the SDA's falling edge.

First steps with I2C

  1. IC2 file : write_I2C.js

    a) What frame did you capture?

    Initial address frame sent with I2C

    Image1027319.jpg

    b) What does the I2C write function do when there is nothing connected?

    Nothing happens since there is no slave connected to pull the SDA signal low. The master will try to initiate a transfer, but the slave will not confirm feedback

    c) Is there a difference in what you capture if you write a number to one of the internal device addresses?

    Yes, writing to an internal device will recieve feedback from the slave which will give you an address frame as well as a data frame. For arbitrary adresses however, there is no feedback from the slave only a data frame

  2. Write a short program to read a number from the I2C devices on the microbit.

i) Try all three addresses. (Bonus for a cogent argument about why there are three.)

For the accelerometer the first address (0x19) is the slaves address. The next is the read address (0x33) and the last is the write address (0x32). The last two tell the slave which operation to perform Read or Write.

Setup: Setup.jpg

code : arbitrary.js

image: display.jpg

ii) Try signed and unsigned single bype integers.

Unsigned byte integers:

Unsigned.js

a) What values do you read?

    I read the value 128

b) Can you get different values by moving the micro:bit around.

    No I cannot get different numbers by moving the mircrobit

Signed byte integers:

signed.js

a) What values do you read?

    I read the value -128

b) Can you get different values by moving the micro:bit around.

  No I cannot get different numbers by moving the mircrobit

]

About

final-project-assignment-8-week-13-este117 created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors