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.

MAX232 alternative for UART transmission

Status
Not open for further replies.

MrNobody

New Member
The link below show some of the alternatives for max232.
http://www.scienceprog.com/alternatives-of-max232-in-low-budget-projects/

I have tried the one using BC557 and BC337 transistor. I use it with PIC16F628A (running on internal oscillator) to transmit to PC (hyper terminal)..

However, the result is not good.. Maybe out of 10 tries, the computer only receive 1 time..

not sure whether is it because of the internal oscillator or because the UART alternative using BC557 and BC337 is not good..
anyway, does anybody know of a better max232 alternative which is low cost..?
 
Last edited:
If you're doing the RS232 in software, you can invert the data in the software, and you only require a single resistor to receive, and nothing at all to transmit - which is how the BASIC STAMP works.

How fast are you trying to run the RS232?, in my experience (over many years) 9600 baud is rock solid using the internal 628 oscillator.
 
The transistor version will only work reliably for half-duplex operation. If there is data being transmitted and received at the same time the data transmitted by your device may get corrupted.
 
Nigel Goodwin said:
If you're doing the RS232 in software, you can invert the data in the software, and you only require a single resistor to receive, and nothing at all to transmit - which is how the BASIC STAMP works.

How fast are you trying to run the RS232?, in my experience (over many years) 9600 baud is rock solid using the internal 628 oscillator.
I am using it in half duplex mode at 9600 baud.
What doews it mean by inverting the data in the software..? BTW, i am using Rx and RB1 (Rx) and RB2 (Tx)..
How do I connect the resistor..?
Maybe a diagram and an example might help me to understand what you are trying to say..
Hope it is not too troublesome..
Thanks in advance..
 
Unfortuneatly it's for CVASM but the idea is well explained in this old Parallax document on RS232.
 

Attachments

  • HWT3.PDF
    31.2 KB · Views: 492
Nigel Goodwin said:
It might be easier to find why your existing circuit isn't working?, try posting your software routines here.
i am using CCS C compiler..
The routine is very basic and simple.. When the PIC starts to run, it will display something on the LCD, delay for 10 seconds and then send something using UART. As it sends out via UART, it will also display something on the LCD so that i know that the data has been sent..

The program i write it is just to test the UART..

Code:
#include <16F628A.h>
#include <string.h>
#fuses INTRC_IO, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600,xmit=PIN_B2, rcv=PIN_B1)

void main ()
{
 char cX;
 char Str[16];
 char string1[10], string2[10];
 unsigned   int datainp;

delay_ms(5000);
puts("Str != ");
delay_ms(5000);
datainp = input_a();
LCD_PutCmd ( CLEAR_DISP );
printf ( LCD_PutChar, "ABC %d", datainp ); 
sprintf(Str, "ABC %d", datainp);
puts(Str);

while (1);

The LCD part is working so I didn't put the LCD code here..


Bill:
Thanks for the article.. will read it..
 
Last edited:
The 16F628A has a hardware UART, so you'll need the logic/level inverters.

Take a look at the schematic for the Firefly on my site for a working two transistor version. Same as the one on Gekos site.
 
Nigel,
When you say invert the data in the software, u mean i change the bit "1" to "0" and bit "0" to "1"..? for example, if I have 1 byte of data "10101010", i invert it to become "01010101" before I send it out..?
In doing this, I do not need to use any other components such as inverter gate or NAND gate..?
I only need to put 1 resistor (10K) between serial port (Pin 3 - TD) and PIC (RB1 - Rx) ..
Is it just like the picture below minus the zener diode and inverter gate..?
**broken link removed**
 
Yes, just like that, one resistor - but you can't do it if you use the hardware USART, you need to write software UART routines (like in my tutorial) where you can simply invery both transmit and receive (by changing BCF to BSF, BSF to BCF for the transmit routine).
 
Nigel Goodwin said:
Yes, just like that, one resistor - but you can't do it if you use the hardware USART, you need to write software UART routines (like in my tutorial) where you can simply invery both transmit and receive (by changing BCF to BSF, BSF to BCF for the transmit routine).
Oh.. i don't know assembly language..
how can i do it in C..? maybe in CCS C..?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top