Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

sending a constant LOGIC HIGH from pc to max232

Status
Not open for further replies.

qtommer

Member
*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.
 
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:
hi,
Look at these two options for driving a LED.
I prefer the transistor option.
 

Attachments

  • esp04 May. 09.gif
    esp04 May. 09.gif
    2.4 KB · Views: 10,105
  • esp05 May. 09.gif
    esp05 May. 09.gif
    3.9 KB · Views: 397
Last edited:
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...
 
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.
 
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.
 
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.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top