![]() |
|
#1
|
|||
|
|||
Access to RS232Hi,
I want to make a C# program that will show if the pc have a rs232 or not,and if the response is positive to acces it. Questions: -can I play with rs232(com1) if it has nothing conected to it(writing/reading) -where can I start to find informations about programming rs232 In the future I want to connect a circuit with a controller on it made by me and I want to learn how to transmit data through rs232 first. 10x |
|
#2
|
|||
|
|||
Re: accsesing rs232I dont know about, c#,
but there is definetely in 'c' and c++ on windows and linux. Linux you can use "outb" for writing to the port and "inb" for reading from the port; |
|
#3
|
|||
|
|||
Re: Access to RS232Hi,
I didn't find outb and inb but I found inport and outport commands and I made this program but when I read the port at address 0x3f8(com1 address) it returns 0x0 even though I sent caracter 'C' to the com1 port. Why it returns 0x0 and not 'C' correspondent in ascii code? CPP / C++ / C Code:
Last edited by admin : 13-Dec-2007 at 07:46.
Reason: Please insert your example C/C++ codes between [CPP] and [/CPP] tags
|
|
#4
|
|||
|
|||
Re: accsesing rs232Quote:
Background info such as operating system is very important to know. The functions which <dos.h> provides for i/o port programming are very low level functions. There is no inbuilt flow control or buffering. Quote:
Why did you expect to get " 'C' corespondent in ascii code " ? COM ports are not loopback-devices so they don't echo the stuff you sent back to you. This article : http://www.beyondlogic.org/serial/serial1.htm#30 provides very good explanations about serial ports and of their programming in certain pc environments (Part 3). There you can see that using <dos.h> is very low level programming. I think the easiest way to program for COM ports is in linux where you can access serial ports just like a normal file in /dev/ folder COM1 = ttyS0 etc.. This kind of access is buffered and the behaviour of reading would be in a blocking mode with associated timeout. |
|
#5
|
|||
|
|||
Re: Access to RS232You were right,my o.s is windows and I use a turbo C compiler.
I read the article you recomanded and I have seen there that rs232 can be transformed in a loopback device by conecting some pins toghether. I don't know if that is good for motherboard.Now I'm thinking if to do it or not. Thanks |
|
#6
|
|||
|
|||
Re: Access to RS232Quote:
For RS232 port, they actually have internal ersistors to limit the current. Don't worry........ try to find some technical specifications of RS232 port. One simple and trivial test u wanna try is to, use a switch and and LED. Set the switch (the pin u connected to) as the input and set the LED (the pin you connected to) as output. The RS 232 port also has 5V and Ground. Play around......... its fun. Furthermore you can try connect senros and buzzers. BCD LED......... so many more. |
|
#7
|
|||
|
|||
Re: Access to RS232As an alternative to loopback, a system generally has more than two comports, then connect both the commports with RS232 cable. Then for reading open one ttsy and for other another ttsy.
This will help you. |
Recent GIDBlog
Observations of Iraq by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| c program for rs232 interface | knallkopf66 | C Programming Language | 1 | 04-Mar-2004 10:03 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The