CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Serial Port Access Under Windows XP!

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
No_Fear
Guest







Serial Port Access Under Windows XP!
PostPosted: Tue Nov 12, 2002 3:08 pm     Reply with quote

Hi there,
I dont know if this question is related with this board or not but i need help and dont know another board with pic+serial communication, sorry..I have an application and a device using pic 16F628+max232 to communicate via serial port.It works under Windows 98SE perfectly but it doesn't work under WinXp!! I think Winxp does not give direct access to programs for serial ports.I'm programming under Borland C++ Builder v4.0 and i can also use Delphi components.Does somebody knows the solution? How can i access??
Thanks a lot.
___________________________
This message was ported from CCS's old forum
Original Post ID: 8817
Tomi
Guest







Re: Serial Port Access Under Windows XP!
PostPosted: Tue Nov 12, 2002 3:48 pm     Reply with quote

I don't use BC++ or Delphi (I use VC++) but system calls are system calls...
The most standard way to use serial comm and LPT ports (I assume that you write 32-bit app):
1. Open the port as a normal file with low level functions (usually CreateFile() call, with OPEN_EXISTING option) This call gives you a file handle, e.g. HANDLE fConn = CreateFile("COM1",........);
2. Call SetupComm() with that file handle (and a DCB, a Device Control Block) to set up baud rate, handshaking, etc.
3. Send out data calling WriteFile()
4. Receive data by ReadFile()
5. Close the port by CloseHandle() function just before your app is terminated or whenever you don't need the session opened

:=Hi there,
:=I dont know if this question is related with this board or not but i need help and dont know another board with pic+serial communication, sorry..I have an application and a device using pic 16F628+max232 to communicate via serial port.It works under Windows 98SE perfectly but it doesn't work under WinXp!! I think Winxp does not give direct access to programs for serial ports.I'm programming under Borland C++ Builder v4.0 and i can also use Delphi components.Does somebody knows the solution? How can i access??
:=Thanks a lot.
___________________________
This message was ported from CCS's old forum
Original Post ID: 8818
No_Fear
Guest







Re: Serial Port Access Under Windows XP!
PostPosted: Tue Nov 12, 2002 4:01 pm     Reply with quote

Thank you very much but i'm already using CreateFile, WriteFile :(( I also tried to connect to device with hyperterminal but that doesn't work under xp.(However it works perfectly under win 98se).I cant solve the problem :((
:=I don't use BC++ or Delphi (I use VC++) but system calls are system calls...
:=The most standard way to use serial comm and LPT ports (I assume that you write 32-bit app):
:=1. Open the port as a normal file with low level functions (usually CreateFile() call, with OPEN_EXISTING option) This call gives you a file handle, e.g. HANDLE fConn = CreateFile("COM1",........);
:=2. Call SetupComm() with that file handle (and a DCB, a Device Control Block) to set up baud rate, handshaking, etc.
:=3. Send out data calling WriteFile()
:=4. Receive data by ReadFile()
:=5. Close the port by CloseHandle() function just before your app is terminated or whenever you don't need the session opened
:=
:=:=Hi there,
:=:=I dont know if this question is related with this board or not but i need help and dont know another board with pic+serial communication, sorry..I have an application and a device using pic 16F628+max232 to communicate via serial port.It works under Windows 98SE perfectly but it doesn't work under WinXp!! I think Winxp does not give direct access to programs for serial ports.I'm programming under Borland C++ Builder v4.0 and i can also use Delphi components.Does somebody knows the solution? How can i access??
:=:=Thanks a lot.
___________________________
This message was ported from CCS's old forum
Original Post ID: 8819
Lance Lascari
Guest







Re: Serial Port Access Under Windows XP!
PostPosted: Tue Nov 12, 2002 4:37 pm     Reply with quote

I'm working on a PIC programmer under windows 2000.

Here's what I do for the ports

1) serial port (not used for my pic programmer). I found a nice class "CSerial" at www.codeguru.com. I'm using visual C++ 7 , but perhaps the code is useful to you --

<a href="http://codeguru.earthweb.com/network/serial.shtml" TARGET="_blank">http://codeguru.earthweb.com/network/serial.shtml</a>

I haven't beaten on this much, but I did write a test app...

2) for parallel port access (which I do use in my programmer), I use "porttalk" the very useful device driver that can be found here

<a href="http://www.beyondlogic.org/porttalk/porttalk.htm" TARGET="_blank">http://www.beyondlogic.org/porttalk/porttalk.htm</a>


Good luck,
Lance



:=Thank you very much but i'm already using CreateFile, WriteFile <img src="http://www.ccsinfo.com/pix/forum/sad.gif" border="0">( I also tried to connect to device with hyperterminal but that doesn't work under xp.(However it works perfectly under win 98se).I cant solve the problem <img src="http://www.ccsinfo.com/pix/forum/sad.gif" border="0">(
:=:=I don't use BC++ or Delphi (I use VC++) but system calls are system calls...
:=:=The most standard way to use serial comm and LPT ports (I assume that you write 32-bit app):
:=:=1. Open the port as a normal file with low level functions (usually CreateFile() call, with OPEN_EXISTING option) This call gives you a file handle, e.g. HANDLE fConn = CreateFile("COM1",........);
:=:=2. Call SetupComm() with that file handle (and a DCB, a Device Control Block) to set up baud rate, handshaking, etc.
:=:=3. Send out data calling WriteFile()
:=:=4. Receive data by ReadFile()
:=:=5. Close the port by CloseHandle() function just before your app is terminated or whenever you don't need the session opened
:=:=
:=:=:=Hi there,
:=:=:=I dont know if this question is related with this board or not but i need help and dont know another board with pic+serial communication, sorry..I have an application and a device using pic 16F628+max232 to communicate via serial port.It works under Windows 98SE perfectly but it doesn't work under WinXp!! I think Winxp does not give direct access to programs for serial ports.I'm programming under Borland C++ Builder v4.0 and i can also use Delphi components.Does somebody knows the solution? How can i access??
:=:=:=Thanks a lot.
___________________________
This message was ported from CCS's old forum
Original Post ID: 8820
Steve H
Guest







Re: Serial Port Access Under Windows XP!
PostPosted: Tue Nov 12, 2002 4:40 pm     Reply with quote

I have written many programs that use RS232 communication via MSCOMM.VBX and OCX's that work fine under 9x, NT, 2k and XP. So I don't think that there is any real reason that it won't work for you too. You say that hyperterminal does not work for you now. That sounds like some sort of other problem and not a problem with XP....

Good luck,

Steve H.
___________________________
This message was ported from CCS's old forum
Original Post ID: 8821
Tomi
Guest







Re: Serial Port Access Under Windows XP!
PostPosted: Wed Nov 13, 2002 12:43 am     Reply with quote

Hyperterminal MUST work. If it is not working then you could be sure that the problem is not in your HW/SW.
Is your port visible in the Control Panel?
Can you open your port with Hyperterm? If so then tie pins 2 and 3 together on DB9 connector of COMx to make an echo test.


:=Thank you very much but i'm already using CreateFile, WriteFile <img src="http://www.ccsinfo.com/pix/forum/sad.gif" border="0">( I also tried to connect to device with hyperterminal but that doesn't work under xp.(However it works perfectly under win 98se).
___________________________
This message was ported from CCS's old forum
Original Post ID: 8829
Laurent chouinard
Guest







Re: Serial Port Access Under Windows XP!
PostPosted: Wed Nov 13, 2002 9:36 am     Reply with quote

Are you certain that your Hyperterminal is properly configured for the serial port you're using?

I've also found out that sometimes, Hyperterminal needs to have me save the session in a file with File/Save as and _THEN_ click the connect button in order to open the serial port and get the connection going. I have no idea why this was needed sometimes while it's not required for the rest, but you can try that to be sure.

Like others said, it *must* work with Hyperterminal first, and then once this works, try your own software.

You could also check in your Device Manager and see if the port comes up in the driver list, and see if it's "Working properly".

Are there any errors anywhere in the process with Hyperterminal? Does it mention anything about the port being busy by another application running maybe?
___________________________
This message was ported from CCS's old forum
Original Post ID: 8846
ajt



Joined: 07 Sep 2003
Posts: 110

View user's profile Send private message

Re: Serial Port Access Under Windows XP!
PostPosted: Wed Nov 13, 2002 11:29 pm     Reply with quote

We have a commercial application using straightforward overlapped I/O API calls for serial communication. Nothing at all our of the ordinary. This code worked perfectly fine under 95, 98, and 2000 but didn't work at all under XP. The problem was that in all but XP you can take some shortcuts in how you do the overlapped events and such but in XP it has to be totally to the letter of the Microsoft law or it doesn't work. API calls are not just API calls... you have to read the fine print.

I suggest checking MSDN for an article called Serial Communications in Win32 by Allen Denver. This was written in 1995(!) but held the key to the specifics of using the API "correctly", at least in our case. YMMV

Al



:=Hi there,
:=I dont know if this question is related with this board or not but i need help and dont know another board with pic+serial communication, sorry..I have an application and a device using pic 16F628+max232 to communicate via serial port.It works under Windows 98SE perfectly but it doesn't work under WinXp!! I think Winxp does not give direct access to programs for serial ports.I'm programming under Borland C++ Builder v4.0 and i can also use Delphi components.Does somebody knows the solution? How can i access??
:=Thanks a lot.
___________________________
This message was ported from CCS's old forum
Original Post ID: 8883
_________________
Al Testani
faessler
Guest







Re: Serial Port Access Under Windows XP!
PostPosted: Fri Nov 15, 2002 12:57 am     Reply with quote

Hello,

i use BCP 6 and i use the TSerial from the German Magazin
Toolbox.
www.toolbox-mag.de
You must order the 02/2002 in this Magazin are TSerial 3.6.

Or in spring 2003 an book apears. Serial Programming with
Delpi and C++Builder (CL).
An Link are on Toolbox Mag. Site.

regards

Oliver


:=I'm working on a PIC programmer under windows 2000.
:=
:=Here's what I do for the ports
:=
:=1) serial port (not used for my pic programmer). I found a nice class "CSerial" at www.codeguru.com. I'm using visual C++ 7 , but perhaps the code is useful to you --
:=
:= <a href="http://codeguru.earthweb.com/network/serial.shtml" TARGET="_blank"> <a href="http://codeguru.earthweb.com/network/serial.shtml" TARGET="_blank">http://codeguru.earthweb.com/network/serial.shtml</a></a>
:=
:=I haven't beaten on this much, but I did write a test app...
:=
:=2) for parallel port access (which I do use in my programmer), I use "porttalk" the very useful device driver that can be found here
:=
:= <a href="http://www.beyondlogic.org/porttalk/porttalk.htm" TARGET="_blank"> <a href="http://www.beyondlogic.org/porttalk/porttalk.htm" TARGET="_blank">http://www.beyondlogic.org/porttalk/porttalk.htm</a></a>
:=
:=
:=Good luck,
:=Lance
:=
:=
:=
:=:=Thank you very much but i'm already using CreateFile, WriteFile <img src="http://www.ccsinfo.com/pix/forum/sad.gif" border="0">( I also tried to connect to device with hyperterminal but that doesn't work under xp.(However it works perfectly under win 98se).I cant solve the problem <img src="http://www.ccsinfo.com/pix/forum/sad.gif" border="0">(
:=:=:=I don't use BC++ or Delphi (I use VC++) but system calls are system calls...
:=:=:=The most standard way to use serial comm and LPT ports (I assume that you write 32-bit app):
:=:=:=1. Open the port as a normal file with low level functions (usually CreateFile() call, with OPEN_EXISTING option) This call gives you a file handle, e.g. HANDLE fConn = CreateFile("COM1",........);
:=:=:=2. Call SetupComm() with that file handle (and a DCB, a Device Control Block) to set up baud rate, handshaking, etc.
:=:=:=3. Send out data calling WriteFile()
:=:=:=4. Receive data by ReadFile()
:=:=:=5. Close the port by CloseHandle() function just before your app is terminated or whenever you don't need the session opened
:=:=:=
:=:=:=:=Hi there,
:=:=:=:=I dont know if this question is related with this board or not but i need help and dont know another board with pic+serial communication, sorry..I have an application and a device using pic 16F628+max232 to communicate via serial port.It works under Windows 98SE perfectly but it doesn't work under WinXp!! I think Winxp does not give direct access to programs for serial ports.I'm programming under Borland C++ Builder v4.0 and i can also use Delphi components.Does somebody knows the solution? How can i access??
:=:=:=:=Thanks a lot.
___________________________
This message was ported from CCS's old forum
Original Post ID: 8949
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group