EasyManua.ls Logo

Labsphere SC-5500 - RS-232 C Programming in Quickbasic

Labsphere SC-5500
44 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SX-01635-000, Rev. 5 39
char tempstr[10],junk[10];
memset(tempstr,'\0',10);
memset(junk,'\0',10);
strcpy(tempstr,"C");
strcat(tempstr,itoa(cal,junk,10));
strcat(tempstr,"X");
WriteComm(sc_idComDev,tempstr,strlen(tempstr));
}
void SerialSelectDetector_1()
{
WriteComm(sc_idComDev,"P1J1K2K3K4K5K6K7K8X",strlen("P1J1K2K3K4K5K6K7K8X"));
}
void SerialSelectDetector_2()
{
WriteComm(sc_idComDev,"P1J1K2J3K4K5K6K7K8X",strlen("P1J1K2J3K4K5K6K7K8X"));
}
/*******************************************************************************/
float get_reading_serial(void)
{
char data_read[25];
float sc_reading;
memset(data_read,'\0',24);
WriteComm(sc_idComDev,"O0X",3); //Ask the SC-5500 for a reading
wait_n_mseconds(1000);
//read the data back one character at a time until all characters have been read
int BytesRead = 0;
DWORD current_time;
DWORD start_time = GetTickCount();
start_time += 10000;
while(BytesRead<12)
{
BytesRead+=ReadComm(sc_idComDev,&data_read[BytesRead],12);
current_time = GetTickCount();
if (start_time < current_time)
{
sc_reading = 0;
return -1;
}
}
char *end_point;
sc_reading = strtod(data_read, &end_point);
return sc_reading;
}
RS-232C Programming in QuickBasic
‘initialization:
OPEN "com1:9600,N,8,1,ASC" FOR RANDOM AS #1 ‘Open comm port 1 at 9600 baud, no parity, 8 data bits, 1 stop
‘bit, ASC formatted data and in RANDOM mode for
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com