LB Booster
« Serial com in LBB/LB4 - what is different? »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 05:08am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1 2 3  Notify Send Topic Print
 veryhotthread  Author  Topic: Serial com in LBB/LB4 - what is different?  (Read 2284 times)
flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx Re: Serial com in LBB/LB4 - what is different?
« Reply #2 on: Apr 25th, 2014, 10:26am »

on Apr 24th, 2014, 8:27pm, Richard Russell wrote:
....I think you've failed to take account of this comment in the Compatibility section of the LBB docs...

No, in fact I did use a semi-colon for some tests but I wrongly wrote my code like this (=semi-colon after the command text):
Code:
#PRINTER "G1 X100 Y100 Z100"; + CHR$(13 

I'll try this tonight ;-)

Meanwhile, you may have an idea how I can make the terminators caracters "visible" in an serial com software or is it simply "not possible"?

User IP Logged

Roger
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Serial com in LBB/LB4 - what is different?
« Reply #3 on: Apr 25th, 2014, 1:11pm »

on Apr 25th, 2014, 10:26am, flotulopex wrote:
Meanwhile, you may have an idea how I can make the terminators caracters "visible" in an serial com software

In LBB characters with codes less than 32 (i.e. 'control characters') will never be visible when printed to the mainwin, since those codes have special meanings. To make the characters 'visible' you would need to convert them into something different; that can easily be done but may be rather slow. The code listed below (LBB-specific) displays the control characters in red.

Richard.

Code:
string$ = "G1 X100 Y100 Z100" + CHR$(13) + CHR$(10)
print visible$(string$)
end

function visible$(s$)
for i = 1 to len(s$)
  c = asc(mid$(s$,i))
  if c < 32 then
    visible$ = visible$ + chr$(17)+chr$(1)+chr$(64+c)+chr$(17)+chr$(0)
  else
    visible$ = visible$ + chr$(c)
  end if
next
end function 
User IP Logged

flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx Re: Serial com in LBB/LB4 - what is different?
« Reply #4 on: Apr 25th, 2014, 4:27pm »

Well...still not working either ways.

I need to trap what serial data I'm sending to the printer via LBB or the com software.

Any idea how to do so?
User IP Logged

Roger
flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx Re: Serial com in LBB/LB4 - what is different?
« Reply #5 on: Apr 25th, 2014, 4:42pm »

Just found a serial com capturing tool http://www.eltima.com/products/rs232-data-logger/

I'll have a go and see what happens wink
User IP Logged

Roger
flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx Re: Serial com in LBB/LB4 - what is different?
« Reply #6 on: Apr 25th, 2014, 5:21pm »

How can I modify/set the serial data flow control type in LBB (Xon/Xoff - Hardware - None)?
User IP Logged

Roger
flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx Re: Serial com in LBB/LB4 - what is different?
« Reply #7 on: Apr 25th, 2014, 5:33pm »

The syntax for serial port parameters is slightly different. The basic options are the same, so for example this works:

open "COM1:9600,n,8,1" for random as #comm

but when specifying 'handshaking' parameters the syntax accepted by LBB is as follows:

open "COMn: [baud=b] [parity=p] [data=d] [stop=s]
[to=on|off] [xon=on|off] [odsr=on|off] [octs=on|off]
[dtr=on|off|hs] [rts=on|off|hs|tg] [idsr=on|off]"


I don't get it.

What would the correct syntax be in my case please?
User IP Logged

Roger
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Serial com in LBB/LB4 - what is different?
« Reply #8 on: Apr 25th, 2014, 9:55pm »

on Apr 25th, 2014, 4:27pm, flotulopex wrote:
How can I modify/set the serial data flow control type in LBB (Xon/Xoff - Hardware - None)?

Code:
OPEN "COM3: baud=115200 parity=n data=8 stop=1 xon=on odsr=off octs=off" FOR RANDOM AS #PRINTER 

However I'm not sure whether Xon/Xoff handshaking is always available in Windows; it may depend on your serial port driver. Personally I would prefer to implement it in my own code because that way you know it will always work.

Richard.
User IP Logged

flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx Re: Serial com in LBB/LB4 - what is different?
« Reply #9 on: Apr 26th, 2014, 12:49pm »

cry

Still won't work.

Since the beginning of this thread, when I send the data to the printer , I can see on its LCD some kind of "reset" since it will show up the "start screen" just as when I switch it on. That means, all changes I made to the data sent as in my first post don't modify anything.

If there is no difference in the data itself, no obvious flow control issue, what is still to be investigated?
User IP Logged

Roger
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Serial com in LBB/LB4 - what is different?
« Reply #10 on: Apr 26th, 2014, 5:04pm »

on Apr 26th, 2014, 12:49pm, flotulopex wrote:
If there is no difference in the data itself, no obvious flow control issue, what is still to be investigated?

You say the data is correct, but what about the baud rate, parity bit (if any) and number of stop bits? If any of those are wrong it is entirely likely that the receiving device will not respond correctly. An oscilloscope is an invaluable tool to investigate those issues.

There are not that many ways in which the serial signal could be wrong, so if you have appropriate monitoring facilities it should be relatively simple to debug the problem. You are far better placed to do that than I am!

Richard.
User IP Logged

flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx Re: Serial com in LBB/LB4 - what is different?
« Reply #11 on: Apr 28th, 2014, 10:01am »

...yup!

The oscillo is on my table already but I can't still point the problem.

I'll check some more....
User IP Logged

Roger
Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx Re: Serial com in LBB/LB4 - what is different?
« Reply #12 on: Apr 28th, 2014, 3:25pm »

If you say that you can issue the commands via HyperTerminal like software then it can be achieved with LBB.

Couple of guesses, COM3 does not sound right. If you are using a USB based serial module its likely to be a higher number.

Use the Control Panel to double check what Com number and parameters the HyperTerminal like software is using.

Are you sure it just terminates with a CR? Some of these modules use a check digit routine appending a character to the end of the message.

Is the printer home made? who makes the HyperTerminal like software and can you post a link to their support pages?
User IP Logged

flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx Re: Serial com in LBB/LB4 - what is different?
« Reply #13 on: Apr 30th, 2014, 05:50am »

Thanks Rod,

I checked these points already: COM ports, speed and other parameters all are fine.

The com tool lets me choose between different terminators; I just needed to test them one by one to find the correct one, the only one that works is "CR".

The printer is this one http://www.bqreaders.com/gb/products/witbox.html.

I use the "Serial Communicator" software utility coming with this editor http://www.mecanique.co.uk/shop/index.php?route=product/category&path=20_62.

Until now, I sniffed the com port with this tool http://www.eltima.com/products/serial-port-monitor/. But it doesn't shows up any kind of special control er checking character.

I need to look into the transmitted data packet with my oscillo and maybe find if there is a difference.

But I don't have any protocol analyzing tool so if there is a difference, I'll still need to find out what exactly it is.
User IP Logged

Roger
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Serial com in LBB/LB4 - what is different?
« Reply #14 on: Apr 30th, 2014, 08:33am »

on Apr 30th, 2014, 05:50am, flotulopex wrote:
The com tool lets me choose between different terminators; I just needed to test them one by one to find the correct one, the only one that works is "CR".

Evidently you don't have a detailed specification of the data format accepted by the printer, otherwise you would not have needed to perform that experiment. Can you not obtain such a specification from the printer manufacturer?

Richard.
User IP Logged

flotulopex
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 94
xx Re: Serial com in LBB/LB4 - what is different?
« Reply #15 on: Apr 30th, 2014, 08:40am »

I did open a ticket at their support center.

Wait and see wink
User IP Logged

Roger
Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx Re: Serial com in LBB/LB4 - what is different?
« Reply #16 on: Apr 30th, 2014, 10:34am »

Having had a browse and I search I find very little on line help or discussion. Everyone seems to use the bundled software.

What I do see is that the software uses parameter files which would suggest that you just cant start printing to the printer you have to give it the setup info first.

I also see that DTR is part of the serial setup so you will need to take note of that. It seems to be used to force a reset. So it is one handshaking line that you may need to manage.

I don't understand why you are using this microprocessor serial tool. I would have thought that you just open the g code file in LBB and print it to the serial com port.

When you look at how the working software works, look at how it opens the port, what it does with the handshaking lines and what preliminary data it sends to the printer.

Of course proper technical help or documentation would ease the journey.
User IP Logged

Pages: 1 2 3  Notify Send Topic Print
« Previous Topic | Next Topic »


This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls