CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Is MAX232 chip required??

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
weg22



Joined: 08 Jul 2005
Posts: 91

View user's profile Send private message

Is MAX232 chip required??
PostPosted: Tue Jan 23, 2007 2:31 pm     Reply with quote

Hi all,

I am using the MaxSonar EZ-1 ultrasonic sensor. It outputs data in RS232 format. According to the 2nd page of the datasheet (see below), the RS232 voltages range from 0-5V and not -12V to 12V. Therefore, shouldn't I be able to grab data from it without using a MAX232 chip?

http://www.superdroidrobots.com/product_info/MaxSonar-EZ1-Datasheet.pdf

I was able to get data from it without any problems when integrating my PIC with a MAX232 chip, but when I hook it up directly to the PIC I get a bunch of weird ASCII characters.

Thanks in advance,
-weg
frequentguest
Guest







PostPosted: Tue Jan 23, 2007 2:53 pm     Reply with quote

Just a quick off-the-top-of-my-head answer without looking at the datasheet. Could the signals be inverted?
weg22



Joined: 08 Jul 2005
Posts: 91

View user's profile Send private message

PostPosted: Tue Jan 23, 2007 3:10 pm     Reply with quote

What signals are you referring to? Are you suggesting that my Tx and Rx lines are reversed? If so, this is not correct or I wouldn't be seeing any data coming in.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue Jan 23, 2007 3:19 pm     Reply with quote

The usual MAX232 chip inverts the 0's and 1's. If you are using a software UART you can specify INVERT in the users232 setup line. Otherwise you can use any normal logic inverter.
_________________
The search for better is endless. Instead simply find very good and get the job done.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jan 23, 2007 3:37 pm     Reply with quote

Look at their FAQ page. Scroll about 40% of the way down the page
to the section on "TX output", where they show a photo of a DB-9
connector.
http://www.maxbotix.com/MaxSonar-EZ1__FAQ.html
They say that the unit connects directly to the PC with a serial cable.
This means that the sonar unit has the equivalent of a MAX232 circuit
inside it (even though it uses 0 to 5v levels instead of -12v to +12v).

To amplify Sherpa Doug's comments, this means that if you use
the hardware UART in the PIC, then you must add an external inverter
chip to the Tx and Rx signals (a chip such as a 74HC04 or 74HCT04).

If you use a software UART, then you must use the INVERT option in
the #use rs232() statement. The hardware UART can't use the INVERT
option. It only works with a soft UART.
weg22



Joined: 08 Jul 2005
Posts: 91

View user's profile Send private message

PostPosted: Tue Jan 23, 2007 3:41 pm     Reply with quote

Yep, that was it! Used the INVERT option and it worked perfectly! Thanks Sherpadog and PCM.

-weg
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group