View previous topic :: View next topic |
Author |
Message |
arrow
Joined: 17 May 2005 Posts: 213
|
Input H value? |
Posted: Wed Jul 05, 2006 10:28 am |
|
|
Hi
I am using the PIC16F873, and I have an input to PIN_B5. The input is the same as an output from another microcontroller (I dont know which one), and is connected to a R and an LED. This unknown uC is running on 3.2V. My PIC is running on 5V.
I would like to monitor when the LED controlled by the unknown uC turns ON. I am using:
Code: |
if(input(PIN_B5)){
....
}
|
My PIC does not pick up when the LED goes on. Has this got something to do with level of H?
Can someone please tell me what I am doing wrong?
Thank you
a. |
|
|
epideath
Joined: 07 Jun 2006 Posts: 47
|
|
Posted: Wed Jul 05, 2006 12:44 pm |
|
|
3.2V should be enough to input as a HIGH value. My PIC communicates to a 3.3v MMC without problems. PIC runs on 5V. There might be something else going on with your code or wiring.
Regards |
|
|
Ttelmah Guest
|
|
Posted: Wed Jul 05, 2006 3:06 pm |
|
|
Agreed, it should work. Pin B5, has a TTL input buffer,which requires just 2v, to be seen as 'high', when running off a 5v supply. The 'odds' are that the output is not actually getting anywhere near the 3.3v level, because of the LED load, and this may be the problem. You need to check with a scope/meter, what voltage is actually arriving at the PIC. Remember the gounds need to be connected together as well, for this to work.
Best Wishes |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Wed Jul 05, 2006 6:01 pm |
|
|
The LED, probably, has a resistor connected in series. Could it be that you are connectin the PIC to the resistor, instead of the actual pin on the uC? |
|
|
arrow
Joined: 17 May 2005 Posts: 213
|
|
Posted: Wed Jul 05, 2006 10:20 pm |
|
|
Hi
Thank you for all your replies.
Yes, I am connecting PIN_B5 to the Resistor and not the uC pin (is this important?).
I have also checked with an Oscope what comes in on PIN_B5
and it is 3.2V.
So I am not sure what I am doing wrong.
Once again thank you- and back to the debugging.
a. |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Thu Jul 06, 2006 1:30 am |
|
|
arrow wrote: | Yes, I am connecting PIN_B5 to the Resistor and not the uC pin (is this important?). |
Since you are reading 3.2V on the pin of a PIC, it's not important, whether you are connected to the pin of the other uC directly of through a resistor.
Some usual (stupid) questions:
- How do you know that your PIC doesn't pick up?
- Do you poll your incoming signal often enough?
- Could you post some more of your code? What happens inside the if(input(PIN_B5)) statement that you have posted originally? Does the code get to this if-statement? |
|
|
|