Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 17:58 03 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : OPEN syntax

Author Message
f2cf1g
Newbie

Joined: 18/11/2016
Location: United Kingdom
Posts: 13
Posted: 12:56pm 08 Dec 2016
Copy link to clipboard 
Print this post

Hi, newbie here with a problem. I want to open COM1 to accept an inverted signal so I've tried the following code:

Dim STRING s
Open "COM1:2400,,,,INV" As #1
Do
s = Input$(1,#1)
If s<>"" Then Print s;
Loop

I get an invalid syntax error on the OPEN statement which I can cure by filling in the missing parameters. The number fields are OK, I can just use the default values, but I also have to provide an interrupt routine address although I have no need for interrupts. I can't see how to proceed, no doubt it's something obvious, advice would be much appreciated.
Roy
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 844
Posted: 01:41pm 08 Dec 2016
Copy link to clipboard 
Print this post

Hi Roy,

I think INV is one off 5 special parameters that can be added without filling in missing parameters.

so I think the following is OK
OPEN "COM1:2400,INV" As #1

Regards
Gerry

From the 5.2 manual APPENDIX A

All parameters except the serial port name (COMn:) are optional. If any one parameter is left out then all the
following parameters must also be left out and the defaults will be used.
Five options can be added to the end of 'comspec$' These are DE, 9BIT, INV, OC and S2:
 ‘DE’ will enable the Data output Enable (EN) signal for RS485. See the section "IEEE 485" for details.
 '9BIT' will specify that 9 bit transmit and receive is to be used. See the section "IEEE 485" for details.
 'INV' specifies that the transmit and receive polarity is inverted (COM1: only).
 ‘OC’ will force the transmit pin (and DE on COM1:) to be open collector. This option can be used on
both COM1: and COM2:. The default is normal (0 to 3.3V) output.
 'S2' specifies that two stop bits will be sent following each character transmitted. (COM1: only)

Latest F4 Latest H7
 
f2cf1g
Newbie

Joined: 18/11/2016
Location: United Kingdom
Posts: 13
Posted: 02:56pm 08 Dec 2016
Copy link to clipboard 
Print this post

Thanks Gerry, you're right. Strange syntax. Roy
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024