Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PIC microcontroller is used to regulate the speed of a conveyor belt. A hopper d

ID: 645109 • Letter: P

Question

PIC microcontroller is used to regulate the speed of a conveyor belt. A hopper dispenses items onto a conveyor belt. If the average frequency of the hopper dispensing signal is equal or exceeds 1000Hz when sampled 4 times consecutively (items being dispensed onto the conveyor belt at a frequency faster than 1000 Hz) then the output signal to the Belt Speed Controller (from the PIC) should be '1', otherwise, the output signal to the Belt Speed Controller should be '0'. An external signal applied to INTO will occur every 10 minutes to initiate this process of checking the dispensing frequency and adjusting the conveyor Belt Speed Controller. Your solution should use CCP1 for input capture and Timer 1. Timer 1 should use a prescale = 8. Port B bit 0 is used to control the Belt Speed Controller. You may assume that the total time for 4 input pulses on CCP1 will be less than maximum Timer value (therefore you will not need to check for rollover).

Explanation / Answer

using System;

class ConveyorBeltControl{
// enumerate the conveyor belt commands
public enum action { start, stop, forward, reverse };

public void conveyor(action com) {
    switch(com) {
      case action.start:
        Console.WriteLine("Starting the conveyor belt.");
        break;
      case action.stop:
        Console.WriteLine("Stopping the conveyor belt.");
        break;
      case action.forward:
        Console.WriteLine("Moving forward the conveyor belt.");
        break;
      case action.reverse:
        Console.WriteLine("Moving backward the conveyor belt.");
        break;
    }
}
}

public class ConveyorDemo {
public static void Main() {
    ConveyorBeltControl c = new ConveyorBeltControl();

    c.conveyor(ConveyorBeltControl.action.start);
    c.conveyor(ConveyorBeltControl.action.forward);
    c.conveyor(ConveyorBeltControl.action.reverse);
    c.conveyor(ConveyorBeltControl.action.stop);
   
}
}