Copy of EE128 Lab 6
.docx
keyboard_arrow_up
School
University of California, Riverside *
*We aren’t endorsed by this school
Course
128
Subject
Electrical Engineering
Date
Apr 3, 2024
Type
docx
Pages
9
Uploaded by MasterLapwing1954
LABORATORY #6: REPORT
Serial Communication (UART, SPI, I2C)
Part 1:
I2C-Based 6-Axis Accelerometer and Magnetometer
Part 2:
SPI-Based Communication with Arduino
Abstract:
In this lab, we will familiarize ourselves with I2C(Inter-Integrated Circuit), a multi-
master synchronous serial communication bus. In I2C, devices are classified into masters and servants and use two lines for data communication: SCL and SDA. We will use I2C to interface with an accelerometer/magnetometer sensor. In addition to this, we will familiarize ourselves with SPI based communication with Arduino. SPI, a synchronous serial protocol, classifies
devices into masters and servants and uses four wires to carry out the task of data communication: MOSI, MISO, SCK, and SS.
Experiment System Specification:
Part 1:
1.
We will use the processor expert to communicate with the on board accelerometer and magnetometer and send the telemetry to our computer via UART to USB.
2.
This experiment requires configuring the component and some additional software packages to work.
3.
Send and output the accelerometer and magnetometer and message to the terminal using I2C.
Part 2:
1.
We will use K64F as a master and Arduino Uno as a slave device in the SPI bus.
2.
SS will not be used since there is only one servant in this lab. 3.
We will also use Processor Expert as well.
4.
Connect the Arduino Uno and K64F via SPI line.
5.
Send and output the accelerometer and magnetometer and message to the Arduino Uno’s serial monitor.
Hardware Design:
Part 2:
Question 1:
Software Design:
K64F
/* ###################################################################
** Filename
: main.c
** Project : Lab6_Part2
** Processor : MK64FN1M0VLL12
** Version : Driver 01.01
** Compiler
: GNU C Compiler
** Date/Time : 2019-11-03, 17:50, # CodeGen: 0
** Abstract
:
** Main module.
** This module contains user's application code.
** Settings
:
** Contents
:
** No public methods
**
** ###################################################################*/
/*!
** @file main.c
** @version 01.01
** @brief
** Main module.
** This module contains user's application code.
*/
/*!
** @addtogroup main_module main module documentation
** @{
*/
/* MODULE main */
/* Including needed modules to compile this module/procedure */
#include "Cpu.h"
#include "Events.h"
#include "Pins1.h"
#include "FX1.h"
#include "GI2C1.h"
#include "WAIT1.h"
#include "CI2C1.h"
#include "CsIO1.h"
#include "IO1.h"
#include "MCUC1.h"
/* Including shared modules, which are used for whole project */
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
#include "PDD_Includes.h"
#include "Init_Config.h"
/* User includes (#include below this line is not maintained by Processor Expert) */
/*lint -save -e970 Disable MISRA rule (6.3) checking. */
/*library to configure GPIO*/
#include "MK64F12.h"
unsigned char write[512];
int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
//Configure GPIO PORTB[2]
SIM_SCGC5 |= SIM_SCGC5_PORTB_MASK; /*Enable Port B Clock Gate Control*/
PORTB_GPCLR = 0x00040100; /*Configure PORTB[2] for GPIO*/
GPIOB_PDDR = 0x04; /*Configure PORTB[2] as output*/
GPIOB_PDOR = 0x00; //Initialize PORTB[2] = 0
/* Write your local variable definition here */
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
uint32_t delay;
uint8_t ret, who;
int8_t temp;
int16_t accX, accY, accZ;
int16_t magX, magY, magZ;
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Define FACTS and write it’s necessity and Benefits. With neat diagrams briefly describe different types of FACTS controllers. Describe SVC and STATCOM and compare their performance
arrow_forward
Fundamental of mechatronics technology
arrow_forward
Design an interfacing system for solar controller, your design should monitor the solar system data like solar panels output, energy consumption, battery charging current, etc, the system must have keypad input and LCD display to allow users to view system status and adjust system parameters like max charging current, max consumption load.
...Draw a detailed block diagram of the interfacing system showing all the signals
arrow_forward
Digital Design
using FSM and controllers design odd-counter that count through the sequence 1,3,5,1,3,5,…etc . The counter would transit from one number to another only if the a button (b) if pushed. (show all necessary design steps. Don’t skip anything)
arrow_forward
help
arrow_forward
pls answer asap
arrow_forward
Question 2.
a) Write the equation for a 4-to-1 multiplexer with control inputs Co and C.
b) Show how to connect two 4-to-1 and one 2-to-1 multiplexers together to form
an 8-to-1 multiplexer with three control inputs.
arrow_forward
Could you explain this question in details, please.
This question is about the Embedded System (Electrical & Electronic engineering).
- Explain what is CAN BUS.
arrow_forward
I have a wooden toy train that runs on wooden tracks. I would like to place two ESP-WROOM-32 Boards on top of the train. Broadcast communication (which involves radio frequency, not Wi-Fi) would help communicate about the train's lateness to five other wooden trains on the same track. Local communication would help communicate to the train station about the train's lateness. I would also need radio frequency Tx-Rx Modules for discharging and undergoing the signal, and repeaters just in case the signal loses power due to long-distance traveling. My wooden train should be automated. It should run at 4 inches per second, keep a minimum distance of 30 seconds away from the other wooden trains, and make a 17-second-long stop every 500 seconds.
What's the procedure to connect the components?
What's the Arduino code (C++) for this project?
arrow_forward
For a triac circuit shown in figure 5, determine the load current if the triac will turn on due to gate with Vin = 220V, 60Hz, R₁ = 40 ohms, and firing angle of 48 degree.
A. 5.19A
B. 4.43A
C. 3.38A
D. 7.21A
arrow_forward
Could you explain this question in details, please.
This question is about the Embedded System (Electrical & Electronic engineering).
- Explain Arbitration in CAN BUS.
arrow_forward
The p-channel JFET used in Digital technology as_____.
a.switch
b.rectifier
c.invertor
d.amplifier
arrow_forward
6. Given the properties of the Heliene Black Mono 390 W module, what would happen to the
position of the maximum power point (Pmax) if the temperature drops from 25 °C (STC conditions)
to 10 °C?
arrow_forward
Find the LAD for the silo simulator in Logix pro
arrow_forward
Subject-power electronic
Define
A.Delay time
B.Rise time
C.reverse recovery voltage
D.spread time.
arrow_forward
Select the best answer for the question.
4. Look at the drawing shown in the figure above. When you see this drawing in a schematic diagram, you should recognize that it represents a/an
O A. step-up transformer.
O B. inverter.
C. bridge rectifier.
OD. thermal relay.
arrow_forward
Arduino Mega is based on ATmega328
processor
True
False O
* Arduino Uno has .... Analogue input/output
12 O
8
16
Arduino Uno processor speed is greater
than Arduino Due
False O
True O
arrow_forward
Solve it fast fast plz
arrow_forward
Explain RTD with necessary diagram and equations.
arrow_forward
I opened a broken Coin Pusher Arcade game to fix, and I saw a burned IC. Between
Microprocessor and Microcontroller, what kind of IC do you think is that? And why?
arrow_forward
What are ASICs (Application-Specific Integrated Circuits), and in what scenarios are they preferred over general-purpose microchips?
arrow_forward
Design*/draw a 10-second timer using a 555 IC (Astable) with correct values of R1-2 and C.
and an LED to flash
For the output (pin 3), connect an LED and current limiting resistor (220 Omhs
) to the ground.
Assume 50% DC and select a Capacitor;
arrow_forward
Discuss the operation of VMOS and UMOS and their construction.
arrow_forward
TTR 300 , what are the features
(specifications) of the device ?
arrow_forward
What is the problem of using a pushbutton or a switch as a digital input to a microcontroller. Then, what is the solution(s) of that problem?
arrow_forward
A common objective when manufacturing printed circuit boards (PCBs) is
O a. maximizing the number of drill bit changes.
O b.
maximizing the number of holes drilled.
c.
minimizing the total distance the drill bit must be moved.
O d.
minimizing the number of holes drilled.
arrow_forward
Q1 (i) What is an LVDT and what is it used for? (ii) Describe the construction features of an LVDT.
Q2 (i) What is a strain gauge and what is it used for? (ii) What is the principle of operation of a strain gauge? (iii) Describe some applications of strain gauges.
arrow_forward
I have an O Gauge track and would like to convert it into a “sensored” track. Additionally, I would like to connect that track to an ESP-WROOM-32 board that should flash an LED whenever the track detects a non-moving train. Please list all the components (and how many of each) needed. Also, what’s the procedure for connecting the components?
arrow_forward
I need the answer quickly
arrow_forward
Explain the term “stability” in the context of signals and systems
arrow_forward
Question 4
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Electricity for Refrigeration, Heating, and Air C...
Mechanical Engineering
ISBN:9781337399128
Author:Russell E. Smith
Publisher:Cengage Learning
Related Questions
- Define FACTS and write it’s necessity and Benefits. With neat diagrams briefly describe different types of FACTS controllers. Describe SVC and STATCOM and compare their performancearrow_forwardFundamental of mechatronics technologyarrow_forwardDesign an interfacing system for solar controller, your design should monitor the solar system data like solar panels output, energy consumption, battery charging current, etc, the system must have keypad input and LCD display to allow users to view system status and adjust system parameters like max charging current, max consumption load. ...Draw a detailed block diagram of the interfacing system showing all the signalsarrow_forward
- Digital Design using FSM and controllers design odd-counter that count through the sequence 1,3,5,1,3,5,…etc . The counter would transit from one number to another only if the a button (b) if pushed. (show all necessary design steps. Don’t skip anything)arrow_forwardhelparrow_forwardpls answer asaparrow_forward
- Question 2. a) Write the equation for a 4-to-1 multiplexer with control inputs Co and C. b) Show how to connect two 4-to-1 and one 2-to-1 multiplexers together to form an 8-to-1 multiplexer with three control inputs.arrow_forwardCould you explain this question in details, please. This question is about the Embedded System (Electrical & Electronic engineering). - Explain what is CAN BUS.arrow_forwardI have a wooden toy train that runs on wooden tracks. I would like to place two ESP-WROOM-32 Boards on top of the train. Broadcast communication (which involves radio frequency, not Wi-Fi) would help communicate about the train's lateness to five other wooden trains on the same track. Local communication would help communicate to the train station about the train's lateness. I would also need radio frequency Tx-Rx Modules for discharging and undergoing the signal, and repeaters just in case the signal loses power due to long-distance traveling. My wooden train should be automated. It should run at 4 inches per second, keep a minimum distance of 30 seconds away from the other wooden trains, and make a 17-second-long stop every 500 seconds. What's the procedure to connect the components? What's the Arduino code (C++) for this project?arrow_forward
- For a triac circuit shown in figure 5, determine the load current if the triac will turn on due to gate with Vin = 220V, 60Hz, R₁ = 40 ohms, and firing angle of 48 degree. A. 5.19A B. 4.43A C. 3.38A D. 7.21Aarrow_forwardCould you explain this question in details, please. This question is about the Embedded System (Electrical & Electronic engineering). - Explain Arbitration in CAN BUS.arrow_forwardThe p-channel JFET used in Digital technology as_____. a.switch b.rectifier c.invertor d.amplifierarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Electricity for Refrigeration, Heating, and Air C...Mechanical EngineeringISBN:9781337399128Author:Russell E. SmithPublisher:Cengage Learning
Electricity for Refrigeration, Heating, and Air C...
Mechanical Engineering
ISBN:9781337399128
Author:Russell E. Smith
Publisher:Cengage Learning