Ele3emb assignment- write an interrupt service routine c


Requirements

You have been tasked to design a controller for a 3d printer whose total manufacturing cost should be less than $250AUD. The 3d printer has three gantry's which control either the x,y or z position of the printer head. Each gantry is moved by a single DC motor.

The controller should position the head of the printer in 3d space according to x,y and z co-ordinates. The co-ordinates are sent to the controller via an RS232 communication link.

The size of the controller should smaller than 130x 130x 100mm. The total weight of the controller should be less than 225gm. The controller should be low power and consume less than 1W when idle, and less than 5W when running.

Questions

PLEASE ANSWER ALL QUESTIONS WITHIN LMS

1. Fill out the following detailing the requirements of the project. (HW Design Lecture)

Name

Purpose

Inputs

Outputs Functions

Manufacturing cost

Power

Physical size & weight

2. (a) How much does the 3d printing head move in between pulses from the encoder. Give your answer in mm to four decimal places Hint, both outputs have 211 pulses per revolution. Use circumference = πd in your answer. Show all working.

Distance moved per pulse: ___mm

(b) Two mathematical equations are shown below, one for forward movement and one for reverse movement. Each update the position of the 3d printing head dependent on its movement. This occurs whenever a rising edge is detected on output A. The position should be in µm. Hint. You will require the previous position known.

Forward
Position = position + ____(µm)

Backwards

Position = position - _____(µm)

3. Write an interrupt service routine which updates the position of the 3d printing head. It is activated whenever a rising edge is detected on output A. hint your code should update the position in µm, dependent on wither the printing head is moving backwards or forwards.

#pragma interrupt
void isr outputA(void)
{

}

4. Write a formula which calculates the error in mm between the position of the 3d printing head and the desired position given by RS232 communication link.

position error = _______mm

5. Write some code which intialises timers 0,1 and 2 to operate in PWM mode.

void init pwmvoid

{

}

6. (a) The input to the PWM timers is to be defined by the following equation.

PWM = Kp x position error + offset.

Where Kp is the error gain and is constant. What offset is required to ensure that when the error term is zero that the PWM output is 50%.

(b) Write some code which performs the following:

- Ensures that, Kp x position error + offset, does not exceed the limits of the available PWM input (positive or negative).

- If the above equation is larger than the available maximum PWM input, set the PWM input to its maximum input.

- If the above equation is less than zero, set the PWM input to zero. Assume Kp x position error is never larger than ±65535

(c) Explain what will occur as the error approaches zero. ie. the printer head approaches the desired position. Will the output PWM at that particular point in time be large enough to move the printer head to the desired location?

You may add an attachment to aide your explanation.

(d) Explain what would happen if the gain Kp was extremely large. (ie. a small error produces a large PWM value.) Will the controller be able to move the head to the desired location?

7. Write an interrupt service routine (C code) named ‘posi RXD'. The interrupt service rou- tine runs whenever a byte is received via the RS-232 connection to the PC. The name of the byte received is ‘U1RXD'. The ISR should assemble the x,y and z position data ready for the error calculation.

#pragma interrupt

void posi RXD(void)
{

}

Attachment:- Assignment.rar

Request for Solution File

Ask an Expert for Answer!!
Other Engineering: Ele3emb assignment- write an interrupt service routine c
Reference No:- TGS01401842

Expected delivery within 24 Hours