|
|
View previous topic :: View next topic |
Author |
Message |
chancaar
Joined: 23 Mar 2004 Posts: 6 Location: Belgium
|
Voltage level problem |
Posted: Wed May 26, 2004 11:25 am |
|
|
Hello,
I'm using a 16F877 to communicate with a RS-232 serial connector. When I measure at the output of the MAX233 (which transformes the level to TTL for the pic) I can detect 0V or 5V, which is perfect! Omce I connect an input of the PIC to the output of the MAX233, The voltage level will not go lower than 2V and I will never detect a "0"... The pen which is connected to the output of the MAX233 is configured as an input so, I don't think I did something wrong!
The pin I use is "RD5/PSP5"
as an input by using: "set_tris_d(0b00100000);" (1 = input, right?)
When I don't connect the pic, The level is perfect: 0V or 5V...
Can somebody help me? _________________ Yves Willemaers
Belgian student |
|
|
Ttelmah Guest
|
Re: Voltage level problem |
Posted: Thu May 27, 2004 4:59 am |
|
|
chancaar wrote: | Hello,
I'm using a 16F877 to communicate with a RS-232 serial connector. When I measure at the output of the MAX233 (which transformes the level to TTL for the pic) I can detect 0V or 5V, which is perfect! Omce I connect an input of the PIC to the output of the MAX233, The voltage level will not go lower than 2V and I will never detect a "0"... The pen which is connected to the output of the MAX233 is configured as an input so, I don't think I did something wrong!
The pin I use is "RD5/PSP5"
as an input by using: "set_tris_d(0b00100000);" (1 = input, right?)
When I don't connect the pic, The level is perfect: 0V or 5V...
Can somebody help me? |
First, have you set '#use fast_io(D)'?. Unless you do, the compiler will override your TRIS settings, if it thinks you are using the pin as an output (what does your #use RS232 statement say?).
If this does not fix the problem, try the experiment of removing the PIC, and connecting a pull up resistor between the signal line, and +5v, of perhaps 10K, and re-testing the voltage. I'd suspect that the fault is either that the MAX233, does not have a good ground, and so when the load of the PIC input is present, can no longer pull the signal down, or the chip itself may have damage to the pull-down transistor on the output.
Best Wishes |
|
|
chancaar
Joined: 23 Mar 2004 Posts: 6 Location: Belgium
|
|
Posted: Mon May 31, 2004 8:17 am |
|
|
I define the "d" port like this:
set_tris_d(0b11101111); (D4 as an output, D5 as an input)
I use next statement:
#use rs232(baud=9600,bits=8,parity=N,xmit=PIN_D4,rcv=PIN_D5)
The ground is well connected.
The strange thing is: It works with another pen (PIN_B5)
In the datasheets I can see that this B5-pen is a normal pen without extra "features". The PIN which does't work (which doesn't reach the 0 voltage level) is defined as : RD5/PSP5 (ST/TTL). _________________ Yves Willemaers
Belgian student |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Mon May 31, 2004 8:52 am |
|
|
1) disconnect pic from MAX233 chip. Tie TX pin on MAX233 to +5V through 10K (or similar value) resistor. Did corresponding pin on MAX233 go to -9V (or whatever value you read on the MAX233's V+ pin)? Tie the TX pin on the MAX233 to ground through the same resistor. Did the output pin swing to +9V? If so then the MAX233 is probably OK
2) Now look only at the PIC. Is your transimit pin able to toggle between 0V and +5V OK? Use an oscilloscope to watch the pin. It should have nice sharp edges during the transition. This is assuming you haven't picked a pin that is really an open-collector output. There are a few of those on the PIC. If that is the case then the edges will look sloppy and slow and the output level may never reach +5V.
3) RJ is right, are you using #fast_io()? You didn't answer him, you only repeated your tris_a() statment. That statement doesn't do you any good unless you also have #fast_io(). _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
|
|
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
|