r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

Graham
12-May-2005
[1069x2]
How does one open up the serial port?


I've tried open serial://port1/9600/8 and serial://port1/9600/8 and 
both give me errors ..
this is in windows
Anton
12-May-2005
[1071x3]
Volker, in english, it seems better to write
	'facet of face    (where OF is the function in between)
but we can't do that...
How about TAKE ? ie.
	take 'facet face    ; (read in english: "take 'facet from face")
Graham, try a different port, maybe it's port2 that is mapped in 
your system.
modem: open/lines/no-wait/direct serial://port2/9600/8/none/1  ; 
from an example on rebol-list 2003-12-03
Graham
12-May-2005
[1074]
I meant above that I also tried serial://com1/9600/8 ...
Anton
13-May-2005
[1075]
Well, I was just able to do this with no error:
>> port: open serial://port2/9600/8
>> close port
Graham
13-May-2005
[1076x2]
wonder what's wrong with mine.
I wonder if I have the serial printer attached as a windows printer 
and it's hogging the serial port.
Anton
13-May-2005
[1078]
Check whether it's enabled in device manager
Graham
13-May-2005
[1079x2]
the serial port currently has a serial printer attached
which is working.  I am trying to send some commands to the printer
Anton
13-May-2005
[1081x2]
are you trying to communicate with the printer ?
right ok.
Graham
13-May-2005
[1083]
yes
Anton
13-May-2005
[1084]
You need something to see the status of all ports on your system 
to diagnose, I think, but it looks like, if rebol can't open it, 
that windows already has opened a port to it.
Graham
13-May-2005
[1085x4]
yep, that was it.
I removed the serial printer from the windows printers and now I 
can open the port
now, how do I send a page feed to the printer ... ?
That's 0c isn't it?
Anton
13-May-2005
[1089x2]
You could probably just disconnect the serial cable physically, then 
scan for hardware changes... can save time later on maybe..
Yep, looks like FormFeed (FF) is 0x0C
Graham
13-May-2005
[1091x2]
oh well, it doesn't do what I need it to do.
tried insert port #{0c} but the paper won't feed :(
Anton
13-May-2005
[1093x2]
Maybe you need to terminate your commands.. ?  See if you can find 
the language that the printer understands.
(and maybe there's a "simple mode" and a "windows mode" the printer 
can go into)
Gregg
13-May-2005
[1095x2]
That is pretty crazy Allen. Doesn't seem like it could be too hard 
to do.
Graham, in the old days you would use the Escape+passthrough API, 
but that's been frowned on for quite a while now. Have you tried 
writing to %//PRN ? With more API work (OpenPrinter), you can use 
spooler functions like EndPagePrinter or WritePrinter too.
Graham
13-May-2005
[1097]
the problem is I don't have a windows driver for this printer so 
I am experimenting to see what type of controls it understands.

There is no manual, and the windows drivers are password protected 
on the manufacturer's website!
DideC
13-May-2005
[1098]
Give us the printer model. May be someone here...
Graham
13-May-2005
[1099x3]
I doubt it .. but here it is .. Addmaster IJ3000
http://www.addmaster.com
It looks like it accepts similar escape sequences as esc/pos ... 
but the application I'm using won't flush the printer buffer without 
closing the application down.
Gabriele
13-May-2005
[1102]
graham: check the serial parameters
Graham
13-May-2005
[1103]
Let me rephrase that.  I am using a POS program which I downloaded. 
 When it prints a receipt to my serial printer, it fails to cause 
the printer to print the full printer buffer.  But when I close the 
POS program down, the printer then spits out the rest.


I have downloaded the Builder C++  source ( but it won't compile 
without errors :(    ).  I thought I would try and use Rebol first 
to send commands to the  printer to see what I need to do to force 
the printer to print the contents of it's buffer.  It's not the pc 
buffer as I turned off the fifo buffers in the serial port settings 
to see what the problem was.
sqlab
13-May-2005
[1104x2]
Does your printer finish the job, if your POS program sends a new 
page or a new job?
Can you manually force a linefeed on your printer?
Sorry, I meant
Can you force a FF formfeed on your printer?
Sunanda
13-May-2005
[1106]
If you can issue a DOS command (REBOL/Command or some betas with 
Call enabled), try this:
    echo ^l > prn
(That's a ctrl+L character, not a caret then L)
That should force a form feed
Graham
13-May-2005
[1107]
Looks like the POS program locks the serial port until it closes 
down :(
Micha
14-May-2005
[1108x2]
port: make port! [scheme: 'tcp
                  host: 127.0.0.1
                  port-id: 80     ]
            
               



open port


clone: func [port /local clone ]
               [ clone: make port [ scheme: 'tcp  ]
                 open clone

                 clone/port-id: port/port-id
                 clone/state: port/state
                 clone/local-ip: port/local-ip
                 clone/remote-ip: port/remote-ip
                 clone/local-port: port/local-port
                 clone/remote-port: port/remote-port 
                                      
          
                 return clone ]
 


port/sub-port: clone port

probe port
how do to check or cloned harbour is open ?how do to check or cloned 
harbour is open ?how do to check or cloned harbour is open ?how do 
to check or cloned harbour is open ?
Anton
16-May-2005
[1110x4]
attempt [query port] probe port/status
no no no - sorry... does not work...
>> value? in port/sub-port/state 'inBuffer
== true
>> close port
>> value? in port/sub-port/state 'inBuffer
== false
Or maybe better to check   port/state/flags  or  port/sub-port/state/flags 
...... <---- need to investigate
Anton
19-May-2005
[1114x4]
Ahh... Best way might be to try to open port:
port: make port! http://www.rebol.net

print either error? try [open port]["open -> open"]["closed -> open"]
What's the best way to rethrow an error that you have caught and 
disarmed ?
;Like this ?
port: make port! http://www.rebol.net

if error? err: try [open port][err: disarm err throw make error! 
reduce [err/type err/id]] ; do this line twice
Romano
19-May-2005
[1118]
try:
>> errd: disarm err: try [ 2 / 0] errd/near: [new-near] err
** Math Error: Attempt to divide by zero
** Near: new-near