Hardware manual

64
int writeport(int fd, char *chars);
int readport(int fd, char *result);
int getbaud(int fd);
int allocateMemory();
int deallocateMemory();
int openDevice();
int closeDevice();
int generatePhaseTables();
int detection(short pos_pha[], \
short *nr_of_pha,\
unsigned short hal_tab[]);
Now, fd is just a file descriptor of the device which is used to the serial communication. The
variable phaseTableLen keeps the value taken from t
visible on the picture 6.6-1, and it decides how long our phase tables should be. Next variables
ph1, ph2 and ph3 are just pointers to generated phase tables. The variable working is used to
check whether we are doing now some detection or not. The function initport
3
makes
initialization of the serial port according to the given parameters. The functions writeport
2
and
readport
2
are used to respectively send and get some message to/from the serial port. The
function getbaud
2
reads the baud rate used in the transmission. The function allocateMemory,
as it names states, allocates memory for phase tables. The deallocateMemory makes opposite to
previous function. It releases allocated memory for phase tables. The functions openDevice and
closeDevice respectively open and cl ose serial port for communication. The next one is:
generatePhaseTable and it only generates phase tables exactly in the same manner as
pxmc_init_ptable_sin3phup described in subsection: 5.3.12. The last function: detection(…) is
used to call command processor directive: detection, and then to work in proper manner with
results which it returns.
3
These functions come from http://www.captain.at/electronics/pic-mmc/. (c) 2004-5 Captain