General > Technical support

Monitoring of Com 1 and Com 3 for Ascii

(1/2) > >>

can:
Hi. I'm trying to use FMD88 as an Ascii interchange where Ascii command will be coming in from Com 1 and send out to Com 3 or vice versa. Any idea can it be done?

garysdickinson:
The short answer is yes. It is possible to use the FMD PLC to handle serial communications on both serial ports.

The TBASIC has a full set of statements and functions to support user written communication protocol over the serial ports.

To provide a better answer, you would need to provide a bit more detail about the communication protocol that you intend to use.

Gary Dickinson

can:
Hi. I was playing around with FMD88 and run into a problem. I wanted to use FMD88 to emulate a computer sending out a command "PASS/n" but failed. /n is CR right? So I left it out since CR is automatically sent at the end of the sentence. Correct me if I'm wrong.

Print#1 "PASS"
Outcomm 1, 26

The receiving computer software always prompt that end of line is not received. Any idea why?

garysdickinson:
can,

In regards to the meaning of the C programming construct of "\n" or newline, this is an operating system dependent behavior.  In UNIX \n translated to a linefeed.  In other operating systems it translated to a carriage return.  In CPM it was 2 characters a carriage return and a linefeed. So I have no clue what your device expects as a line termination sequence.

I think your example would output "PASS<CR><SUB>".  The 26 value used by the outcomm statement got you the  < SUB > character.  I haven’t seen a communication protocol use this character.

The Print #n statement prints 0 or more arguments separated by a semicolons, ";". if there is an ";" at the end of the statement, then print #n will not append an end of line character to the output characters.

If there is no  ";" at the end of the statement, then the print #n statement will append an ASCII carriage return, CR or 0x0d, to the output.

Samples:

print #1 "hello";                      ---> sends "hello" only
print #1 "hello"                       ---> sends "hello" and an ASCII CR
Print #1                                 ---> sends ASCII CR only
Print #1 "hello";"\0a";            ---> sends "hello" and an ASCII LF (linefeed) with a hex value of 0x0a
print #1 "hello";"\0d\0a";       ---> sends "hello and an ASCII CR followed by an ASCII LF

So you  are not to limited in controlling the end of line character(s).

If you have to send an ASCII NUL or 0x00 then you need to use OUTCOMM.

Gary D

can:
Hi Gary. Thanks for the advice. Had it sorted out. However, I have a question. What can I do if I want to receive, modify portion of the string, and  send out a super long string that consists 400 character from Port 1 to Port 3? Can it be done?

Navigation

[0] Message Index

[#] Next page

Go to full version