Bob Ammerman [RAMMERMAN at PRODIGY.NET] of RAm Systems says:
Here is a neat trick to get a 'push-pull' output from two PORT A pins:
1: define them as analog (ADCON1)
2: TRIS them as outputs.
Now, when you BSF either of them the other will automatically be cleared.
Andrew Warren says:
Of course, if you can't configure the pins as analog inputs (because, for instance, the PIC you're using doesn't HAVE an A/D converter), you can do this:MOVLW 00000001B ;RA0 = 1, RA1 = 0. MOVWF PORTA ; MOVLW 00000011B XORWF PORTA ;Toggle RA0 and RA1. XORWF PORTA ;Toggle the two pins again. XORWF PORTA ;And again...
Or, if those two pins are the only ones defined as outputs on that port:MOVLW 00000001B ;RA0 = 1, RA1 = 0. MOVWF PORTA ; COMF PORTA ;Toggle RA0 and RA1. COMF PORTA ;Again. COMF PORTA ;And again...
and Engdahl did something similar in a line buffer circuit
but he was using an external power source for extra juice so the amplifier
type would have to be changed from emiter follower to a voltage gain amp.
They did not use RTS as a source of +12 volts, connecting the transistor
to +Vcc (local +5 volts) instead. My thinking is that if RTS isn't at +12,
the peripheral shouldn't be sending anyway. In fact, if I bias this correctly,
setting up the TX pin as an input would allow the periperal to read the RTS
status without needing another IO pin. That would be cool, but Jeff Frohwein
says ``it doesn't appear to me that it would work. It appears to me that
the transistor would always be on ...'' forcing TxD to always be Hi no matter
what data we're trying to transmit on TX.
Here is a circuit and board in Eagle and a picture of the circuit.
Take the higher voltages from the RS232 port. T1,T2 & T4 may be almost any npn low power transistors (eg. BC107). T3 almost any pnp low power transistor with UCEmax >=30V (eg. BC177). Using of switching transistors is however recommended. Diodes - almost any low power impulse diodes.
|file: /Techref/io/serial/ttl2rs232.htm, 7KB, , updated: 2010/12/10 19:52, local time: 2014/3/11 06:51,
|©2014 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://www.piclist.com/techref/io/serial/ttl2rs232.htm"> TTL to RS232</A>
|Did you find what you needed?|
Ashley Roll has put together a really nice little unit here. Leave off the MAX232 and keep these handy for the few times you need true RS232!
Welcome to www.piclist.com!