I had a pcb built that is simple in design. On the basic level it is a board that holds a 18F4550 PIC and it gathers input from an IR sensor and the board contains a simple power supply setup. All operating at 5v. When I check the voltages of the pin pads without the PIC (I.E. using a volt meter with power turned on and testing the PIC pin sockets) the voltages to the pins are correct all pins are at 0 volts except for the MCLR pin which is tied High and VDD which is at 4.95 volts or so due to a 10k resistor. When I place the pic in the socket and turn the power on alot of the pins are reading at .05v not 0v. When trying to read input from the pins it says there high due to the .05v on the pins which isn’t good as they should remain 0v.
I know the code works as when the pic sits an a P40 Development board it works as expected.
Any Ideas why the pins have a small voltage coming out when the PIC is in the socket and not when it is out?
Does it work in the PCB? Unused pins should be made outputs, or tied high or low if left as inputs. If they are left as inputs you can expect a small voltage on them when you check them with a meter.
something isn’t right. .05V (50 mV) will be seen as a low. Check the datasheet for Max Vil - it’s .8V (for Vdd = 5) for TTL and .2V for schmitt trigger inputs.
I have setup the board for connections to USB (Not entirely still missing a few lines but its not being used anyway.) I have a setup for an external oscillator but right now im using the internal oscilator on the PIC. And I have lines going out for a connection to an NRF24L01.
I can e-mail someone the board files from eagle if it would help?
By the way, don’t go by biglez’s rule of thumb. Use the datasheet (or what i wrote earlier - that’s directly from the datasheet) to determine max V input low and min V input high. That’s the authority. Somewhere you’ve gotten on the wrong track.
I suspect your code is wrong. You are running code on the PIC in the board, aren’t you?
Correct Im running the code on the PIC on the board. What leads me to believe it is the board is the PIC acts as it should when it is sitting in the development board. All the code does is check to see if
PORTDbits.RD6 ==1 then turn on an led. Whats weird is when I turn on the power it will sit with the LED off for a little while then the LED will suddenly turn on.
So, you don’t have the pin actually connected to something? other than maybe a switch?
CMOS inputs need to be tied to a specific voltage or they will take stray emi and float to some random level. Typically, there is a resistor used to pull the input either high or low. A pull up resistor of say 10K will keep the port at a high level unless it is connected (i.e. pulled) to ground. let me guess, you just connected a switch from +5 to the port pin. use a 4.7K- 100K resistor to pull the pin to ground. When you close the switch, it will pull it high. When the switch is open, it will stay low.
Some ports of the PIC have “weak pull ups” that you can turn on but you will need to connect the switch to ground. Open is high, closed is low.
I have discovered that if i set any pin as an input pin and take a 5v line and make it high It seems as though the PIC will reset it self. I have tied the MCLR Pin to 5v+ with a 10k resistor on the board. I don’t have an oscilliscope so I can’t use that to see what the problem is. Any Ideas?