Mechatronics Portfolio
Logan Williamson's Mechatronics Portfolio and Documentation Repository
Functions | Variables
Lab0x04_taskEncoder.py File Reference

A method for instantiating, updating the position, and zeroing a quadrature encoder object. More...

Functions

def Lab0x04_taskEncoder.taskEncoderFcn (taskName, period, zFlag, timDATA, posDATA, delDATA, DATA, speedDATA)
 A generator to implement the Encoder task as an FSM. More...
 

Variables

 Lab0x04_taskEncoder.S0_INIT = micropython.const(0)
 
 Lab0x04_taskEncoder.S1_Update = micropython.const(1)
 
 Lab0x04_taskEncoder.S2_Zero = micropython.const(2)
 

Detailed Description

A method for instantiating, updating the position, and zeroing a quadrature encoder object.

This file calls the encoder.py class to generate an encoder object. It is then called from an external file to perform updates to the position of that encoder object, and to zero/reset the absolute position of that encoder object. The external file utilizes other tasks in addition; therefore, this file is set up to work within a cooperative multitasking context. In particular, this file works with taskUser.py.

Author
Logan Williamson
Brianna Roberts
Date
01/23/2022

Function Documentation

◆ taskEncoderFcn()

def Lab0x04_taskEncoder.taskEncoderFcn (   taskName,
  period,
  zFlag,
  timDATA,
  posDATA,
  delDATA,
  DATA,
  speedDATA 
)

A generator to implement the Encoder task as an FSM.

The task runs as a generator function and requires a task name and interval to be specified.

Parameters
taskNameThe name of the task as a string.
periodThe task interval or period specified as an integer number of microseconds.
zFlagShared flag variable which causes FSM to enter zeroing state.
timDATAShared data for the time during a data recording session. This is not currently utilized by taskUser.py (instead, it is immediately fed into DATA); however, this is shared to taskUser for debugging purposes.
posDATAShared data for printing the position of the encoder upon 'p' or 'P' press.
delDATAShared data for printing the delta value of the encoder upon 'd' or 'D' press.
DATAShared data for data recording upon 'g' or 'G' press.