Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Breadboard and my microcontroller.

Status
Not open for further replies.
I moved the crystal a lot closer to the PIC and removed the wires connecting it. Although this did not change anything. The PIC still will not work if I don't put some sort of load on any of the pins and hold it high. I still cannot put capacitors in the circuit or it stops working. I checked for any short circuits with my multimeter and it is ok. I changed the LEDs and resistors to lower the current drawn from them. Nothing is helping :(

I do have normal insulated wire, but I don't use it on breadboards. It is messy, tinned wire does the job perfectly. The circuit works as it is, but without capacitors and I need to hold a pin high.
 
I moved the crystal a lot closer to the PIC and removed the wires connecting it. Although this did not change anything. The PIC still will not work if I don't put some sort of load on any of the pins and hold it high. I still cannot put capacitors in the circuit or it stops working. I checked for any short circuits with my multimeter and it is ok. I changed the LEDs and resistors to lower the current drawn from them. Nothing is helping :(

I do have normal insulated wire, but I don't use it on breadboards. It is messy, tinned wire does the job perfectly. The circuit works as it is, but without capacitors and I need to hold a pin high.

hi daniel,
Unless I am going cross eyed, looking at your circuit and project board you have the wrong pins for power and the crystal.:confused:

It is a 16F877A.?
xtal should be 13 and 14

Power is 12 and 11.?
 

Attachments

  • Image1.png
    Image1.png
    132.3 KB · Views: 166
Last edited:
yeah even the schematic has it wrong and how about a 22k resistor to MCLR?

ericgibbs: to help your claim:

pinou2-png.24488
 

Attachments

  • pinout.png
    pinout.png
    312.4 KB · Views: 154
  • pinou2.png
    pinou2.png
    316 KB · Views: 300
Last edited:
Yes! You guys are right! Thanks for spotting that, I feel quite stupid now. Now it works with caps. Although, it is still unstable. For some reason it speeds up and slows down, I think this is to do with the current drawn.

Does there have to be a resistor to MCLR? Can't I just connect it directly to VDD?
 
You need to pay attention to the datasheets.

The 20K (or so) resistor is used to tie mclr to VDD is a pull up resistor. If you tie VCLR direct to +5 your programmer will not be able to lower it to gnd or raise it to VPP. Use the resistor.

Why do you have a zif socket. Are you not using ICSP?

I do not think the PIC speed changes in relation to current draw. Triple check the wiring.
 
Last edited:
At the moment, I don't need to use MCLR. I never got round to wiring ICSP at the moment, I want to have a working PIC before I start doing stuff like that.

YouTube - PIC Acting strange

Code used:
Code:
#include <system.h>
#pragma DATA _CONFIG, _CP_OFF & _LVP_OFF & _BODEN_OFF & _PWRTE_OFF & _WDT_OFF & _XT_OSC


void test(unsigned char data) //stolen from a website, I think it was AtomSoft
{
   unsigned char bits;
   for (bits=0x80; bits != 0; bits >>= 1)
   {
      if ((bits & data) == bits)  
      {     
          set_bit(portb,0);
      }
      else
      {
         clear_bit(portb, 0);
      }
      set_bit(portb, 3);   
      clear_bit(portb, 3);
   }
   set_bit(portb, 7);        
	clear_bit(portb, 7);
} 

void main()
{
	trisa = 0;
	trisb = 0;
	trisc = 0;
	trisd = 0;
	trise = 0;

	portb = 0;
	unsigned char f = 0;
	int i = 0;
	while(1)
	{
		for(i = 0; i < 8; i++)
		{
			toggle_bit(f, i);
			test(f);
			delay_s(1);
		}
		delay_s(1);
		for(i = 7; i >= 0; i--)
		{
			toggle_bit(f, i);
			test(f);
			delay_s(1);
		}	
		delay_s(1);
	} 
}

EDIT: I'm not sure why delay_s doesn't work properly, it may even be the cause of the problem. I wouldn't expect it to change, even if it doesn't time it right.
 
Last edited:
If your having problems and think its on current drawn it may be those wires. Use the coated ones. Im not sure who i learned it from i think it was either Pommie, 3v0 or Futz. They have a really clean look to there stuff and i though or learned a clean breadboard is easy to do. Just takes longer on big projects
 
If a smaller current on the PIC doesn't slow it down, then I guess it's not current drawn but another problem. It seems to be after a few seconds running that it goes unstable. Nothing gets hot any more, not even the regulator.
 
It looks like it wasn't working because of a bad connection on the crystal, it seems to be stable now.

Thanks for all your patience and help everyone :)
 
Oh dear, I'm having problems again :(

It seems the crystal oscillator isn't oscillating at all and leaving the CLKIN and CLKOUT pins floating. This can be proved by completely removing the crystal, nothing changes. Is there any common causes to this? I will create and post a schematic/picture if needed.


EDIT: I'm wondering if it's worthwhile soldering it all to strip board? I think the problem may lie with the resistance of the breadboard.
 
Last edited:
If you have working with the code you may have changed the line
#pragma DATA _CONFIG, _CP_OFF & _LVP_OFF & _BODEN_OFF & _PWRTE_OFF & _WDT_OFF & _XT_OSC

Such that the _XT_OSC is missing ?

What where you doing when it quit. Or what did you do to make it not work?
 
I think it's bad connections on the breadboard, or maybe the crystal. I jammed the crystal in the ZIF socket and it worked for a moment, but not for long.
I have checked and rechecked as much as I could, I have checked the code, pins etc.

EDIT: I have cascaded the 74HC595 to drive a LED matrix. It does draw the intended output, be the scanning is clearly visible and sometimes even very slow.
 
Last edited:
The first thing I would do is to get rid of the ZIF socket and add an ICSP connector so you can do ICSP programming. I think you will find that the socket is just one more place for bad connections.

What are you using for a programmer ? What does the ICSP connector look like.
 
Last edited:
EDIT: I'm wondering if it's worthwhile soldering it all to strip board? I think the problem may lie with the resistance of the breadboard.
What resistance? The breadboard capacitance myth is crapola too. Unless your breadboard is old worn out junk (or new junk :p), it's not that. **broken link removed** work fine.

If I were you I would definitely stop using bare wires immediately. And get rid of the alligator clips too. They're flaky as hell. You're just asking for problems doing that. Use either **broken link removed** or make your own from 22AWG phone wire or similar. Probably half the wires on the breadboard below are phone wire. I get mine from construction sites. Electricians throw enough scraps away to keep me and everyone else in breadboard wires forever. :D
**broken link removed**
 
Last edited:
The first thing I would do is to get rid of the ZIF socket and add an ICSP connector so you can do ICSP programming. I think you will find that the socket is just one more place for bad connections.

What are you using for a programmer ? What does the ICSP connector look like.
One more HUGE vote for getting rid of the silly ZIF and going with ICSP. It's the only way to get anything done.

ZIFs are for when you need to quickly program a batch of chips with the same program, for very small production runs. They're not suited for learning and experimentation, as moving the chip back and forth is too slow and tedious.

ICSP is quick and easy. None of that constantly moving the chip back and forth from socket to socket nonsense. Just hit a few keys or click a few mouse clicks and the chip is reprogrammed. AND you can debug it in-circuit properly when you do ICSP. You can't debug a circuit when its chip is in the programmer's ZIF socket.

EDIT: In the photo above, my ICSP connector is at the upper left of the breadboard. I use 2x5 IDC because they're very solid. 1x5 is too wobbly.

Here's a photo of a nice solid ICSP programming/debugging setup in action:
**broken link removed**
 
Last edited:
nice and neat Futz! Can you send me a link to where you get those beautiful buttons. Please. I made so many things better for prototyping. Like buttons , oscillators and many others like pots etc... by adding or modding the pins and making them headers ... they stick off the board slightly but 100% sturdy and safe and easy to plug in play :D
 
Last edited:
Can you send me a link to where you get those beautiful buttons.
I'm not sure where I got them. I think it was BG Micro, but they have standard tact switches under **broken link removed** now. The ones I have have kind of strange rubbery tops and have thinner legs that fit the breadboard perfectly.
 
hi,
The problem I have found with most ZIF sockets is the shortish pin length, they are not designed to be plugged into project boards.

As 3v0 has said, for starters get rid of the ZIF socket from the project board and plug the PIC directly into the board.

To remove the PIC, use a small [5 inch] screwdriver and carefully lift/lever one end partly out, then the other end of the PIC.
 
After more testing, I think the problem lies with the other circuitry my PIC is driving, not the PIC itself. I have (neatly) soldered the PIC onto strip board with crystal and decoupling caps.

I am doing the same with matrix driver, I'll post back later on when it's finished.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top