Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 00:32 24 Sep 2026 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 : Print to COM1 without cr and lf

Author Message
rogersan
Regular Member

Joined: 10/04/2015
Location: Australia
Posts: 79
Posted: 12:06am 25 Nov 2015
Copy link to clipboard 
Print this post

I am trying to send 3 characters from COM1 without carriage return and line feed.

I tried putting a semicolon at the end of the print string, to suppress the CR and LF, but it is not working. Instead of 3 characters being sent out on COM1, I get 6. The extra characters are ; and CR and LF.

Tstr$=chr$(85)+chr$(2)+chr$(160)+";"
Open "com1:9600" as #5
Print #5,Tstr$

Does anyone know how to make this work?
 
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1773
Posted: 12:10am 25 Nov 2015
Copy link to clipboard 
Print this post

I would try this
Tstr$=chr$(85)+chr$(2)+chr$(160)
Open "com1:9600" as #5
Print #5,Tstr$;

Michael
‚My name is Ozymandias, king of kings
Look on my works, ye Mighty, and despair!‘
Nothing beside remains. Round the decay
Of that colossal wreck, boundless and bare
The lone and ...
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 10044
Posted: 12:12am 25 Nov 2015
Copy link to clipboard 
Print this post

Agreed. Semicolon suppresses the CR and LF on any print command.

EDIT: As you have probably gathered by now, the semicolon has to be part of the command syntax, not a byte of the actual message as in your example. Edited by Grogster 2015-11-26
Smoke makes things work. When the smoke gets out, it stops!
 
rogersan
Regular Member

Joined: 10/04/2015
Location: Australia
Posts: 79
Posted: 08:44am 25 Nov 2015
Copy link to clipboard 
Print this post

Thanks very much, now only 3 characters are going out to the Texas Instrumements TMP107 temperature sensor, and I can see a two character reply.

However the INPUT statement is not getting the data. I tried

Indat$=INPUT(10,#5)
LCD 1,1,Indat$

And just get a blank line on the LCD display. LOC says there are five characters in the buffer. I should see "U" as the first character in the receive buffer, as the characters sent are all received ie. Chr$(85) is "U".

I did have to put a delay before the INPUT, otherwise LOC said there were 0 characters in the receive buffer.

Perhaps the receive buffer is too slow to get the data, any suggestions.
 
rogersan
Regular Member

Joined: 10/04/2015
Location: Australia
Posts: 79
Posted: 09:03am 25 Nov 2015
Copy link to clipboard 
Print this post

Sorry that line should be

Indat$=INPUT$(10,#5)
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11902
Posted: 09:04am 25 Nov 2015
Copy link to clipboard 
Print this post

Put this:

DO WHILE LOC(#5)<5:LOOP

before the input statement
Edited by matherp 2015-11-26
 
Print this page


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

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026