Fixed general bugs.

r2139 | mle | 2007-08-23 15:08:52 +1000 (Thu, 23 Aug 2007) | 2 lines
This commit is contained in:
Mark Lesha
2007-08-23 15:08:52 +10:00
committed by Douglas Clowes
parent a85720686b
commit e76c3922f0
3 changed files with 107 additions and 60 deletions

View File

@@ -66,7 +66,7 @@
do
{
sprintf(pCommand,"BUSY?");
usleep(50000); // Required to meet Lakeshore340 spec.
usleep(100000); // Required to meet Lakeshore340 spec.
if ((iRet=transactRS232(self->controller,pCommand,strlen(pCommand),pReply,79))<=0)
{
printf("Comms error!\n");
@@ -102,7 +102,7 @@
else
sprintf(pCommand,"%s %s",command,configonlyparameters);
printf("Issuing command: '%s'...\n",pCommand);
usleep(50000); // Required to meet Lakeshore340 spec.
usleep(100000); // Required to meet Lakeshore340 spec.
if ((iRet=writeRS232(self->controller,pCommand,strlen(pCommand)))!=1)
return iRet;
/* Issue the query corresponding to the command, */
@@ -112,7 +112,7 @@
else
sprintf(pCommand,"%s?",command);
printf("Issuing query: '%s'...\n",pCommand);
usleep(50000); // Required to meet Lakeshore340 spec.
usleep(100000); // Required to meet Lakeshore340 spec.
if ((iRet=transactRS232(self->controller,pCommand,strlen(pCommand),pReply,79))<=0)
{
printf("transactRS232 error! Code=%d.\n",iRet);
@@ -180,7 +180,7 @@
/* Reset the controller to power-on state. */
sprintf(pCommand,"*RST");
usleep(50000); // Required to meet Lakeshore340 spec.
usleep(100000); // Required to meet Lakeshore340 spec.
if ((iRet=writeRS232(self->controller, pCommand,strlen(pCommand)))!=1)
return iRet;
@@ -188,7 +188,7 @@
/* just in case we want to use the internal status flags later on. */
/* Actually, we do *RST above, probably this isn't necessary. */
sprintf(pCommand,"*CLS");
usleep(50000); // Required to meet Lakeshore340 spec.
usleep(100000); // Required to meet Lakeshore340 spec.
if ((iRet=writeRS232(self->controller, pCommand,strlen(pCommand)))!=1)
return iRet;
@@ -199,7 +199,7 @@
/* Check the POST status, it should be 0 and not 1. */
sprintf(pCommand,"*TST?");
usleep(50000); // Required to meet Lakeshore340 spec.
usleep(100000); // Required to meet Lakeshore340 spec.
if ((iRet=transactRS232(self->controller,pCommand,strlen(pCommand),pReply,79))<=0)
return iRet;
if (strcmp(pReply,"0")!=0)
@@ -220,7 +220,7 @@
/* There's also the *REV command to check the firmware revision, but */
/* that would be going too far ;) */
sprintf(pCommand,"*IDN?",command);
usleep(50000); // Required to meet Lakeshore340 spec.
usleep(100000); // Required to meet Lakeshore340 spec.
if ((iRet=transactRS232(self->controller,pCommand,strlen(pCommand),pReply,79))<=0)
return iRet;
if (strncmp(pReply,"LSCI,MODEL340",13)!=0)
@@ -239,7 +239,7 @@
/* Clear any alarms. */
sprintf(pCommand,"ALMRST");
usleep(50000); // Required to meet Lakeshore340 spec.
usleep(100000); // Required to meet Lakeshore340 spec.
if ((iRet=writeRS232(self->controller, pCommand,strlen(pCommand)))!=1)
return iRet;
@@ -359,13 +359,13 @@
&&(pCommand[i+1]==' '||pCommand[i+1]=='\0')); // any '? ' pattern or trailing '?' will do.
if (!isquery) // LAKESHORE340 does not send any response.
{
usleep(50000); // Required to meet Lakeshore340 spec.
usleep(100000); // Required to meet Lakeshore340 spec.
iRet=writeRS232(self->controller,pCommand,commandlen);
*pReply='\0';
}
else // LAKESHORE340 will send a response.
{
usleep(50000); // Required to meet Lakeshore340 spec.
usleep(100000); // Required to meet Lakeshore340 spec.
iRet=transactRS232(self->controller,pCommand,commandlen,pReply,iLen);
}
@@ -407,7 +407,7 @@
return LAKESHORE340__BADPAR; // But shouldn't happen
}
usleep(50000); // Required to meet Lakeshore340 spec.
usleep(100000); // Required to meet Lakeshore340 spec.
if ((iRet=transactRS232(self->controller,pCommand,strlen(pCommand),pReply,79))<=0)
return iRet;
@@ -448,11 +448,11 @@
for(i = 0; i < 3; i++)
{
/* send SETP command, we don't get any response so use writeRS232 */
usleep(50000); // Required to meet Lakeshore340 spec.
usleep(100000); // Required to meet Lakeshore340 spec.
if ((iRet=writeRS232(self->controller,pCommand,strlen(pCommand)))!=1)
return iRet;
/* read the set value again using the SETP? command */
usleep(50000); // Required to meet Lakeshore340 spec.
usleep(100000); // Required to meet Lakeshore340 spec.
if ((iRet=transactRS232(self->controller,pCommandRead,strlen(pCommandRead),pReply,131))<=0)
return iRet;
printf("SETP: Response %d characters: '%s'\n",iRet,pReply);