Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RS232 issue

Status
Not open for further replies.

TestBacha

Technical User
May 21, 2005
16
GB

Hi again.

The scripts that I'm trying to do, they're working so fine.
My issue at this moment is that I'm using both serial ports to read / write to 2 shelfs (I got a LPA900 PCB that controls all the others PCBs inserted on each shelf)

I read/write in COM1 & COM2 at the same time, the problem is that I think that it would be possible that the Superior shelf could take the inferior shelf's answer and viceversa.

Do you know how to identify (A kind of Set Up)if the answer is from COM1 or COM2?

I mean, some time ago I see a Script in Visual Basic that sets the Ports COM1,... COM4 and was working without problems.

Thanks in advance
EM

Edu Melendez
 
There is a way to set the com port in ASPECT, is that what you are looking for? If so, the command is set modem connection "connection_name", where connection_name is replaced by the name of the modem or connection exactly as it appears in Procomm.


 


Well, let me check it.
that I want to do is to be able to recognize or separate the answer from one port form the other, like I told you I'm sending commands on both ports, then I wait for an answer from them and the problem is that for example I send a command to the port COM1, but the first answer to be read at the prompt is from the port COM2, so is going to FAIL/PASS the units in the shelf 1, instead of the shelf 2.

I haven't seen it yet, but since the can run at the sametime. I'm sure that is going to happen.

Edu Melendez
 
Edu,

Are you using 2 procomm sessions to handle the individual com ports? Any scripts I use where multiple ports are used have multiple sessions and either data is written to the main script using DDE command or I create a file and get the master script to check for the existence of the file.

Stuart
 
Yup, thanks for help.

I did notice where my error was.
I was writing (on 4 sessions) the same file at the same folder, so I send them to different folders and no problema.

But, now, I can't keep the Script Path, I mean everytime that I close the session, all the windows have the same path that the first opened and I need to change it.

Do you know if is possible to save this settings for each session? (Path script)

Edu Melendez
 
There's not a way to assign a specific script path to a session of Procomm, and if you did set it in one session I wouldn't be surprised if later sessions used that value instead of the "real" script path. Is there any reason you have to modify the script path for each script/session?

 

Hi Knob

Well, I'm not sure....
I mean I was working with 1 shelf.
Then I decide (My boss in fact)to add a second shelf and I just copied the same scripts for it.
But both testers save the Results files in the same folder,
So the script was failing good units or passing the bad ones.

So I changed the folder to store the results into RSLTS1 & RSLTS2. with the respective script path :\\lucent\Active & \\Lucent\Active2 and these paths are that I need to set into the path script on each session.
(Option> Data Option> Paths>

Is not possibe to do it?

(BTW Sorry for my poor english, I'm still studying)



Edu Melendez
 
How are you saving the results? Are you writing a capture file to disk, saving the screen to a text file, etc.? You shouldn't have to change the script path to get each script to write to a different folder, unless the command you are using references just a filename, in which case it may end up in the ASPECT directory.


 

the script captures some lines (rget RSP raw). I just need 4 lines for each pack (max: 5 packs tested) and they're stored in a file text. then I evaluate the file and that's it.

But I use the same script on both shelf

Shelf 1 on COM1, Shelf 2 on COM4.
I use a main script called programsel, on it I scan the barcode (CLEI code) and the programsel chains the adecuate script (i.e. LPA833) So I have the same script in 2 folders Active & Active2, the one on Active saves its files on TestRslt and Active2 on TestRslt2.

I couldn't make them work in a single folder and w the same destination (for results)

How can I Simplify all this mess?

Edu Melendez
 
Are you using the fputs command to save the data to a text file? If so, you'll need to either change each script so they write to a different file, or modify the fopen command so that each script writes to a different folder.

Can you post your script?


 


Ok.
(Sorry, you'll need to copy the file on your Editor to see it properly)
Some messages at Spanish (Pass/Fail conditions, Etc)

Basically, I performed 2 test Circuit & Pack Diagnostic, I save both results into a file text, then I open that file, and save each line into an array, and (see the evalrslt proc) then evaluate the result for each slot (in this case 4 Units at Slots AP-5, AP-7, AP-10 and AP-15)

blah blah
some variables
(then the folder in that I save response)
string RSLTS2= "D:\LPA-PROG\TestRslt\PkRslts.txt"
string RSLTS1= "D:\LPA-PROG\TestRslt\CktRslts.txt"

And the proc for get data...
string szData1,RESP1,RESP2,RESP3,RESP4

proc GetData1
set aspect rgetchar 10 ; set break character to <CR>
sendkey ALT 'U'

waitfor "Received" 25
if SUCCESS
rget szData1 RAW ;steal characters from com port
strfmt RESP1 "%s" szData1
rget szData1
strfmt RESP2 "%s" szData1
rget szData1
strfmt RESP3 "%s" szData1
rget szData1
strfmt RESP4 "%s" szData1

endif
if FAILURE
strfmt RESP1 "rget failed to get characters from COM port"
strfmt RESP2 "rget failed to get characters from COM port"
strfmt RESP3 "rget failed to get characters from COM port"
strfmt RESP4 "rget failed to get characters from COM port"

endif

if fopen 0 RSLTS1 APPEND ; Create and open file.
fstrfmt 0 "%s" RESP1
fstrfmt 0 "%s" RESP2
fstrfmt 0 "%s" RESP3
fstrfmt 0 "%s" RESP4

fclose 0 ; Close the file.
else
errormsg "Can't open `"%s`" for output." RSLTS1
endif

endproc

And the proc to evaluate that data

proc EvalRslt1


string LineInfo1[20]; Array for lines
string Mac1=""
string Line1="BB_DGN_CKT message Ap"
string Line2="num_rec 0x00"
integer Number1
integer i

i=0
if isfile RSLTS1 ; Make sure file exists.
if fopen 0 RSLTS1 READ ; Open file for read.
while not feof 0 ; Loop to end of file.
fgets 0 LineInfo1 ; Get line from file & store it on array.
i=i+1
endwhile
fclose 0 ; Close the file.

endif
else
errormsg "File doesn't exist."
endif

for i=0 upto 15 ; Count for Filename
if strfind LineInfo1 Line1 ; Check for target text in string.
substr Mac1 LineInfo1 25 2 ; Get Slot number for results
atoi Mac1 Number1

switch Number1 ; Find value of numeric variable
case 5
if strfind LineInfo1[i+1] Line2 ; Check for target text in string.
STAT5A = 0
else
STAT5A = 1
endif

endcase
case 7
if strfind LineInfo1[i+1] Line2 ; Check for target text in string.
STAT7A = 0
else
STAT7A = 1
endif
endcase
case 10
if strfind LineInfo1[i+1] Line2 ; Check for target text in string.
STAT10A = 0
else
STAT10A = 1
endif
endcase
case 15
if strfind LineInfo1[i+1] Line2 ; Check for target text in string.
STAT15A = 0
else
STAT15A = 1
endif
endcase
endswitch
endif
endfor

if IntVar1==1
if STAT5A==1
;usermsg "Unidad en Slot AP5 con numero de serie %s FALLO Circuit Diags`r`n\
;Retire la Unidad e idenfiquela como Falla de Circuit Diagnostic" SerNo1
strfmt F "Unidad en Slot AP5 con numero de serie %s FALLO Circuit Diags" SerNo1
MakeDlgBox4Fail()
S0="FAIL"
strfmt S2 SerNo1
I1=1
I2=01
S3="Circuit Diagnostic"
endif
Datalog()
endif

if IntVar2==1
if STAT7A==1
;usermsg "Unidad en Slot AP7 con numero de serie %s FALLO Circuit Diags`r`n\
;Retire la Unidad e idenfiquela como Falla de Circuit Diagnostic" SerNo2
strfmt F "Unidad en Slot AP7 con numero de serie %s FALLO Circuit Diags" SerNo2
MakeDlgBox4Fail()
S0="FAIL"
strfmt S2 SerNo2
I1=1
I2=01
S3="Circuit Diagnostic"
endif
Datalog()
endif

if IntVar3==1
if STAT10A==1
;usermsg "Unidad en Slot AP10 con numero de serie %s FALLO Circuit Diags`r`n\
;Retire la Unidad e idenfiquela como Falla de Circuit Diagnostic" SerNo3
strfmt F "Unidad en Slot AP10 con numero de serie %s FALLO Circuit Diags" SerNo3
MakeDlgBox4Fail()
S0="FAIL"
strfmt S2 SerNo3
I1=1
I2=01
S3="Circuit Diagnostic"
endif
Datalog()
endif

if IntVar4==1
if STAT15A==1
;usermsg "Unidad en Slot AP15 con numero de serie %s FALLO Circuit Diags`r`n\
;Retire la Unidad e idenfiquela como Falla de Circuit Diagnostic" SerNo4
strfmt F "Unidad en Slot AP15 con numero de serie %s FALLO Circuit Diags" SerNo4
MakeDlgBox4Fail()
S0="FAIL"
strfmt S2 SerNo4
I1=1
I2=01
S3="Circuit Diagnostic"
endif
Datalog()
endif

endproc ;--------------------------------------------------------------------------------


Edu Melendez
 
OK, you have two possibilities that I can see. The first is to have a script for each possible testing situation that defines RSLTS1 to be either a different file name or in a different folder. The other option is to have the script ask you for a filename and/or file folder when it starts and use that information to save the file to. You could use the sdlgsaveas command to get the filename entered.


 

Ok, let me try both options and I'll let you know results.
But in advance, let me tell you that it is suposse to be a script that should prevent workmanship errors. (?)

I mean, we must to let nothing to decide to the operator (Since they don't have knowledge about the test / product).

The point is that I did it in that way cause like you say 1 option is to have different scripts, the problem is to put in their Work instruction, in one of the windows (session) choose Programsel1 and in the other one programsel2. they could choose the same program on both session and the results will be the same.


Edu Melendez
 
One other option, really an alternative of the second option I gave, is to use something like the flistbox command at the beginning of the script to read in a text file that contains the different possible tests that can be run. The user can then select the test they want to run and the script uses a switch/case statement to determine what filename and/or folder should be used to save the results to (I'm assuming the tests are the same no matter what equipment is chosen?).


 

Yes, and in fact the tests are not optional. both test should be performed for each pack. the real problem is that I was trying to run the program from the same place at the same PC. and imagine both tester waiting for the same results, save them in the same folder.

And like I told you I can not let the operator decide the script to run. that's why I duplicate the programs and for those on Active folder the results path is \\lucent\LPA-PROG\TestRslt\RSLTS1 and RSLST2 and for Active2 \\lucent\LPA-PROG\TestRslt2\RSLTS1 and RSLST2

And this is something that a Dummy programmer (Like me)would do rite?

Edu Melendez
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top