Results 1 to 9 of 9

Thread: RS-232 Information

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jun 1999
    Location
    palmdale, ca. USA
    Posts
    150

    Question

    Hi VB Type people,,...

    I am thinking of taking on the task of writing a tank guaging program in VB6.

    What I need is some resources for RS-232 devices.

    The oil/fuel tanks that I will be writing the program for receive send their information through a PLC (programmable logic control??)

    Anyone know of any resources for RS-232 device interfacing with VB programs?

    I hope I am stating all the correctly.

    thanks,
    kevin rea

  2. #2
    Member
    Join Date
    Feb 2000
    Location
    Toronto, Canada
    Posts
    44

    Do your research first

    To read\write data through the serial port via Visual Basic, you must include the component Microsoft Comm Control 5.0 in your project. Read the help files on how to use this control. There are some examples, but I would not rely on them for a complete "picture" on how to use this control.

    Your manual for your PLC should tell what commands or signals to use for interfacing it to your computer.

    *I did not know PLC's have the capability to collect information. I thought PLC's was a glorified set relays and timers. I must be getting behind in the new technology.

    I know there isn't very much help on serial communication in VB. I can offer more explainations or my own example program if you need it.
    Sacred_Knight
    Electronic Technologist
    E-Mail: [email protected]

    He who laughs last, laughs later.

  3. #3
    Member
    Join Date
    Nov 1999
    Location
    Manila, Philippines
    Posts
    59

    Smile

    There are dlls that can directly read and write to your parallel port. You need to this dlls just like the way you use APIs. Actually, its an API but does not come with windows. you can search for inpout.dll. I'm sorry, i don't have my copy already. I just lost it but there's a lot out there. hope this help.

  4. #4
    Member
    Join Date
    Feb 2000
    Location
    Toronto, Canada
    Posts
    44
    orasbot,

    He was asking information on serial ports not parallel port communication.

    But you did bring up a good point, using API calls for communication. API's are avaliable for communicating, but would not recommend it if you are new at serial communication, not familiar API calls, or you are new at VB programming. The advantage of using API is you will have one less control in your project, which reduces your program size. It also generally more efficient.

    When to use API instead of MScomm control?

    Personally, I would use API if I had a simple communication task or I only needed a few MSComm control properties or methods. For example, reading a measurement from an electronic scale. If however you wanted to tranfer large amounts of data securely, I would use the MSComm control. I would need most of MSComm control's methods and properties, so why would I want to recreate an MSComm control using API? Another reason to use API is if you are tight for file space. For example, Let say your project has to be contained on a single floppy.

    Sacred_Knight
    Electronic Technologist
    E-Mail: [email protected]

    He who laughs last, laughs later.

  5. #5
    Guest

    Lightbulb

    Instead of using API calls you could just write to the parallel port as if you were writing to a file sequentially. For more information look in the help for 'sequential files'.

    You could look at http://www.rentron.com for information on communicating with other devices through the serial port.

  6. #6
    Member
    Join Date
    Feb 2000
    Location
    Toronto, Canada
    Posts
    44
    spiffle2k,

    I visited rentron.com and I must say it lacked information. Infact, there is no real useful information on programming or the fundementals of serial communication. All that I saw was a website advertising an ActiveX control that claims to simplify serial communication. In my Opinion, it is a waste of money. All the features in that ActiveX control can be easliy made by the programmer in no time. The other features like;

    Adjustable terminal window, [during design-time].
    Full data logging capabilities.
    Date & Time stamp when log-file is opened.
    Fully customizable, [during design-time].

    are, in most applications, not needed. I think they added these features as fillers, they wanted it to make the control "look" full features that you need. Why would anyone want to pay for this control?

    The website does recommend some books, but thats as close as you get to finding useful information on serial communication.

    Sacred_Knight
    Electronic Technologist
    E-Mail: [email protected]

    He who laughs last, laughs later.

  7. #7
    Member
    Join Date
    Nov 1999
    Location
    Manila, Philippines
    Posts
    59
    sacred_knight, as far as i know, parallel port is an RS-232. I used this in communicating with my hardware projects when i was in college. With regards to PLC connecting to PC, i would suggest using the parallel port since you can process a lot more bits of data than the serial port. Also, you can use it for bi-directional communication which is basically vital in programming a PLC. In using the COM ports, you have to consider the baud rate and you get information bit by bit.


    orasbot

  8. #8
    Addicted Member
    Join Date
    Oct 1999
    Location
    Dallas,TX
    Posts
    170
    Parallel port are in no way similar to serial port communication. Parallel ports require direct I/O programming. Parallel and serial are two very differnt animals. Serial in its most purist form sends data out on two lines (8 bits shifted out or in sync'd to the clock). Parallel puts the whole 8 bits out. Anywho, parallel port programming is slower (in most cases) than serial and VB does not ship with an easy method for I/O port addressing which parallel requires.

    Stick with the MSComm control. The programming of it is very very straight forward. I use it for all of my VB/Hardware designs. Anywho, here is a very basic setup, but I deffinatly would recommend looking over MSDN:


    With MSComm1
    .CommPort = 1 'Sets Com Number
    .Settings = "9600N,8,1" 'Sets 9600 Baud, No Parity, 8bits, and 1 stop bit
    .InputLen = 1 'Sets How many characters to fetch on Recieve
    .DTREnable = False 'Disables DTR Protocal
    .RTSEnable = False 'Disables RTS Protocal
    .RThreshold = 1 'Specifies How many bytes must be recieved before firing OnCOMM()
    .SThreshold = 1 'Specifies How many bytes must be transmited before firing OnComm()
    .PortOpen = True 'Opens Port
    End With



    This sets up the com port. The protocals you use will vary depending on hardware. The buffer sizes may vary for you. The number InputLen may vary..etc etc. Know your hardware first and read the information in MSDN.


  9. #9
    Member
    Join Date
    Feb 2000
    Location
    Toronto, Canada
    Posts
    44
    orasbot,

    I am 100% correct. RS232 is a standard for serial communication. Check out this website to help you clarify this point. http://www.beyondlogic.org/

    As for connecting the parallel port to PLC, this is not a choice the programmer has. Most PLC that I know only have serial communication option. Infact, other than printers, I don't encounter that many devices that use parallel communication. Most commonly used communication option between two devices are RS232 and IEEE.
    Sacred_Knight
    Electronic Technologist
    E-Mail: [email protected]

    He who laughs last, laughs later.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width