For Programmers: Free Programming Magazines  


Home > Archive > Clipper > December 2005 > NETMOS - Serial Port









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author NETMOS - Serial Port
Benny Yap

2005-11-14, 9:55 pm

Hi,

Is there currently any workaround or solution to check the realtime
status of a serial receipt printer connected to COM2 (From add on
NETMOS I/O Card)?. The computer comes with 1 built-in serial port
whereby its used by another running application.

The application is launched from a Windows mode prompt from a batch
file with all the mode settings. Have tested the PRINTREADY /
FT_ISPRINT() with no success on the printers online / offline mode.
Have read the earlier thread that states that its not possible because
of a printer spooler in newer version of windows (ME / XP). Do I need
to install the said printer driver (EPSON TM-U300) as windows default
printer and disable the spool option?. (By the way I do not have the
said windows driver)

TIA

Benny

Klas Engwall

2005-11-15, 6:55 pm

Benny,

>Is there currently any workaround or solution to check the realtime
>status of a serial receipt printer connected to COM2


....

>Have read the earlier thread that states that its not possible because
>of a printer spooler in newer version of windows (ME / XP).


I believe that the thread you mention is correct. Windows adds a
software layer between the hardware and the application, and that
layer prevents the application from talking directly to the hardware.
For 16-bit applications yet another layer, the virtual dos machine, is
added. It locks your DOS app in completely and allows no hardware
access at all.

An application that in pure DOS would access the hardware directly
will in NT/2K/XP talk to the VDM instead. And the VDM would at best
send your request to a windows driver. Then it is up to the driver if
it wants to send a reply back to the VDM.

>Do I need
>to install the said printer driver (EPSON TM-U300) as windows default
>printer and disable the spool option?. (By the way I do not have the
>said windows driver)


I don't think that would be of any help at all. You can't remove the
restrictions imposed by the VDM no matter what you do. What you need
is a winapp that is able to send messages to the printer through a
driver running close to the kernel and receive messages back from the
printer similar to the utilities that keep track of ink levels and
things like that. And of course the printer in question must be able
to perform such a conversation.

Regards,
Klas

-------
klas dot engwall at engwall dot com

http://www.engwall.com/clipper/

The LFN Library for Clipper
The LanMan Library for Clipper
The NFPAT1A Timeslice release patch for the Nanforum Toolkit
Benny Yap

2005-11-16, 3:55 am

Hi Klas,

>Benny,


>Is there currently any workaround or solution to check the realtime
>status of a serial receipt printer connected to COM2


....

>Have read the earlier thread that states that its not possible because
>of a printer spooler in newer version of windows (ME / XP).



I think my only solution is print directly bypassing the check LPT /
COMs. But if this method is used when printer is offline the
application will terminate after a while.
[color=darkred]

Found some resource in EPSON developer site. It states that using OPOS
ADK but mostly for VB and VC.
[color=darkred]
>Do I need
>to install the said printer driver (EPSON TM-U300) as windows default
>printer and disable the spool option?. (By the way I do not have the
>said windows driver)



Would download the ADK and see if able to get any status reply from the
printer (return values)

Thanks
Regards,
Benny

[color=darkred]
>Regards,
>Klas



-------
klas dot engwall at engwall dot com


http://www.engwall.com/clipper/


The LFN Library for Clipper
The LanMan Library for Clipper
The NFPAT1A Timeslice release patch for the Nanforum Toolkit

Klas Engwall

2005-11-27, 9:55 pm

Benny,

Sorry for taking so long to respond. I didn't see you message until I
switched to a different news server tonight. Have you found a solution
yet?

>I think my only solution is print directly bypassing the check LPT /
>COMs. But if this method is used when printer is offline the
>application will terminate after a while.


You mentioned WinME and XP briefly in your original post but you
didn't say which one your application runs on (or is it both?). In
your situation I would see to it that the print jobs are properly
spooled (ME might be less good at that than XP, but I don't have
enough ME experience to say for sure what it does). In the end the
users will wonder where the print job went and will see that the
printer is off line. Well, they would in an perfect world anyway <g>.

First of all, if the port you print to exists you should normally get
an alert box from the OS giving you a choice to retry or cancel. This
should not kill the application. If the port does not exist you should
get a TERM 0/Print Error, and then the application will die. At least
that is what I get here on the NT4 machine I am sitting at right now.

This is what I would do in NT/2K/XP: Install a printer driver and
point it to the COM port that the printer is connected to. It doesn't
matter much which driver. "Generic/Text only" should be OK. Then share
that printer (from Control Panel -> Printers), NET USE the share, for
example as LPT3, and print to LPT3 instead of the COM port (Sorry, but
this part will not work in 9x/ME). I would be very surprised if your
application still dies with these layers installed between the VDM and
the COM port.

>Found some resource in EPSON developer site. It states that using OPOS
>ADK but mostly for VB and VC.


In a Win32 environment ...

>Would download the ADK and see if able to get any status reply from the
>printer (return values)


I suspect that this will not get you any closer to the solution. Your
application is still a 16-bit one, and it runs inside the VDM (if we
are talking about NT/2K/XP).

Regards,
Klas

-------
klas dot engwall at engwall dot com

http://www.engwall.com/clipper/

The LFN Library for Clipper
The LanMan Library for Clipper
The NFPAT1A Timeslice release patch for the Nanforum Toolkit
Benny Yap

2005-11-28, 3:55 am

Hi Klas

[color=darkred]

It's ok Klas <g>
[color=darkred]
>I think my only solution is print directly bypassing the check LPT /
>COMs. But if this method is used when printer is offline the
>application will terminate after a while.


There was a check routine PRINTREADY() earlier then changed to
FT_ISPRINT()
at a later stage but was then removed when running on Windows ME. No
printer on-line checking at all for printing to LPT1 or COM2 and COM3.


Earlier the said user was using a PC running on Windows 98SE until the
HardDisk having some problems then "RIP". They brought in another PC
aparently
loaded with Windows ME and having only 1 unit built in COM port.
Slotted in a
addin card from NETMOS to get additional COM ports as the COM1 is only
dedicated
to poll information from an access card reader. Slight changes was done
to my
current application to print receipts to COM2 and messages to customer
display on
COM3. LPT1 was not changed except for that they are still using a NEC
matrix printer
[color=darkred]

Yes normally it was supposed so, have got these messages Windows 98
earlier.
[color=darkred]

I did not try this option as my printout was to a EPSON TM-U300D
printer
connected to COM2. Will try on this if it may work. If I had enable or
disable
the check selection on the MS-DOS prompt properties where Prevent
MS-DOS based
programs from detecting windows it is giving different effect due to
VDM I suppose
on Windows ME.

There are 2 types of files created in the C:\Windows\Spool\Printers
folder
..SPL and .SHD maybe could read if those file exists. But in XP Home /
XP Pro
the spool folder are located on the \System32\Spool\Driver\ directory.
This may
not be a good idea though.

In the meantime just pop up a big message box "Is Printer Online" then
ENTER
to start printing. <g>
[color=darkred]
>Found some resource in EPSON developer site. It states that using OPOS
>ADK but mostly for VB and VC.



Yes, downloaded all the necessary info and drivers about 200MB. It
states that
you could get response information from the OPOS ADK drivers if
application is
written for VB, DELPHI and VC.
[color=darkred]
>Would download the ADK and see if able to get any status reply from the
>printer (return values)

[color=darkred]

Was thinking of porting my application to Harbour or XHarbour later on.

Regards
Benny
[color=darkred]

Ian Boys

2005-11-28, 3:55 am

I have never managed to "talk" directly to a PCI serial card from Clipper
(Tools III or Telepathy) as they do not set up with standard IRQ/base
addresses, I have always resorted to Xbase. Even then, some have an auto
RTS/CTS in the device advanced properties that needs to be turned off before
"normal" comms works.

Ian Boys
DTE


Ross McKenzie

2005-11-28, 7:55 am

On Mon, 28 Nov 2005 09:12:02 +0000 (UTC), "Ian Boys"
<TooMuchSpam@BTInternet.com> wrote:

>I have never managed to "talk" directly to a PCI serial card from Clipper
>(Tools III or Telepathy) as they do not set up with standard IRQ/base
>addresses, I have always resorted to Xbase. Even then, some have an auto
>RTS/CTS in the device advanced properties that needs to be turned off before
>"normal" comms works.
>
>Ian Boys
>DTE
>
>


Hi Ian,

Have you tried using Telepathy's
tp_setport( nPort, nAddress, nIRQ ) ?


Regards,

Ross McKenzie
ValuSoft
Melbourne Australia

valusoft AT optusnet DOT com DOT au
Ian Boys

2005-11-28, 6:55 pm

Ross,
Normally I use Tools III for comms, Telepath I use for an app that requires
Kermit. On refelction I may not have tried Telepath. I'll bung in a card and
try it. I know that there's not many on the forum that seem to do a lot of
comms, but has anybody out there managed to talk to a PCI serial card? I
still have that sneaky feeling that the base address and port numbers are
just too wild for software written that long ago.

Ian

"Ross McKenzie" <NoJunk_valusoft@optusnet.com.au> wrote in message
news:438b0312.40207937@news...
> On Mon, 28 Nov 2005 09:12:02 +0000 (UTC), "Ian Boys"
> <TooMuchSpam@BTInternet.com> wrote:
>
>
> Hi Ian,
>
> Have you tried using Telepathy's
> tp_setport( nPort, nAddress, nIRQ ) ?
>
>
> Regards,
>
> Ross McKenzie
> ValuSoft
> Melbourne Australia
>
> valusoft AT optusnet DOT com DOT au



Ian Boys

2005-11-28, 6:55 pm

As I thought, Telepath doesn't like the base address A000 ( 40960) or IRQ of
20 that the card uses. You get a bad function parameter error.

Ian Boys
DTE


Ross McKenzie

2005-11-28, 6:55 pm

On Mon, 28 Nov 2005 15:25:38 +0000 (UTC), "Ian Boys"
<TooMuchSpam@BTInternet.com> wrote:

>As I thought, Telepath doesn't like the base address A000 ( 40960) or IRQ of
>20 that the card uses. You get a bad function parameter error.
>
>Ian Boys
>DTE
>
>


Thanks Ian.

I have certainly been successful using non standard IRQ numbers, but
obviously must not have used it with any PCI serial cards. Another one
for the aging memory bank.

Regards,

Ross McKenzie
ValuSoft
Melbourne Australia

valusoft AT optusnet DOT com DOT au
Benny Yap

2005-11-28, 9:55 pm

I do think maybe thats my problem you are referring to or maybe its a
WinME prob on the VDM.

Regards
Benny

Benny Yap

2005-11-28, 9:55 pm

Hi Ian,

I have this old document on Windows Port usage. This is part of it.

Driver Port Use

VCD
COM1 03F8h Receive Buffer / Transmitter Holding / Divisor Latch LSB
03F9h Interrupt Enable / Divisor Latch MSB
03FAh Interrupt Identify / FIFO control
03FBh Line Control
03FCh Modem Control
03FDh Line Status
03FEh Modem Status
COM2 02F8h Receive Buffer / Transmitter Holding / Divisor Latch LSB
02F9h Interrupt Enable / Divisor Latch MSB
02FAh Interrupt Identify / FIFO control
02FBh Line Control
02FCh Modem Control
02FDh Line Status
02FEh Modem Status
COM3 03E8h Receive Buffer / Transmitter Holding / Divisor Latch LSB
03E9h Interrupt Enable / Divisor Latch MSB
03EAh Interrupt Identify / FIFO control
03EBh Line Control
03ECh Modem Control
03EDh Line Status
03EEh Modem Status
VPD
LPT1 03BCh Data Latch
03BDh Printer Status
03BEh Printer Control
LPT2 0378h Data Latch
0379h Printer Status
037Ah Printer Control
LPT3 0278h Data Latch
0279h Printer Status
027Ah Printer Control

Regards
Benny

Klas Engwall

2005-11-28, 9:55 pm

X-Newsreader: Forte Free Agent 1.11/32.235
NNTP-Posting-Host: pm8-188.wineasy.se
X-Original-NNTP-Posting-Host: pm8-188.wineasy.se
Date: 29 Nov 2005 02:27:51 +0200
X-Trace: wineasy!newsfeed.wineasy.se!news.wineasy.se!news.songnetworks.se 1133227671 213.131.144.188 (29 Nov 2005 02:27:51 +0200)
Lines: 71
X-Complaints-To: abuse@songnetworks.se
Path: border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed1.eu.ignite.net!News-Peer-Europe!news-peer-europe.sprintlink.net!newsfeed1.swip.net!swipnet!wineasy!newsfeed.wineasy.se!news.wineasy.s
e!news.songnetworks.se!not-for-mail
Xref: number1.nntp.dca.giganews.com comp.lang.clipper:124633

Benny,

>
>Yes normally it was supposed so, have got these messages Windows 98
>earlier.


And they don't pop up on the ME machine with the extra serial card.
Quite interesting! Inspired by Ross' and Ian's discussion in this
thread, I wonder how the COM2 port is set up. I haven't used a serial
printer since the old DOS days so I have never wrestled with it under
Windows or with today's serial cards, but it hit me that MAYBE the
port has a non-standard setup (something other than 2F8h/IRQ3) and
that printing to that non-standard port works OK anyway when the
printer is online (because the OS takes care of it) but that it fails
beacuse of the non-standard setup when the printer is offline (because
Clipper tries to talk to the port at 2F8h/IRQ3 to determine what is
wrong). Just a guess though ...

>If I had enable or disable the check selection on the MS-DOS prompt
>properties where Prevent MS-DOS based programs from detecting
>windows it is giving different effect due to VDM I suppose
>on Windows ME.


I am not quite sure what you say here, but ME is just a souped-up
Win98 and still a DOS-based OS (although MS tried very hard to hide
that fact) with no NTVDM. So there is a big difference between ME and
NT/2K/XP. In ME it should still be possible to talk to the hardware if
you can convince the OS not to grab it. In Win98 there are registry
settings that can be used to prevent Windows from taking over a serial
port, and I suspect that ME works in a similar way.

>There are 2 types of files created in the C:\Windows\Spool\Printers
>folder .SPL and .SHD maybe could read if those file exists. But in XP
>Home / XP Pro the spool folder are located on the \System32\Spool\Driver\
>directory. This may not be a good idea though.


No, I don't think it would. What does the existence of those files
tell you? Not much in relation to your Clipper application, I suspect.

>In the meantime just pop up a big message box "Is Printer Online" then
>ENTER to start printing. <g>


And then quickly unplug your telephone <g>

>Was thinking of porting my application to Harbour or XHarbour later on.


Yes, that would at least put you on an equal footing with other
Windows application. But you will still need a printer driver pointing
to COM2 and send the print jobs through the spooler. Windows
applications have to go through those layers too.

DOS apps are locked into the VDM in NT/2K/XP to stop them from doing
illegal things. Windows apps are expected to do things "the right way"
without that kind of precautions.

Regards,
Klas

-------
klas dot engwall at engwall dot com

http://www.engwall.com/clipper/

The LFN Library for Clipper
The LanMan Library for Clipper
The NFPAT1A Timeslice release patch for the Nanforum Toolkit
Benny Yap

2005-11-29, 3:55 am

Hi Klas,

Thanks for the response

[color=darkred]
[color=darkred]
>Yes normally it was supposed so, have got these messages Windows 98
>earlier.



Yes, the extra serial I/O from NETMOS comes with a set of drivers for
DOS
and Windows. In DOS you just need to initiate the .EXE file and then
specify
the ports address and irq's with options as below.

-a[dd] = Add NetMos Ports
-c[onfig]:<parameters> = Configure NetMos Ports
-d[elete] = Delete NetMos Ports
-r[emap] = Remap NetMos ports to legacy ports
-s[ilent] = Silent mode
-t[est] = Test ports (requires external Loop-Back
plugs)
-u[nused] = remap to all Unused legacy port i/o
base,
without consideration of COM/LPT number

But there may be some problems using it on various makes of mainboard
available.
Have tested it on ASUS and INTEL mainboard are ok other cheaper
mainboards that
are used you may get mapping and addressing problems. Maybe the .EXE
file have
something to do about it which is not really documented. Most serial
I/O's
available here are 16C550 compatible UART with 16byte transmit-receive
FIFO.

In order to print to serial port I initiate a command using MODE
COM2:9600,N,8,1
In the earlier thread discussion someone has used MODE
COMx:9600,n,8,1,P
[color=darkred]
>If I had enable or disable the check selection on the MS-DOS prompt
>properties where Prevent MS-DOS based programs from detecting
>windows it is giving different effect due to VDM I suppose
>on Windows ME.



I'm equally too. Have done the registry change as below.

[HKEY_LOCAL_MACHINE\System\CurrentContro
lSet\Services\VxD\VCOMM]
"StaticVxD"="*VCOMM"
"Start"=hex:00
"EnablePowerManagement"=hex:00,00,00,00

Made some changes to the system.ini file under 386Enh

[386Enh]
Com2Buffer=512
ComBoostTime=20
COM2Irq=3
COM2Base=02F8
Com1AutoAssign=2
Com2AutoAssign=2
LPT1AutoAssign=60
LPT2AutoAssign=60
[color=darkred]
>There are 2 types of files created in the C:\Windows\Spool\Printers
>folder .SPL and .SHD maybe could read if those file exists. But in XP
>Home / XP Pro the spool folder are located on the \System32\Spool\Driver\
>directory. This may not be a good idea though.



Have not test prints direct from clipper though but just output a small
text file
with a selected EPSON printer driver.
[color=darkred]
>In the meantime just pop up a big message box "Is Printer Online" then
>ENTER to start printing. <g>



Good idea <g>
[color=darkred]
>Was thinking of porting my application to Harbour or XHarbour later on.

[color=darkred]

Will do.
Have seen many ppl on this thread is using Abeelabs Library may it
help?.
[color=darkred]

Well M$ always leads the way with the upcoming VISTA OS

Regards
Benny
[color=darkred]

Klas Engwall

2005-11-29, 6:55 pm

Benny,

>Yes, the extra serial I/O from NETMOS comes with a set of drivers for
>DOS and Windows. In DOS you just need to initiate the .EXE file and then
>specify the ports address and irq's with options as below.


Did you set up the COM2 port with IRQ3 and IO-port 2F8h?

>In order to print to serial port I initiate a command using MODE
>COM2:9600,N,8,1
>In the earlier thread discussion someone has used MODE
>COMx:9600,n,8,1,P


Yes, the version with the "P is the recommended one.

> [HKEY_LOCAL_MACHINE\System\CurrentContro
lSet\Services\VxD\VCOMM]
>"StaticVxD"="*VCOMM"
>"Start"=hex:00
>"EnablePowerManagement"=hex:00,00,00,00


OK. That last line should prevent Windows from turning off the power
for the port.

>Made some changes to the system.ini file under 386Enh
>
>[386Enh]
>Com2Buffer=512
>ComBoostTime=20
>COM2Irq=3
>COM2Base=02F8


And this matches the setup in the card, does it?

>Com1AutoAssign=2
>Com2AutoAssign=2
>LPT1AutoAssign=60
>LPT2AutoAssign=60


>Have seen many ppl on this thread is using Abeelabs Library may it
>help?.


I suppose so, but I have no personal experience. In any case, if you
can fix the port and/or spooler you would save a lot of time not
having to rewrite your print routines.

Regards,
Klas

-------
klas dot engwall at engwall dot com

http://www.engwall.com/clipper/

The LFN Library for Clipper
The LanMan Library for Clipper
The NFPAT1A Timeslice release patch for the Nanforum Toolkit
Benny Yap

2005-11-29, 9:55 pm

Hi Klas,

[color=darkred]
>Yes, the extra serial I/O from NETMOS comes with a set of drivers for
>DOS and Windows. In DOS you just need to initiate the .EXE file and then
>specify the ports address and irq's with options as below.



Yes, I have done that. Have also checked that other resources is not
sharing the same IRQ's
[color=darkred]
>In order to print to serial port I initiate a command using MODE
>COM2:9600,N,8,1
>In the earlier thread discussion someone has used MODE
>COMx:9600,n,8,1,P



Will the ending ,P makes any differences.
[color=darkred]
> [HKEY_LOCAL_MACHINE\System\CurrentContro
lSet\Services\VxD\VCOMM]
>"StaticVxD"="*VCOMM"
>"Start"=hex:00
>"EnablePowerManagement"=hex:00,00,00,00



The power saving thingy.
[color=darkred]
>Made some changes to the system.ini file under 386Enh


>[386Enh]
>Com2Buffer=512
>ComBoostTime=20
>COM2Irq=3
>COM2Base=02F8



Actually no, I managed to dig this setting up from a old computer with
Windows
v3.11 which has some of this settings but have no documents or help on
the setting
part.
[color=darkred]
>Com1AutoAssign=2
>Com2AutoAssign=2
>LPT1AutoAssign=60
>LPT2AutoAssign=60
>Have seen many ppl on this thread is using Abeelabs Library may it
>help?.

[color=darkred]

In the meantime I just store the windows version info in a text file
for
version checking then initiate FT_ISPRINT() or PRINTREADY() if not
running
on Windows ME or XP. So there isn't much changes on the print routine
except
for the additional function calls.

Need to sit down and put on some thinking caps. The other thing that
I've had not
done so is adjusting the serial printers DIP switches.

Thanks

Regards
Benny
[color=darkred]

Klas Engwall

2005-12-01, 6:55 pm

Benny,

>
>Yes, I have done that. Have also checked that other resources is not
>sharing the same IRQ's


OK

>
>Will the ending ,P makes any differences.


That is quite possible, but it needs to be tested, doesn't it?

>
>
>Actually no, I managed to dig this setting up from a old computer
>with Windows 3.11 which has some of this settings but have no
>documents or help on the setting
>part.


I was thinking of the IRQ and I/O-port settings in the card. And you
say that you have checked them, so there seems to be no mismatch. But
on the other hand I have no recollection of any COMnIrq and COMnBase
settings, so I am not sure what they are supposed to do.

>In the meantime I just store the windows version info in a text file
>for version checking then initiate FT_ISPRINT() or PRINTREADY() if not
>running on Windows ME or XP. So there isn't much changes on the print
>routine except for the additional function calls.


As I mentioned before, WinME is not much different from Win95/98 and
XP is not much different from WinNT/2K. So if you are planning to NOT
use those functions in ME and XP, the most logical thing to do would
be to not use them in any Windows version after 3.x. I think you need
to re-evalutate the whole problem and investigate the hints you have
been given in this thread. Your suggested solution in the quote above
is no more than symptom treatment for the specific computer where the
problem showed up. Given the same hardware and the same settings I
suspect that you would have the same problem witn any other Windows
version from the last ten years.

>Need to sit down and put on some thinking caps.


Agreed <g>.

Regards,
Klas

-------
klas dot engwall at engwall dot com

http://www.engwall.com/clipper/

The LFN Library for Clipper
The LanMan Library for Clipper
The NFPAT1A Timeslice release patch for the Nanforum Toolkit
Benny Yap

2005-12-01, 6:55 pm

Hi Klas,

Thanks for your reply and your valuable input.
I'll shall check out if there is a patch for the supplied drivers on
the bundle CD, maybe there is a newer version or patch.

Regards
Benny

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com