Parallel Port C Reference Code
A-10
int
timebasecount,overheadcount;
int
ParData,ParStatus,ParControl;
int
wait30us;
int
timeout;
int
numbytes;
int
thisbyte,sample;
byte
speechdata[MAXBINSIZE];
byte
txcount[MAXBINSIZE];
byte
temp_hi, temp_lo;
// Declarations
int
speak(void);
void
sendbyte(byte cmd);
int
recvbyte(void);
int
calibrate(int *tb, int *ovrhd);
void
MySleep(unsigned int sleep_time); // one of Frank’s
void
DeviceReset(void);
void
setECP(void);
int main(int argc, char *argv[])
{
FILE
*inbin;
char
binfname[256];
int
stat;
printf(”PC–604 Code Version %s\n”,VERSION);
_outp(ParControl,RWHCEH); // start off with RW and CE both high
calibrate(&timebasecount,&overheadcount);
// calibrate the timecount
wait30us = 3 * timebasecount – overheadcount;
timeout = 500000;
// Check the number of arguments given
if (argc < 2)
{
printf(”Usage : 604pc [...] <binspeechfile>\n”);
exit(0);
}
strcpy(binfname,argv[argc–1]);
// Open the file
if ((inbin = fopen(binfname,”rb”)) == NULL)
{
printf(”Error opening binary file <%s>\n”,binfname);
exit(0);
}
// Read the number of bytes from the file
numbytes = fread(&speechdata[0],sizeof(byte),MAXBINSIZE,inbin);
fclose(inbin);
printf(”Read %d bytes\n”,numbytes);
// Define parallel port registers
printf(”What is your Parallel port address (in HEX)?\n”);
scanf(”%x”,&ParData);
ParStatus=1;
// Parallel port status register
ParControl=2;
// Parallel port Control register
// Set the parallel port for ECP mode for bidirectional mode
Summary of Contents for MSP53C691
Page 1: ...MSP53C691 Speech Synthesizer December 2000 MSDS Speech User s Guide SPSU020 ...
Page 22: ...2 10 ...
Page 96: ...C 6 ...