Internet PLC Forum

General => Technical support => Topic started by: Tito on August 09, 2012, 06:57:19 AM

Title: How to open serial port in basic coding
Post by: Tito on August 09, 2012, 06:57:19 AM
Hi I am trying to open serial port by using basic coding. I am quite new for basic coding. Please do assist me. Hardware FMD88-10
Title: Re:How to open serial port in basic coding
Post by: support on August 09, 2012, 08:08:52 AM
In TBASIC there is no need to open the serial port since it is dedicated and it is always open.

So you simply use the PRINT #n or outcomm n, x to send ASCII or binary data out of the serial port n and use INPUT$(n) or INCOMM(n) to read ASCII string or binary data from serial port #n.
 
Title: Re:How to open serial port in basic coding
Post by: Tito on August 10, 2012, 02:55:09 AM
Hi, In my serial, i am connecting GSM modem. My GSM modem setting is the Baud rate is 115200, Databits 8, Parity None, Stop Bits 1.

How I can set this to my port before send Commands
Title: Re:How to open serial port in basic coding
Post by: support on August 10, 2012, 10:23:28 AM
Check the SETBAUD command.

To change baud rate to 115,200, 8, n, 1

SETBAUD 1,9

Title: Re:How to open serial port in basic coding
Post by: Tito on August 10, 2012, 10:50:22 AM
Hi, After go through in User Manual, I did set as :-
SETBAUD 1,&H9,
is that make different with SETBAUD 1,9
Please do advice.
Do i have to do anything with Dip switches? I am using FMD88-10 board.
Title: Re:How to open serial port in basic coding
Post by: support on August 10, 2012, 11:11:47 AM
&H9 is the hexadecimal representation which is the same as decimal 9.

You don't have to do anything else. You need to run the SETBAUD 1,9 once only in order to change the serial port #1 to the desired baud rate. After that you can use PRINT # command and Input$() command at the new baud rate until power is reset to the PLC.
Title: Re:How to open serial port in basic coding
Post by: Tito on August 10, 2012, 11:25:04 AM
 :) Thank you.