+ Reply to Thread
Results 1 to 7 of 7

Thread: sending a constant LOGIC HIGH from pc to max232

  1. #1
    qtommer Newbie
    Join Date
    Jan 2009
    Posts
    95

    Default sending a constant LOGIC HIGH from pc to max232

    *this question might require the need of one well versed in visual basic as it has abit of programming involved

    i want to send out a constant LOGIC 1 to the serial port.
    The reason i want to do this is because I would like to turn on an LED connected to the output of a MAX 232 driver whenever i press the transmit command button in visual basic using MSComm

    the block diagram is as follows:
    PC------> MAX232--------> LED

    I understand that the voltage stream coming out of MSComm to the serial port is coded in ASCII and therefore I have to refer to the ASCII table.



    My questions are:
    1.I noticed that the ASCII Table does not have a character with a hex value of $FF. How can i output a character that has a value of $FF so i can turn on the LED?
    2. Seeing that the ASCII table has a $o character, i inverted the polarity of the LED ( Negative TO TTL output pin while the positive pin is connected to +5V with a resistor in series) and tried the following code ( so that a 0V will appear at the output TTL pin causing the LED to light up.


    Private Sub Form_Load
    MSComm1.CommPort=9
    MSComm1.PortOpen=True
    MSComm1.Settings="9600,N,8,1"
    MSComm1.SThreshold=1
    End

    Private Sub cmdTransmit_Click
    Do while(1)
    MSComm1.Output=Chr$(0)
    Loop


    but it didnt work...Is it at this part that my attempt is wrong?

    I also noticed thru my DMM that during an idle state of no transmission by the MSCOmm, the voltage output from the serial port is Logic 1(-6V)
    and the output of the max232 TTL driver is 0V...shouldnt the output be 5V denoting a Logic 1? im using 1uF caps ...

    when i executed the above code which supposed to send a positive voltage of between +3 TO +12V to the serial port, the voltage reading at the serial port became -3V...

    is there any reason why this is happening? is my understanding of rs232 parameters correct? perhaps the capacitance values?


    help would be greatly appreciated.


  2. #2
    ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent
    Join Date
    Jan 2007
    Location
    Hampshire. England.
    Posts
    10,835
    Blog Entries
    13

    Default

    hi,
    I use VB.
    Outputting an 0xFF will not give a constant high on the TXD.

    Use a Control pin on the DB9 connector, either DTR or RTS.
    These can be set/reset from VB.

    PC serial port (RS-232 DE9) pinout and signals @ pinouts.ru

    EDIT:
    The output voltage swing from the PC serial port can be from +/-5V thru +/-15V.
    Last edited by ericgibbs; 11th June 2009 at 07:40 AM.
    Eric " Good enough is Perfect "
    I will NOT answer PM's requesting technical help, please use the Forum
    PIC tutorials: Nigel's www.winpicprog.co.uk/ Bill's: www.blueroomelectronics.com/

    Link to my Articles: http://www.electro-tech-online.com/a...icgibbs-55450/

  3. #3
    ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent
    Join Date
    Jan 2007
    Location
    Hampshire. England.
    Posts
    10,835
    Blog Entries
    13

    Default

    hi,
    Look at these two options for driving a LED.
    I prefer the transistor option.
    Attached Images
    Last edited by ericgibbs; 11th June 2009 at 07:47 AM.
    Eric " Good enough is Perfect "
    I will NOT answer PM's requesting technical help, please use the Forum
    PIC tutorials: Nigel's www.winpicprog.co.uk/ Bill's: www.blueroomelectronics.com/

    Link to my Articles: http://www.electro-tech-online.com/a...icgibbs-55450/

  4. #4
    MikeMl Excellent MikeMl Excellent MikeMl Excellent MikeMl Excellent MikeMl Excellent MikeMl Excellent MikeMl Excellent
    Join Date
    Mar 2009
    Location
    Utah
    Posts
    2,859

    Default

    Just a quick question: Are you talking about the serial data line on a standard PC port? If so, where is the Max232?

    Anyway, even if you could send a char that was FF or 00, there would still be a Start Bit, followed by 7 to 8 data bits, followed by one or two Stop bits, so if you hung a scope on the data line, you would see a complex waveform. Measuring that with a DMM is meaningless.

    You have already wired the led so that it is off while the data line is in the marking state. To turn it on, you will have to send FF or 00 continuously, not just once...

  5. #5
    Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent Pommie Excellent
    Join Date
    Mar 2005
    Location
    Brisbane Australia
    Posts
    6,805

    Default

    As mentioned by Eric, it is much easier if you use one of the control lines.

    You can control the RTS line with MSComm1.RTSEnable = True/False
    And the DTR line with MSComm1.DTREnable = True/False

    Mike.

  6. #6
    dougy83 Good dougy83 Good dougy83 Good
    Join Date
    May 2008
    Location
    Brisbane, Australia
    Posts
    756

    Default

    If you want to control the state of the TXD line in the same manner as the other control lines, you can set/reset the break property i.e. MSComm1.Break = true/false will make TXD stay in the non-idle/idle state.

  7. #7
    ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent ericgibbs Excellent
    Join Date
    Jan 2007
    Location
    Hampshire. England.
    Posts
    10,835
    Blog Entries
    13

    Default

    Quote Originally Posted by dougy83 View Post
    If you want to control the state of the TXD line in the same manner as the other control lines, you can set/reset the break property i.e. MSComm1.Break = true/false will make TXD stay in the non-idle/idle state.
    Nice call on the BREAK command.
    Eric " Good enough is Perfect "
    I will NOT answer PM's requesting technical help, please use the Forum
    PIC tutorials: Nigel's www.winpicprog.co.uk/ Bill's: www.blueroomelectronics.com/

    Link to my Articles: http://www.electro-tech-online.com/a...icgibbs-55450/

+ Reply to Thread

Similar Threads

  1. constant voltage, constant current Lead Acid Battery Charger
    By Erwin_Macaraig in forum Micro Controllers
    Replies: 1
    Latest: 4th October 2008, 12:26 AM
  2. 5V Logic Level with High Current
    By Suraj143 in forum General Electronics Chat
    Replies: 11
    Latest: 25th September 2007, 03:36 PM
  3. 7v low, 24v high to cmos logic?
    By schrodingerscat in forum Electronic Projects Design/Ideas/Reviews
    Replies: 13
    Latest: 24th July 2005, 10:20 AM
  4. Need to raise low voltage to logic high
    By roffee in forum Electronic Projects Design/Ideas/Reviews
    Replies: 1
    Latest: 25th February 2004, 02:43 AM
  5. logic output HIGH from 5V to 12V
    By bogdanfirst in forum General Electronics Chat
    Replies: 8
    Latest: 29th July 2003, 12:49 PM

Tags for this Thread