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.
rogersan Regular Member Joined: 10/04/2015 Location: AustraliaPosts: 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: GermanyPosts: 1629
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$;
Michaelcausality ≠ correlation ≠ coincidence
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9643
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-26Smoke makes things work. When the smoke gets out, it stops!
rogersan Regular Member Joined: 10/04/2015 Location: AustraliaPosts: 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: AustraliaPosts: 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 KingdomPosts: 10406
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