Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

ppmc.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

union  IO32
union  LONGBYTE

Defines

#define __attribute__(x)
#define PPMC_MAX_AXIS   4
#define DEFAULT_PPMC_BASE_ADDRESS   0x378
#define ppmc_base_addr   STG_BASE_ADDRESS
#define ENCCNT0   0x00
#define ENCCNT1   0x03
#define ENCCNT2   0x06
#define ENCCNT3   0x09
#define ENCCTRL_0   0x03
#define ENCRATE_0   0x04
#define ENCISR_0   0x0C
#define ENCLOAD_0   0x00
#define ENCCNT4   0x10
#define ENCCNT5   0x13
#define ENCCNT6   0x16
#define ENCCNT7   0x19
#define ENCRATE_1   0x14
#define ENCLOAD_1   0x10
#define ENCCTRL_1   0x13
#define ENCISR_1   0x1C
#define DAC_0   0x20
#define DAC_1   0x22
#define DAC_2   0x24
#define DAC_3   0x26
#define DAC_4   0x30
#define DAC_5   0x32
#define DAC_6   0x34
#define DAC_7   0x36
#define DAC_MODE_0   0x2C
#define DAC_WRITE_0   0x28
#define DAC_MODE_1   0x3C
#define DAC_WRITE_1   0x38
#define DIN_0   0x40
#define DIN_1   0x41
#define DOUT_0   0x50
#define DOUT_1   0x51
#define NO_BOARD   1
#define BOARD_PRESENT   0
#define NO_HOME_SWITCH
#define NO_LIMIT_SWITCH
#define _500_MICROSECONDS   500
#define _1_MILLISECOND   1000
#define _2_MILLISECONDS   2000
#define _3_MILLISECONDS   3000
#define _4_MILLISECONDS   4000
#define _5_MILLISECONDS   5000
#define _10_MILLISECONDS   10000
#define _100_MILLISECONDS   100000L
#define _1_SECOND   1000000L
#define MAX_PERIOD   -1L

Functions

char __attribute__ ((unused)) ppmc_h[]="$Id
void SelAddr (unsigned int port)
void WriteData (unsigned char byte)
void WriteData16 (unsigned short word)
unsigned short ReadData (void)
unsigned short SelRead (unsigned int port)
void SelWrt (unsigned int port, unsigned char byte)
void SelWrt16 (unsigned int port, unsigned short word)
short DACQuit (void)
short DACInit (void)
int DIOQuit (void)
int DIOInit (void)
int EncoderQuit (void)
int EncoderInit (void)
int EncoderLatch (void)
int ppmcAioQuit (void)
int ppmcAioMaxInputs (void)
int ppmcAioMaxOutputs (void)

Variables

 WORDBYTE


Define Documentation

#define BOARD_PRESENT   0
 

Definition at line 167 of file ppmc.h.

#define DAC_0   0x20
 

Definition at line 141 of file ppmc.h.

#define DAC_1   0x22
 

Definition at line 142 of file ppmc.h.

#define DAC_2   0x24
 

Definition at line 143 of file ppmc.h.

#define DAC_3   0x26
 

Definition at line 144 of file ppmc.h.

#define DAC_4   0x30
 

Definition at line 146 of file ppmc.h.

#define DAC_5   0x32
 

Definition at line 147 of file ppmc.h.

#define DAC_6   0x34
 

Definition at line 148 of file ppmc.h.

#define DAC_7   0x36
 

Definition at line 149 of file ppmc.h.

#define DAC_MODE_0   0x2C
 

Definition at line 151 of file ppmc.h.

#define DAC_MODE_1   0x3C
 

Definition at line 154 of file ppmc.h.

#define DAC_WRITE_0   0x28
 

Definition at line 152 of file ppmc.h.

#define DAC_WRITE_1   0x38
 

Definition at line 155 of file ppmc.h.

#define DEFAULT_PPMC_BASE_ADDRESS   0x378
 

#define DIN_0   0x40
 

Definition at line 160 of file ppmc.h.

#define DIN_1   0x41
 

Definition at line 161 of file ppmc.h.

#define DOUT_0   0x50
 

Definition at line 163 of file ppmc.h.

#define DOUT_1   0x51
 

Definition at line 164 of file ppmc.h.

#define ENCCNT0   0x00
 

Definition at line 118 of file ppmc.h.

#define ENCCNT1   0x03
 

Definition at line 119 of file ppmc.h.

#define ENCCNT2   0x06
 

Definition at line 120 of file ppmc.h.

#define ENCCNT3   0x09
 

Definition at line 121 of file ppmc.h.

#define ENCCNT4   0x10
 

Definition at line 131 of file ppmc.h.

#define ENCCNT5   0x13
 

Definition at line 132 of file ppmc.h.

#define ENCCNT6   0x16
 

Definition at line 133 of file ppmc.h.

#define ENCCNT7   0x19
 

Definition at line 134 of file ppmc.h.

#define ENCCTRL_0   0x03
 

Definition at line 123 of file ppmc.h.

#define ENCCTRL_1   0x13
 

Definition at line 138 of file ppmc.h.

#define ENCISR_0   0x0C
 

Definition at line 125 of file ppmc.h.

#define ENCISR_1   0x1C
 

Definition at line 139 of file ppmc.h.

#define ENCLOAD_0   0x00
 

Definition at line 126 of file ppmc.h.

#define ENCLOAD_1   0x10
 

Definition at line 137 of file ppmc.h.

#define ENCRATE_0   0x04
 

Definition at line 124 of file ppmc.h.

#define ENCRATE_1   0x14
 

Definition at line 135 of file ppmc.h.

#define MAX_PERIOD   -1L
 

Definition at line 200 of file ppmc.h.

#define NO_BOARD   1
 

Definition at line 166 of file ppmc.h.

#define NO_HOME_SWITCH
 

Definition at line 177 of file ppmc.h.

#define NO_LIMIT_SWITCH
 

Definition at line 187 of file ppmc.h.

#define PPMC_MAX_AXIS   4
 

#define _100_MILLISECONDS   100000L
 

Definition at line 198 of file ppmc.h.

#define _10_MILLISECONDS   10000
 

Definition at line 197 of file ppmc.h.

#define _1_MILLISECOND   1000
 

Definition at line 192 of file ppmc.h.

#define _1_SECOND   1000000L
 

Definition at line 199 of file ppmc.h.

#define _2_MILLISECONDS   2000
 

Definition at line 193 of file ppmc.h.

#define _3_MILLISECONDS   3000
 

Definition at line 194 of file ppmc.h.

#define _4_MILLISECONDS   4000
 

Definition at line 195 of file ppmc.h.

#define _500_MICROSECONDS   500
 

Definition at line 191 of file ppmc.h.

#define _5_MILLISECONDS   5000
 

Definition at line 196 of file ppmc.h.

#define __attribute__  
 

Definition at line 18 of file ppmc.h.

#define ppmc_base_addr   STG_BASE_ADDRESS
 


Function Documentation

short DACInit void   
 

Definition at line 57 of file ppmc_dac.c.

Referenced by DACQuit().

00058 {
00059         SelWrt(DAC_WRITE_0,0);    // reset strobe
00060         SelWrt(DAC_MODE_0,0);     // sel strobe to INTR/ line
00061         return 0;
00062 }

short DACQuit void   
 

Definition at line 64 of file ppmc_dac.c.

Referenced by ppmcMotQuit().

00065 {
00066            return DACInit();  //init sets all outputs to zero
00067 }

int DIOInit void   
 

Definition at line 17 of file ppmc_dio.c.

00018 {
00019         return 0;
00020 }

int DIOQuit void   
 

Definition at line 21 of file ppmc_dio.c.

Referenced by ppmcMotQuit().

00022 {
00023         return 0;
00024 }

int EncoderInit void   
 

Definition at line 64 of file ppmc_encoder.c.

Referenced by ServoToGoConstructor(), ppmcMotInit(), and stgMotInit().

00065 {
00066 #ifdef PPMC_8_AXES
00067   unsigned int wAdd;
00068 #endif
00069   short success=0;
00070         
00071 
00072   /* set all channels to normal mode (no find index, no load counters */
00073   SelWrt(ENCCTRL_0,0);
00074 #ifdef PPMC_8_AXES
00075   SelWrt(ENCCTRL_1,0);
00076   SelWrt(ENCRATE_1,0);  // in all cases, the 2nd encoder board is slaved to first
00077 #endif
00078   //  SelWrt(ENCRATE_0,0x10);  // make encoder board 0 master
00079   SelWrt(ENCRATE_0,0x00);  // don't make encoder board 0 master for software latch
00080  // zero the encoder counters  ( not needed )
00081   SelWrt(ENCLOAD_0,0);             /* clear 3-byte preload register */
00082   WriteData(0);
00083   WriteData(0);
00084   SelWrt(ENCCTRL_0,0xF0);  /* select load pos counter # and enable */
00085   SelWrt(ENCCTRL_0,0xF0);  /* select load pos counter # and enable */
00086   SelWrt(ENCCTRL_0,0xF0);  /* delay to give time for load to take place */
00087   SelWrt(ENCCTRL_0,0xF0);  /* more delay */
00088   SelWrt(ENCCTRL_0,0);         /* turn off load position counter function */
00089       
00090 #ifdef PPMC_8_AXES
00091   SelWrt(ENCLOAD_1,0);             /* clear 3-byte preload register */
00092   WriteData(0);
00093   WriteData(0);
00094   for (wAdd = 0; wAdd <= 3; wAdd ++)
00095     {
00096       SelWrt(ENCCTRL_1,(unsigned char)((wAdd>>3)+32));  /* select load pos counter # and enable */
00097     }
00098   SelWrt(ENCCTRL_1,0);         /* turn off load position counter function */
00099 #endif
00100         return success;
00101 }

int EncoderLatch void   
 

Definition at line 148 of file ppmc_encoder.c.

Referenced by ppmcEncoderReadAll(), and stgEncoderReadAll().

00149 {
00150         SelWrt(ENCRATE_0, 0x20);           /* pulse software generated strobe pulse */
00151         SelWrt(ENCRATE_0, 0x00);  // no need to do anything to 2nd encoder,
00152         // it is automatically slaved to first
00153      
00154   return 0;
00155 }

int EncoderQuit void   
 

Definition at line 102 of file ppmc_encoder.c.

Referenced by ppmcMotQuit().

00103 {
00104         return 0;
00105 }

unsigned short ReadData void   
 

Definition at line 234 of file ppmc_internal.c.

Referenced by EncReadAll().

00235   {
00236     //    outb(inb(CONTROLPORT) | 0x20,CONTROLPORT);  // set port direction to input
00237     outb(0x24,CONTROLPORT);  // set port direction to input
00238     return inb(DATAPORT);
00239     
00240   }

void SelAddr unsigned int    port
 

Definition at line 207 of file ppmc_internal.c.

00208 {
00209   /* writes a device address to the data port and toggles address strobe low, and waits
00210                 for handshake */
00211     ClrTimeout();
00212     //    outb(inb(CONTROLPORT) & 0xDF,CONTROLPORT);  // set port direction to output
00213     outb(0x04,CONTROLPORT);  // set port direction to output
00214  
00215    outb(port,ADDRPORT);
00216     return;
00217 }

unsigned short SelRead unsigned int    port
 

Definition at line 242 of file ppmc_internal.c.

00243 {
00244   /* writes a device address to the data port and toggles address strobe low, and waits
00245                 for handshake, then inputs data byte and toggles data strobe low, then
00246                 high again */
00247     ClrTimeout();
00248     outb(inb(CONTROLPORT) & 0xDF,CONTROLPORT);  // set port direction to output
00249     outb(port,ADDRPORT);
00250     outb(inb(CONTROLPORT) | 0x20,CONTROLPORT);  // set port direction to input
00251     return inb(DATAPORT);
00252     
00253 }

void SelWrt unsigned int    port,
unsigned char    byte
 

Definition at line 255 of file ppmc_internal.c.

00256 {
00257   /* writes a device address to the data port and toggles address strobe low, and waits
00258                 for handshake, then outputs data byte and toggles data strobe low, then
00259                 high again */
00260     ClrTimeout();
00261     //    outb(inb(CONTROLPORT) & 0xDF,CONTROLPORT);  // set port direction to output
00262     outb(0x04,CONTROLPORT);  // set port direction to output
00263     outb(port,ADDRPORT);
00264     outb(byte,DATAPORT);
00265     return;
00266 }

void SelWrt16 unsigned int    port,
unsigned short    word
 

Definition at line 267 of file ppmc_internal.c.

00268 {
00269   /* writes a device address to the data port and toggles address strobe low, and waits
00270                 for handshake, then (outputs data byte and toggles data strobe low, then
00271                 high again) repeat for 2nd byte */
00272     ClrTimeout();
00273     outb(inb(CONTROLPORT) & 0xDF,CONTROLPORT);  // set port direction to output
00274     outb(port,ADDRPORT);
00275     outb(word & 0x00FF,DATAPORT);
00276     outb(word >> 8,DATAPORT);
00277     return;
00278 }

void WriteData unsigned char    byte
 

Definition at line 219 of file ppmc_internal.c.

00220 {
00221   /* writes data to the data port and toggles data strobe low, and waits
00222                 for handshake */
00223     outb(byte,DATAPORT);
00224         ClrTimeout();
00225     return;
00226 }

void WriteData16 unsigned short    word
 

Definition at line 227 of file ppmc_internal.c.

00228 {
00229   
00230     outb(word & 0x00FF,DATAPORT);
00231     outb(word >> 8,DATAPORT);
00232     return;
00233 }

char __attribute__ (unused)    [static]
 

Definition at line 23 of file ppmc.h.

00023                                                    : ppmc.h,v 1.1 2001/08/23 20:54:33 paul_c Exp $";
00024 
00025 /* 
00026  Number of axes in system defaults to 4. If PPMC_8_AXES is defined
00027  by compiler directive or other means, code will support 8 axes,
00028  e.g., -DPPMC_8_AXES.
00029 
00030  Analog input is an option, normally not present. If STG_ANALOG_INPUT is
00031  defined by compiler directive or other means, code will support analog
00032  input, e.g., -DSTG_ANALOG_INPUT
00033  */
00034 #ifdef PPMC_8_AXES
00035 #define PPMC_MAX_AXIS 8
00036 #else
00037 #define PPMC_MAX_AXIS 4
00038 #endif
00039 /*
00040   Base address defaults to 0x378 i.e. lpt1
00041   */
00042 #define DEFAULT_PPMC_BASE_ADDRESS 0x378
00043 extern unsigned short STG_BASE_ADDRESS;
00044 #define ppmc_base_addr STG_BASE_ADDRESS
00045 
00046 /* decls for external interface */
00047 
00048 extern int ppmcMotInit(const char * stuff);
00049 extern int ppmcMotQuit(void);
00050 
00051 extern int ppmcDacNum(void);
00052 extern int ppmcDacWrite(int dac, double volts);
00053 extern int ppmcDacWriteAll(int max, double * volts);
00054 
00055 extern int ppmcEncoderSetIndexModel(unsigned int model);
00056 extern int ppmcEncoderNum(void);
00057 extern int ppmcEncoderRead(int encoder, double * counts);
00058 extern int ppmcEncoderReadAll(int max, double * counts);
00059 extern int ppmcEncoderResetIndex(int encoder);
00060 extern int ppmcEncoderReadLatch(int encoder, int * flag);
00061 extern int ppmcEncoderReadLevel(int encoder, int * flag);
00062 
00063 extern int ppmcMaxLimitSwitchRead(int axis, int * flag);
00064 extern int ppmcMinLimitSwitchRead(int axis, int * flag);
00065 
00066 extern int ppmcHomeSwitchRead(int axis, int * flag);
00067 
00068 extern int ppmcAmpEnable(int axis, int enable);
00069 extern int ppmcAmpFault(int axis, int * fault);
00070 
00071 extern int ppmcDioInit(const char * stuff);
00072 extern int ppmcDioQuit(void);
00073 
00074 extern int ppmcDioMaxInputs(void);
00075 extern int ppmcDioMaxOutputs(void);
00076 extern int ppmcDioRead(int index, int *value);
00077 extern int ppmcDioWrite(int index, int value);
00078 extern int ppmcDioCheck(int index, int *value);
00079 extern int ppmcDioByteRead(int index, unsigned char *byte);
00080 extern int ppmcDioShortRead(int index, unsigned short *sh);
00081 extern int ppmcDioWordRead(int index, unsigned int *word);
00082 extern int ppmcDioByteWrite(int index, unsigned char byte);
00083 extern int ppmcDioShortWrite(int index, unsigned short sh);
00084 extern int ppmcDioWordWrite(int index, unsigned int word);
00085 extern int ppmcDioByteCheck(int index, unsigned char *byte);
00086 extern int ppmcDioShortCheck(int index, unsigned short *sh);
00087 extern int ppmcDioWordCheck(int index, unsigned int *word);
00088 
00089 extern int ppmcAioInit(const char * stuff);
00090 extern int ppmcAioQuit(void);
00091 
00092 extern int ppmcAioMaxInputs(void);
00093 extern int ppmcAioMaxOutputs(void);
00094 extern int ppmcAioRead(int index, double *volts);
00095 extern int ppmcAioWrite(int index, double volts);
00096 extern int ppmcAioCheck(int index, double *volts);
00097 
00098 typedef union
00099 {
00100   unsigned short                          Word;
00101   struct   {unsigned char    high, low;}  Byte;
00102 } WORDBYTE;

int ppmcAioMaxInputs void   
 

Definition at line 26 of file ppmc_aio.c.

Referenced by extAioMaxInputs().

00027 {
00028   return 0;
00029 }

int ppmcAioMaxOutputs void   
 

Definition at line 31 of file ppmc_aio.c.

Referenced by extAioMaxOutputs().

00032 {
00033   return 0;
00034 }

int ppmcAioQuit void   
 

Definition at line 21 of file ppmc_aio.c.

Referenced by extAioQuit().

00022 {
00023   return 0;
00024 }


Variable Documentation

WORDBYTE
 

Definition at line 102 of file ppmc.h.


Generated on Sun Dec 2 15:28:11 2001 for EMC by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001