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 CCS Technical Support

Tx dead or wot!
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
wolverine_349



Joined: 07 Dec 2005
Posts: 6

View user's profile Send private message

Tx dead or wot!
PostPosted: Wed Dec 07, 2005 1:30 pm     Reply with quote

My project involves RS-232 communiaction between pic16f689 and the PC.I m using H11L1 driver IC for providing schmiitt trigg.signal to the pic(Rx) and another H11L1 for converting TTL from the pic to RS-232 signal(Tx).The pic is able to receive data entered via terminal.But I haven't been able to receive
data from the pic.I have already tested if the pic is receiving data by putting data onto the LCD and it works.Wish the Tx was working too.i read the TXREG reg. on the LCD and it shows the 1st character that had to be transmitted,and the TSR is shown to be empty in the transmit status reg TXSTA. Is ther anyway i could trouble shoot the transmission from the pic. Would luv to have any kinda help on this.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 07, 2005 1:44 pm     Reply with quote

Post a small (but complete) program that shows how you are
transmitting data to the PIC. Also post more details about
the circuit you are using with the H11-L1 chip, such as what
Vcc voltage are you using, and are you using a series resistor
with the diode, etc. If you do this, more people will be able
to help you. Link to device data sheet:
http://www.fairchildsemi.com/ds/H1/H11L1-M.pdf
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Wed Dec 07, 2005 2:29 pm     Reply with quote

Quote:

I m using H11L1 driver IC for providing schmiitt trigg.signal to the pic(Rx) and another H11L1 for converting TTL from the pic to RS-232 signal(Tx).The pic is able to receive data entered via terminal.But I haven't been able to receive
data from the pic.


The problem is that RS232 data is bipolar
+3 to +12 Volts for "ON or 0-state (SPACE) condition" and
-3 to -12 Volts indicates an "OFF" 1-state (MARK) condition.

Using the H11L1 optocoupler the output always swing between 0 to +5V and this way the PC Comm Port never gets the OFF state.


Humberto
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 07, 2005 2:42 pm     Reply with quote

Quote:
The problem is that RS232 data is bipolar
+3 to +12 Volts for "ON or 0-state (SPACE) condition" and
-3 to -12 Volts indicates an "OFF" 1-state (MARK) condition.

That could be the problem if the PC uses strict RS232 levels.
But if it uses a MAX232 style chip or equivalent (which it probably does)
then 0 to 5v levels should work OK. See the bottom of page 2
on the MAX232 data sheet:
http://pdfserv.maxim-ic.com/en/ds/MAX220-MAX249.pdf

It says:
Code:
RS-232 RECEIVERS
                                   Typ      Max
RS-232 Input Threshold Low         0.8v     1.3v

RS-232 Input Threshold High        1.8v     2.4v
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Wed Dec 07, 2005 2:54 pm     Reply with quote

The problem he declare is that he can�t receive any data sent from PIC >>> to PC,
that�s why I think the problem is in the PC Comm RS232 levels.
I would not assume that the PC has a Maxim chip inside.


Humberto
wolverine_349



Joined: 07 Dec 2005
Posts: 6

View user's profile Send private message

PostPosted: Thu Dec 08, 2005 1:12 pm     Reply with quote

[quote="Humberto"][quote]


The problem is that RS232 data is bipolar
+3 to +12 Volts for "ON or 0-state (SPACE) condition" and
-3 to -12 Volts indicates an "OFF" 1-state (MARK) condition.

Using the H11L1 optocoupler the output always swing between 0 to +5V and this way the PC Comm Port never gets the OFF state.


Humberto u r right about 0-5V swing,but what i didnt mention is that the o/p
of the optocoupler is connected to a npn transistor having VCC tied to a 12V rail. The tx of the pic is connected to the cathode(on H11L1) through 1K res. and anode is 5V.the

***************-----------12v
***************** | |
**************560<***<10K
*****************<***<
*******220********|*** |
<-----^^^--- -------- |****|
to pc rx*********** \****|
**************npn***|----------------< o/p from H11L1(pin 4)
*****************< /
*******************|
*******************|
*******************:gnd p.s.--->IGNORE *


I tried using the INVERT option for #use rs232 becoz of the npn trans ,but to no avail.dis is drivin me real crazy.more so becoz m reading the txreg onto the lcd and its showing chars that i am transmitting.so,must be the driver not being able to produce a compatible rs232 signal.

i will put the code next time around ,although m pretty sure it works.i have tried printf,putc,putchar ....everything.does ne1 know a way out of this?
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Thu Dec 08, 2005 2:09 pm     Reply with quote

Are you trying to use the invert option on a hardware usart pin?

This is not possible.


Last edited by treitmey on Thu Dec 08, 2005 4:09 pm; edited 1 time in total
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Thu Dec 08, 2005 2:35 pm     Reply with quote

Quote:

Humberto u r right about 0-5V swing,but what i didnt mention is that the o/p of the optocoupler is connected to a npn transistor having VCC tied to a 12V rail. The tx of the pic is connected to the cathode(on H11L1) through 1K res. and anode is 5V.the


It doesn't matter the 12V. You are still generating only positive voltages.
As I told you in previous post, RS232 levels swing between a positive voltage and a negative voltage.

Quote:

I m using H11L1 driver IC for providing schmiitt trigg


The H11L1 is an optocoupler with a Schmitt trigger digital output, it is not a driver.
I strongly suggest to use the classic level converter MAX-232 or equivalent.
Do not reinvent the wheel ( Very Happy )

Pls read this regarding the level converter, RS232 voltages levels involved and so on.

http://www.beyondlogic.org/serial/serial1.htm#41

INVERT is applicable ONLY when the RS232 is handled by software UART.
as @treitmey point.

Humberto
Ttelmah
Guest







PostPosted: Thu Dec 08, 2005 3:22 pm     Reply with quote

It is worth looking at how other things handle this. You do not need much
-ve voltage. So you could use a 7660 capacitor charge pump to get the
-ve rail, or steal some voltage from one of the handshaking lines (this is a common trick' technique), or even charge a -ve capacitor from the PC's serial output line. If you want to save space, and can get them (Maxim, can at times be a 'pig' as a source), you could try the DS275, which combines two of these techniques, to give aout -4v, and is adequate for many applications. +/-3v, is what is really required to 'meet' the spec. The extra voltage is to guarantee this signal level over longer wires. Also the load impedance is quite low (nominally 3KR), so it may simply be that your circuit (which is illegible - use the 'code' control to prevent the text from being rejustified), does not actually get the signal even to 0v...

Best Wishes
Guest








PostPosted: Fri Dec 09, 2005 11:14 am     Reply with quote

hi all u guys, guess wot,tx wasnt dead afterall.i changed the H11L1 Vcc to 12v instead of 5V and voila!.now i finally have a full duplex communication Smile .but its @ a price.by now i have changed 2 of these H11L1 ICs cause they seem to be going dead n all this in 1 day.dat too my application requires round the clock communication.am burning some serious cash on these ICs.dunno wots causing it ,since it can take Vcc upto 16V.
The 560ohm resistor,i s\had shown in the last post, is heating up beyond normal operation ,so am getting my fingers getting burnt too along with all the cash.could ther be any specific reason?forgot to mention,its been happening even when h11L1 vcc was @ 5V.
even though am happy all z working ,i would like to fix these bugs b4 they fix me.btw thanks u guys for pitching in with all that support.

wolverine
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Fri Dec 09, 2005 4:51 pm     Reply with quote

Quote:

hi all u guys, guess wot,tx wasnt dead afterall.i changed the H11L1 Vcc to 12v instead of 5V and voila!.now i finally have a full duplex communication.


Please could you be more specific ? I mean, could you describe us the final circuit
you get and the swing voltages (?+ ?- ) in the RS232 side ?
You didn't mention anything regarding how did you get -V voltage needed to
run RS232 properly and in full duplex mode.
Reading your description I conclude that changing Vcc from 5V to 12V does the
magic. Idea Question Shocked

Humberto
Ttelmah
Guest







PostPosted: Sat Dec 10, 2005 9:20 am     Reply with quote

I'd guess that with the 12v supply, he was actually getting something like +2 to +12v 'out', and with the lower current drawn on the 5v supply, he is now getting perhaps +0.8 to 5v 'out', which is _just_ dropping the line low enough to now be seen by the PC.
As a comment to him, if you want this to be _reliable_ on anything beyond a very simple prototype system, stop 'fiddling around', and start generating signals closer to the proper RS232 levels. Otherwise it working, is basically 'luck'....

Best Wishes
wolverine_349



Joined: 07 Dec 2005
Posts: 6

View user's profile Send private message

PostPosted: Sat Dec 10, 2005 2:33 pm     Reply with quote

[quote="Humberto"]
Quote:

Please could you be more specific ? I mean, could you describe us the final circuit
you get and the swing voltages (?+ ?- ) in the RS232 side ?
You didn't mention anything regarding how did you get -V voltage needed to
run RS232 properly and in full duplex mode.
Humberto


I have switched back to 5V Vcc for H11L1 after changing the npn transistor ,i had shown in the 2nd post ,as i found it to be faulty.
From woteva info i have gathered, the npn transistor would act as an inverter and ,and provide the necessary RS-232 signals after it inverts the H11L1 o/p.This is purelyl theoretical.you will get it if u c the H11L1 datasheet and refer to the circuitry,i posted b4.Meanwhile i will find out the actual levels and let u know ,once i get 2 work.let ther b no magic then.i surely hope so. Smile

Right now as Ttelmah said,its all luck,n i totally agree.m good till it runs out. Wink
thank u all.

wolverine.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Sat Dec 10, 2005 3:29 pm     Reply with quote

Quote:

Right now as Ttelmah said,its all luck,n i totally agree.m good till it runs out.
thank u all.


Ok. I give up here. Idea Question Confused Exclamation

Humberto
neil



Joined: 08 Sep 2003
Posts: 128

View user's profile Send private message

PostPosted: Mon Dec 12, 2005 11:26 am     Reply with quote

A MAX232 Chip is comparable in cost to a schmitt and an NPN. The only solution is to do it properly and not to marvel at the fact that it works when it really shouldn't!!!!

How about looking here: http://www.ccsinfo.com/forum/viewtopic.php?t=25018

and the last few posts of this thread: http://www.ccsinfo.com/forum/viewtopic.php?t=25010

You can see from here why we get frustrated. Using PICs requires electronics knowledge as well as programming knowledge!

Neil.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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