Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Input Parsing Subsystem #2

Open
ZacharyDownum opened this issue Jan 11, 2018 · 0 comments
Open

User Input Parsing Subsystem #2

ZacharyDownum opened this issue Jan 11, 2018 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@ZacharyDownum
Copy link
Contributor

ZacharyDownum commented Jan 11, 2018

Objectives

  • Create a project that will accurately measure the duty cycle of an input signal, assumed to be a square wave (PWM) input of an unknown frequency.
  • Simplify the code such that the only outward-facing functions abstract away the complexity (including register use, calculations, etc.) and allows the user to obtain the latest duty cycle measurement without being concerned with the underlying implementation or processes.

Steps to Complete

  • Reuse most of the code from the Input Capture Example
  • In addition to the functionality the Input Capture Example provides, do the following:
    • use the timing information provided by the Input Capture Example to produce an accurate approximation of the duty cycle of the signal by doing the following:
      • Take the time between the rising and falling edge. This is the approximate time the signal input was high.
      • Take the time between the first and the second rising edge. This is the approximate time of one signal period.
      • Divide the signal's logic high time by its total period time. This decimal is an approximation of the duty cycle of the signal.
  • After this is completed, go through and create a struct representing a single IC module that functions in this manner
    • The only outward-facing variables and functions are those that provide information pertinent to the objectives of the project.
    • The struct should contain neatly-named function pointers directed at internal, specific functions (that may not be so nicely named).
  • The struct should contain a variable that is continually updated (with no prompting from the user) with the most recent duty cycle of the input signal
  • The struct should have an initialize function that begins input signal data collection. This should be able to be called by the user
    • This initialization function should put the proper values in registers and create interrupts and the logic necessary to produce the estimated duty cycle (most of which will be within the interrupts).
@ZacharyDownum ZacharyDownum self-assigned this Jan 11, 2018
@ZacharyDownum ZacharyDownum added the enhancement New feature or request label Jan 11, 2018
ZacharyDownum added a commit that referenced this issue Apr 3, 2018
…to Use PWM Instead of Static Pins

The 50% duty cycle used for the turning PWM signal is a placeholder.  This may need to change in future development.

Pin A2 = Enable Pin on the stepper motor
Pin A3 = Direction (CW/CCW) Pin on the stepper motor
PWM Module #2 (Pin P1) = signal to the stepper motor to begin turning
ZacharyDownum added a commit that referenced this issue Apr 3, 2018
…tional Stepper Motor

Changed the PWM_Module 2 to use Timer1's prescaler of 64 to allow for smaller frequency PWM signals.

Updated the main driver such that the number of pulses sent to the stepper motor has a 1:1 relationship to the number of steps taken by the motor.  The base configuration is currently a PWM of 400Hz coupled with a 30 RPM max speed on the stepper motor, with each PWM pulse moving the stepper by +/-1 count.
ZacharyDownum added a commit that referenced this issue Apr 5, 2018
Input Capture Module #4 is used to monitor the number of pulses sent to the stepper motor via the PWM Module #2.  This count is used to know when the user has moved the stepper too far in one direction and prevents further motion in that direction.

Fixed various issues (like changing Pin A2 unnecessarily and several incorrect if statements in the IC Module #4 Interrupt) that was causing the PIC to send inappropriate signals to the stepper motor, which caused it to malfunction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant