![]() |
|
#1
|
|||
|
|||
Configuring port rs232Good evening,
please can you help me with this code? I want to change it, because I must read some data from reader, which will be access to pc by rs232. Thank you. CPP / C++ / C Code:
Last edited by LuciWiz : 11-Nov-2009 at 14:07.
Reason: Please insert your C code between [cpp] & [/cpp] tags
|
|||
|
#2
|
|||
|
|||
Re: Configuring port rs232Quote:
What kind of help would you like? Exactly? There is a short and sweet introduction here: http://www.robbayer.com/serial.php Just click on the Windows link. Regards, Dave |
|
#3
|
|||
|
|||
Re: Configuring port rs232Quote:
Hi, thank you for good introduction. And I want to know just this: 1. how can I tell this program, that I will use a rs232 port? can it be set up by instruction: OPEN_EXISTING??? 2. in thi sintroduction is some example to configure timeouts and it is written there, that "tell Windows not to wait for data to show up", if I understand it mean, that if I dont want any timeouts, I must to write it. Is it true??? because I want to read data from a reader, which wont work in the same time, it will work in random time. 3. how can I set up the DCB? must I find informations from a producer of the reader? Thank you for answer. |
|
#4
|
|||
|
|||
Re: Configuring port rs232Quote:
Quote:
Quote:
Regards, Dave Footnote: For definitions and applications information for Windows functions, I suggest that you start at the Microsoft msdn site http://msdn.microsoft.com Search for the function that you are interested in. For example: SetCommState Function or SetCommTimeouts Function These have numerous links that explain the structs and how to use them. |
|
#5
|
|||
|
|||
Re: Configuring port rs232Quote:
I think, we dont understand, because I know it, but COM1 and COM2 are just your names for the port. And I can name it random, but instruction OPEN_EXISTING mean, that it load actual port, which is used. I think so. Is it true? Quote:
So, now I understand better, this paper shows exactly what I have to do. Sorry for some mistakes, it is because I couldnt find som words. Thank you very much, so I try to do something and than I can give it here. |
|
#6
|
|||
|
|||
Re: Configuring port rs232Quote:
These are special strings that CreateFIle() treats as serial ports. If you call CreateFile() with "COM1" as its first argument, it will attempt to open serial communications (RS-232) port number one. "COM2" would be for serial communications (RS-232) port number two. Etc. Look at the examples and follow them exactly for starters. See Footnote. You might want to poke around msdn some more. For example: Serial Communications in Win32 Regards, Dave I have observed that CreateFIle() also treats COM strings with colons ("COM1:", "COM2:", etc.) as serial port names (those were used in previous versions of Windows and in DOS and you might run across them in old programs by old programmers), but I would stick with the designations used in examples on msdn and other reliable sources. Last edited by davekw7x : 12-Nov-2009 at 10:10.
|
|
#7
|
|||
|
|||
Re: Configuring port rs232Quote:
Yes, I have some darkness in it. I didt know, that rs-232 have ports COM1 and COM2. I thought, that COM1 and COM2 are just usb ports. So now I am more clever. Thanks. |
|
#8
|
|||
|
|||
Re: Configuring port rs232This is the program. It dont give any error, so I think it would be good, but I must try it on the reader. But I have to give recieved data to xml form yet. How can I do it? Thanks.
CPP / C++ / C Code:
Last edited by LuciWiz : 14-Nov-2009 at 11:16.
Reason: Please insert your C++ code between [cpp] & [/cpp] tags
|
Recent GIDBlog
Install Adobe Flash - Without Administrator Rights by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Hard drive/CPU Diagnoses Issues | binarybug | Computer Hardware Forum | 1 | 22-Jan-2007 19:23 |
| Serial Port Communication | a3.charles | C Programming Language | 0 | 03-Aug-2006 23:42 |
| Code for receiving data from parallel port in VB.net | harry.net | .NET Forum | 1 | 10-Mar-2006 15:41 |
| Problem to read on a serial port | collinm | C Programming Language | 2 | 30-Mar-2005 01:42 |
| Problem with string and serial port | collinm | C Programming Language | 13 | 25-Mar-2005 07:39 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The