Recloser Control: PC Programming for 9 Pin RS232 Port

  • Thread starter Thread starter dark021
  • Start date Start date
  • Tags Tags
    Control
Click For Summary

Discussion Overview

The discussion revolves around programming a controller for a recloser using a PC via an RS-232 9-pin port. Participants explore various programming languages and methods to interface with the recloser, addressing both theoretical and practical aspects of hardware programming.

Discussion Character

  • Exploratory
  • Technical explanation
  • Homework-related
  • Debate/contested

Main Points Raised

  • Some participants inquire about suitable programming languages for interfacing with RS-232, with mentions of Tcl/Tk and BASIC.
  • Others suggest that VB.net can be used to control the RS-232 port, asking for specific instructions on sending signals.
  • There is a discussion about the voltage levels of RS-232 signals, with some stating that PCs typically output +/-12V, while others mention the minimum standard of +/-5V.
  • Participants express a need for reference materials and guidance on checking voltage levels and controlling RS-232 pins.
  • Some share code snippets and ask for explanations of the code, indicating a lack of understanding of how the code operates.
  • Questions arise regarding the specific pins of the DB-9 connector that send -5V/+5V signals, with some participants suggesting that others should conduct their own research on RS-232 basics.

Areas of Agreement / Disagreement

There is no consensus on the best programming approach or the specifics of RS-232 pin functionality, as participants express varying levels of knowledge and understanding. Multiple competing views on programming languages and methods remain present.

Contextual Notes

Participants express uncertainty regarding the electrical characteristics of RS-232 and the specific implementation details for their applications. Some discussions reference the need for further research on basic RS-232 functionality.

Who May Find This Useful

This discussion may be useful for individuals interested in hardware programming, specifically those working with RS-232 interfaces in control systems or SCADA applications.

dark021
Messages
7
Reaction score
0
I'm new to Hardware programming, Can you give me an idea on how to create a controller on recloser via PC?? The recloser has a rs232 Port, and its a 9 pin.. Thanks... i need it badly thank you
 
Engineering news on Phys.org
dark021 said:
I'm new to Hardware programming, Can you give me an idea on how to create a controller on recloser via PC?? The recloser has a rs232 Port, and its a 9 pin.. Thanks... i need it badly thank you

What languages are you comfortable programming the PC in? Most languages will have an interface to the RS-232 COM ports -- I've used Tcl/Tk before to interface to an RS-232 device from a PC.
 
You can even interface to a serial port with BASIC. Use the OPEN "COMn: [baud] [,parity][,data][,stop][options] AS [#] filenum [LEN=num]
 
berkeman said:
What languages are you comfortable programming the PC in? Most languages will have an interface to the RS-232 COM ports -- I've used Tcl/Tk before to interface to an RS-232 device from a PC.



Can I used Vb.net on that?? what devices did u use?? can u give me a step by step instruction on controlling the pins of the Rs232?.. The real deal is i have to sen atleast 5V on rs232 going to the recloser.. thank you again..
 
dark021 said:
Can I used Vb.net on that?? what devices did u use?? can u give me a step by step instruction on controlling the pins of the Rs232?.. The real deal is i have to sen atleast 5V on rs232 going to the recloser.. thank you again..

Your PC will output +/-12V on the RS-232 signals. The minimum to meet the standard is +/-5V, I believe.

Yes, you should be able to write to the COM port using VB.net. Just look in the Help files or other instructional materials you have to see the format used for opening, writing, reading and closing the COM port.
 
berkeman said:
Your PC will output +/-12V on the RS-232 signals. The minimum to meet the standard is +/-5V, I believe.

Yes, you should be able to write to the COM port using VB.net. Just look in the Help files or other instructional materials you have to see the format used for opening, writing, reading and closing the COM port.

i admit i m an idiot on this one,, can u give some reference books regarding on this? how will i check if 5volts is flowing on my Cable? Can I also control the PINs of the Rs232 port? thanks again...
 
i have this following codes.. i don't understand them... can u xplain them..

Const Xon = &H11
Const Xoff = &H13

Private Sub Command1_Click()
MSComm1.Output = "123456789" & Chr$(Xoff)
End Sub

Private Sub Command2_Click()
MSComm1.Output = "987654321" & Chr$(Xon)
End Sub

Private Sub Form_Load()
Form1.Caption = "App1"
With MSComm1
.Handshaking = 2 - comRTS
.RThreshold = 1
.RTSEnable = True
.Settings = "9600,n,8,1"
.SThreshold = 1
.PortOpen = True
End With
Command1.Caption = "&Send Xoff"
Command2.Caption = "Send &Xon"
End Sub

Private Sub Form_Unload(Cancel As Integer)
MSComm1.PortOpen = False
End Sub

Tnx
 
  • #10
dark021 said:
Is the syntax com1-com9 are direct address to the pins of RS232?
tnx

Not usually. In the PC COM port context, COM1 and COM2 are usually two separate DB-9 connectors on the back of the PC. COM3-COMn are logical overloads of these two ports, and to be honest, I've never understood them very well. If you want to talk to an RS-232 device, just use the COM1 port, and connect the cable to your device to the DB-9 in the back of your PC labeled COM1.
 
  • #11
I've included relevant comments for your VB code:

dark021 said:
// Sets constants Xon to hexadecimal 11 and Xoff to hexadecimal 13
Const Xon = &H11
Const Xoff = &H13

//Declares a subroutine for an event handler when button Command1 is clicked
Private Sub Command1_Click()
// Writes the string "123456789" to the output buffer of the comm port MSCOMM1
// with Xoff masked in.
MSComm1.Output = "123456789" & Chr$(Xoff)
End Sub

//Declares a subroutine for an event handler when button Command2 is clicked
Private Sub Command2_Click()
// Writes the string "987654321" to the output buffer of the comm port MSCOMM1
// with Xon masked in.
MSComm1.Output = "987654321" & Chr$(Xon)
End Sub

// Form load event code
Private Sub Form_Load()
// Sets the form caption
Form1.Caption = "App1"
// Initializes parameters for the MSComm1 comm port
With MSComm1
.Handshaking = 2 - comRTS
.RThreshold = 1
.RTSEnable = True
.Settings = "9600,n,8,1"
.SThreshold = 1
.PortOpen = True
End With
// Sets the button text for Command1 with "S" as the shortcut
Command1.Caption = "&Send Xoff"
// Sets the button text for Command2 with "X" as the shortcut
Command2.Caption = "Send &Xon"
End Sub

// Forum unload (application close) event handler
Private Sub Form_Unload(Cancel As Integer)
// Closes the comm port MSComm1
MSComm1.PortOpen = False
End Sub
 
  • #12
negitron said:
I've included relevant comments for your VB code:

which of the pins of the rs232 db9pin send -5v/+5v?
 
  • #13
dark021 said:
which of the pins of the rs232 db9pin send -5v/+5v?

Why don't you tell us? There are better sources on the web for very basic information like how an RS-232 port works electrically. I would prefer that you do that research first, and then ask us questions if you don't understand what you are researching and reading. Please also provide web pointers to what you are reading and not understanding.

Google is your friend -- learn to use it well. Also, wikipedia.org is a fairly good source of information, as long as you remember that it is publicly-run and anybody can modify the information on it. For basic stuff like RS-232 DB-9 voltages, it's a good place to start:

http://en.wikipedia.org/wiki/RS-232

.
 
  • #14
berkeman said:
Why don't you tell us? There are better sources on the web for very basic information like how an RS-232 port works electrically. I would prefer that you do that research first, and then ask us questions if you don't understand what you are researching and reading. Please also provide web pointers to what you are reading and not understanding.

Google is your friend -- learn to use it well. Also, wikipedia.org is a fairly good source of information, as long as you remember that it is publicly-run and anybody can modify the information on it. For basic stuff like RS-232 DB-9 voltages, it's a good place to start:

http://en.wikipedia.org/wiki/RS-232

.


But i don't understand them.. i need someone to explain them to me.. that s why i ask u guys.. and thanks for replying on some of my messages... The real problem is this... My company ask me to create a SCADA system for electric utility. My strategy is before i can create the SCADA i need to control first the Recloser on an electric substation, i need to send signal from a remote area to the recloser. the recloser has RS232 connection and an ethernet connection(RJ45 connection) that's is why I'm studying the pins of the rs232..the sad part is that i don't understand them.. I am not an engineer..im just a web programmer..
 
  • #15
You don't need to understand them; you need only understand how to send data out of the port and how to receive data in. You don't need to know how a VCR works inside in order to program it to record a TV show. Presumably, your recloser controller has a user manual which contains the instructions you need to perform various functions and how it reports back its status and such. Start with that, then design an algorithm to do what the recloser manual tells you needs to be done. Presumably, you're going to be connecting the PC to the recloser with an RS-232 serial cable, so you don't need to know what pins do what. You handle all that transparently via software. Learn how to open, read from and write to a COM port using whatever language you're going to be using; the operating system will handle the gritty hardware-level details for you.
 
  • #16
dark021 said:
the sad part is that i don't understand them.. I am not an engineer..im just a web programmer..

I agree 100% with negitron's reply. But beyond that, I have a fundamental problem with your thread. A recloser involves life safety:

http://en.wikipedia.org/wiki/Recloser

and you are saying that you have been tasked with programming Auto Reclosers. And, to be blunt, you appear to have very little practical knowledge of programming COM interfaces and real-time embedded systems.

We will not help you learn how to program life safety level systems here -- you need to take classes and receive certifications to do that.

This thread is closed, per the PF Rules link at the top of the page.
 

Similar threads

Replies
17
Views
1K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K
Replies
37
Views
7K
Replies
3
Views
2K
  • · Replies 20 ·
Replies
20
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
2
Views
2K
Replies
80
Views
5K
  • · Replies 3 ·
Replies
3
Views
2K