#include "encoder.h"#include "registers.h"Go to the source code of this file.
Defines | |
| #define | ctrlH_dataL (1 << 0) |
| #define | writeL (1 << 1) |
| #define | chipsel_U9L_U8H (1 << 2) |
| #define | readL (1 << 3) |
| #define | axis_XL_YH (1 << 4) |
| #define | encDATA_DDR DDRP |
| #define | encDATA PORTP |
| #define | encCONTROL_DDR DDRDLC |
| #define | encCONTROL PORTDLC |
| #define | DATA 0 |
| #define | CTRL 4 |
Functions | |
| static void | delay (void) |
| Simple function to add delay when doing bus reads or writes. | |
| void | encOut (unsigned char port, unsigned char val) |
| Write an 8 bit value to one of the encoder chip registers . | |
| unsigned char | encIn (unsigned char port) |
| Reads an 8 bit value from the one of the encoder registers. | |
| void | encLoadPR (unsigned char port, unsigned long val) |
| load first 24 bits of val into the preset register (PR) | |
| void | encStart (void) |
| Initialize for both encoder chips. | |
| unsigned long | encRead (unsigned char port) |
| Reads a the count of a specific encoder. | |
|
|
|
|
|
|
|
|
Definition at line 55 of file encoder.c. Referenced by encIn(), encLoadPR(), encOut(), encRead(), and encStart(). |
|
|
|
|
|
Definition at line 54 of file encoder.c. Referenced by encLoadPR(), and encRead(). |
|
|
|
|
|
Definition at line 38 of file encoder.c. Referenced by encStart(). |
|
|
|
|
|
Definition at line 36 of file encoder.c. Referenced by encIn(), encOut(), and encStart(). |
|
|
|
|
|
|
|
|
Simple function to add delay when doing bus reads or writes.
Definition at line 48 of file encoder.c. Referenced by encIn(), encOut(), and RTAI_PROTO(). |
|
|
Reads an 8 bit value from the one of the encoder registers. Long Description if necessary.
Definition at line 130 of file encoder.c. References axis_XL_YH, BACK, chipsel_U9L_U8H, CTRL, ctrlH_dataL, delay(), encCONTROL, encDATA, encDATA_DDR, LEFT, readL, and writeL. Referenced by encRead(). |
|
||||||||||||
|
load first 24 bits of val into the preset register (PR) Since data can be moved to the LS7266 only 8bits at a time the preset register acts as a 24 bit temporary buffer. Three bytes are loaded into the preset register and then the 24 bit value can be moved into the 24 enocder count register, or the clock prescaler. (This function only loads the PR, moving the value to another register is up to you)
Definition at line 184 of file encoder.c. References CTRL, DATA, and encOut(). Referenced by encStart(). |
|
||||||||||||
|
Write an 8 bit value to one of the encoder chip registers . The port allows you to select chip, axis, and register the value will be loaded into. The enocoder board has two LS7266 IC's, that are address seperately. Each LS7266 IC has two identical register sets (axis's) that allow it two keep track of two encoder inputs. Either the data register one of the control registers can be selected. When writing one of the control registers the 5th and 6th bit of the data value (val) determine which control register to write bit 6 | bit 5 | control register 0 0 RLD (reset and load signal decoders) 0 1 IOR (input/output control register) 1 0 CMR (counter mode register) 1 1 IDR (index control register)
Definition at line 84 of file encoder.c. References axis_XL_YH, BACK, chipsel_U9L_U8H, CTRL, ctrlH_dataL, delay(), encCONTROL, encDATA, encDATA_DDR, LEFT, readL, and writeL. Referenced by encLoadPR(), encRead(), and encStart(). |
|
|
Reads a the count of a specific encoder. Each encoder count is a 24 signed number. For the port use the <FRONT, BACK, RIGHT, LEFT> constants in encoder.h For Example, to get the value of the front left encoder use: encRead(FRONT + RIGHT); <port> <which encoder to read (0-3)>
Definition at line 297 of file encoder.c. References CTRL, DATA, encIn(), and encOut(). Referenced by main(). |
|
|
Initialize for both encoder chips. Each chip handles two encoder inputs each. There are many setting options, see the spec sheet for the encoders before changing anything.
Definition at line 216 of file encoder.c. References BACK, CTRL, encCONTROL_DDR, encDATA_DDR, encLoadPR(), encOut(), FRONT, LEFT, and RIGHT. Referenced by main(). |
1.4.4