AND you set the HS config fuse in your code or before programming in your device programmer software?
AND you set the HS config fuse in your code or before programming in your device programmer software?
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hellow guys,
Yes, I changed the programmer clock speed config. setting to HS and the DEFINE OSC 4 to DEFINE OSC 20
Sometimes, the breadboard could cause you some bugs like that. But before doing some assumption, is a simple Blink program work? Some crystal also need a resistor in parallel to work properly.. something 'round 1Meg
If not, remove the capacitor around your Crystal, ALSO be sure your supply line is clean, ... plah plah, capacitor close to PIC and the usual.
DOH! i already saw that code here ... i guess it's one of mine.. there's a little error in the DEFINE HSER_CLOERR... MUST BE DEFINE HSER_CLROERR
Do a simple loop with HSEROUT and post your results.
Last edited by mister_e; - 22nd May 2006 at 17:20.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Thanks for your suggestions. I corrected the CLROERR microbug, with no effect and then inserted an [LED ON : PAUSE : LED OFF] bit between the byte receive and byte echo lines in the code. This proved that the micro and code were running, with the LED blinking for each byte received. However, after a random number of bytes received (typically 6), the program stops with the LED on.
Tidying up the breadboad wiring and moving the power input lines connection to the board greadtly improves things. Most of the bytes are now echoed correctly, with a few random errors. This all suggests that it is a board layout problem giving noise on the power lines that latches up the micro. The funny thing is that I used 9600 baud with 20MHz, no absolutely problem, when using SEROUT and NO MAX232. It seems that the MAX232 is producing these glitches.
I hope the problem will be fully solved when I go to a PCB. Thanks for the suggestions.
Yet another poor psu filtering issue now. Place 1uf-10uF tantalum + 0.1 ceramic close to the MAX232, same close to your PIC and it should work better.
Sure a PCB may be of help but solving this problem on a breadboard will learn you some important things. It's working smooth here on a breadboard and the same OSC speed you use.
Keep your OSCillator wires/pins short, same for capacitors around your crystal. Ceramic Resonator are my favorite choice when using a breadboard.. not for a final PCB if accuracy is important with temperature change.
Don't do any Spaghetti breadboard... all wires will act as an antenna and just introduce noise. If your breadboard have a metal plate on the bottom, ground it... it will act as a 'kind of' ground plane. Messy contact, wich is often the case on breadboard after few hours of use, will also give you headaches. order a load of 0.1 uF ceramic capacitor + 10uF tantalum and sprinkle them 'round your breadboard supply line... you'll be surprise of how it solve some problem.
Some ICSP problem are also often a case of bad breadboard assignement, were wires are too long, psu poorely filtered and, and,and...
Last edited by mister_e; - 23rd May 2006 at 14:38.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Problem has been completely solved, as you suggested, by putting 0.1uF ceramic caps spanning the power supply lines to the PIC and the MAX232 on my breadboard. Thanks for the solution.
Incidentally, I found another problem relating to power supplies when experimenting with the 16F877. Like many PICs, the device has 2 pins (on opposite sides of the DIP) for each of the VDD and VSS connections. Thinking it would be good to connect up both sets, I found the PIC drew a heavy current and did'nt work. Only one pair should be used. The datasheet does not detail this.
__________________________________________________ ___________
In electronics there is no such thing as a new idea, only new applications of old ideas.
Many of the larger PICs have multiple power pins.Originally Posted by manxman
ALL OF THESE SHOULD BE CONNECTED.
They are not duplicated to make PCB layout easier, they are there to feed power to all parts of the chip without burning out internal tracks. IF you only use one set you will eventually damage a PIC and could also have eratic behaviour of your program.
I would respectfully suggest that the reason your PIC drew a heavy current and didnt work was due to inadvetantly shorting out the power supply as the two sets of pins are NOT exactly opposite but slightly offset making a wiring error a distinct possibility particularly when breadboarding a design.
Keith
www.diyha.co.uk
www.kat5.tv
Bookmarks