Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Please help (again): RS232 command and output a feedback

Status
Not open for further replies.

edmondli

New Member
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
 
From what I can see, you have three devices - one with a 16F84, machine A, and machine B - is that correct?.

How do you have them connected?.

Normally handshaking isn't required, but do machine A and machine B require it?. I'm presuming these are some kind of commercial machine, seeing as you called them 'machines', if so the instruction manuals for them should tell you exactly what they require.
 
Nigel Goodwin said:
From what I can see, you have three devices - one with a 16F84, machine A, and machine B - is that correct?.

How do you have them connected?.

Normally handshaking isn't required, but do machine A and machine B require it?. I'm presuming these are some kind of commercial machine, seeing as you called them 'machines', if so the instruction manuals for them should tell you exactly what they require.

Hi Nigel,

For Machine A it is a video server, according to the manual it doesn't need any handshaking.
For Machine B it is a 30" Sharp LCD monitor, and it doesn't need handshaking as well.
The purpose of my gadget is to monitor when do I need to switch both the server and the LCD Monitor between VGA mode and Composite Video mode.
Actually I have done a program to switch both device between VGA and CV mode by using a push button and it works well.
(I am using 4MHz clock)
Any idea or suggestion?
Thanks!
Edmond
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top