Hi all,
Thanks Nigel for his help in my last question.
Here is my question again.
What I actually doing is to build an interface using 16F84, sending a status command to Machine A to ask for its status, then get its response via RS232, analyse it and send back a command to Machine A as well as a Machine B.
What I have done until now is, sending the status command to Machine A every 2 seconds. The problem I have now is I can't actually get the response from the Machine A.
Is is a problem about handshaking?
Here is my code:
clrf index ; clear index
loop2: movf index, w
call code5 ; code5 = "monstat 1"
movwf temp
call tx
movf temp, w
xorlw 0x00
btfsc STATUS, Z
goto tloop
incf index, f
goto loop2
tloop
call rx ; what Machine A actually output is when i type "monstat 1" in hyperterminal:
call rx ; *S monstat 1 tv 2
call rx ;
call rx ; OK
call rx ;
call rx ; And there are 2 status of the response
call rx ; The other one is the "tv" at the response replaced by "pc"
call rx ; And so i decided to capture the 13th & 14th byte to check
call rx
call rx
call rx
call rx
call rx ; receive 13 no use digits
call rx ; first digit (14th) to check
movwf input1 ; first digit
call rx
movwf input2 ; second digit (15th)
goto checkinput
I think I may be doing wrong at getting the character.
Is there anyone can help me on this?
Thanks so much!
Edmond
Thanks Nigel for his help in my last question.
Here is my question again.
What I actually doing is to build an interface using 16F84, sending a status command to Machine A to ask for its status, then get its response via RS232, analyse it and send back a command to Machine A as well as a Machine B.
What I have done until now is, sending the status command to Machine A every 2 seconds. The problem I have now is I can't actually get the response from the Machine A.
Is is a problem about handshaking?
Here is my code:
clrf index ; clear index
loop2: movf index, w
call code5 ; code5 = "monstat 1"
movwf temp
call tx
movf temp, w
xorlw 0x00
btfsc STATUS, Z
goto tloop
incf index, f
goto loop2
tloop
call rx ; what Machine A actually output is when i type "monstat 1" in hyperterminal:
call rx ; *S monstat 1 tv 2
call rx ;
call rx ; OK
call rx ;
call rx ; And there are 2 status of the response
call rx ; The other one is the "tv" at the response replaced by "pc"
call rx ; And so i decided to capture the 13th & 14th byte to check
call rx
call rx
call rx
call rx
call rx ; receive 13 no use digits
call rx ; first digit (14th) to check
movwf input1 ; first digit
call rx
movwf input2 ; second digit (15th)
goto checkinput
I think I may be doing wrong at getting the character.
Is there anyone can help me on this?
Thanks so much!
Edmond