![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| When i build this program it built successfully. Then, i programmed it into a 16F84a but when i place an led in RB0 with correct resistor nothing happen! I am trouble shooting my circuit Q>how i know if the crystal i bought 4MHz is working or not?
__________________ Hesham Ismail Mohammed Sharif Thank me if you want Last edited by uaefame; 15th June 2008 at 06:59 PM. | |
| |
| | (permalink) |
| It would appear that you have the wrong oscillator type selected in your __CONFIG line. A 4MHz crystal should have XT selected, not LP. Your config line Code: __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _LP_OSC Code: __CONFIG _CP_OFF & _PWRTE_OFF & _WDT_OFF & _XT_OSC Here's a basic 16F84 breadboard you can have a look at to compare with how yours is set up. Your crystal needs two (typically) 22pF loading capacitors to work properly. Wire them like this (not a 16F84, but same idea): bleh.jpg
__________________ ========================= Futz's Microcontrollers & Robotics ========================= | |
| |
| | (permalink) |
| I change the codes you suggested still not working. I will post the schematic that i am following
__________________ Hesham Ismail Mohammed Sharif Thank me if you want | |
| |
| | (permalink) |
| There's the problem. Like I said previously, MCLR must be pulled high with a resistor. Your schematic shows it pulled low. When MCLR is held low the PIC is in RESET, and halted. No program runs with MCLR pulled low like that.
__________________ ========================= Futz's Microcontrollers & Robotics ========================= Last edited by futz; 15th June 2008 at 11:47 PM. | |
| |
| | (permalink) |
| Q> What you mean by pulled high and pulled low and when do i use pulled high or pulled low?
__________________ Hesham Ismail Mohammed Sharif Thank me if you want | |
| |
| | (permalink) |
| Wow it worked i connected MCLR to 5V and it worked i guess that was the problem. Thanks futz for giving me guide
__________________ Hesham Ismail Mohammed Sharif Thank me if you want | |
| |
| | (permalink) |
| A pull up or pull down resistor is used to create a default value or state for a signal. Now you have MCLR wired to +5V. If you connect an ICSP it will not work because the signal is stuck at +5V. If you were to put a 10K or 20K resistor between MCLR and +5V then MCLR would be +5V when no other signal was present. But because of the resistor a signal from an ICSP connector could change the value to VPP or GND as needed. A pull down works the same way but the default become GND. Most often the an input will have a pullup or pulldown and one or more other signals that will be tristated (turned off or made an input) when not in use. HTH
__________________ search engine for electronic partsJunebug USB PIC programmer kit., USB Bit Wacker, 3v0's Homepage The 15 Minute Printed Circuit Board! (+drill time) Last edited by 3v0; 16th June 2008 at 01:37 AM. | |
| |
| | (permalink) | |
| Quote:
And, like 3v0 says, don't connect MCLR directly to VDD. Use a pullup resistor between the MCLR pin and VDD. 22K or 33K are good, but it isn't critical. Anything from 10K to 33K is fine.
__________________ ========================= Futz's Microcontrollers & Robotics ========================= | ||
| |
| | (permalink) |
| This is really just personal choice, PIC's are designed for a direct MCLR connection if you wish, but obviously it prevents ICSP - if you don't use ICSP, then you don't need a resistor - if you do use ICSP, then you need a resistor and a diode. | |
| |
| | (permalink) | ||
| Quote:
From the 16F876A data sheet, Quote:
| |||
| |
| | (permalink) |
| Sorry for my basic question Q> what is ICSP?
__________________ Hesham Ismail Mohammed Sharif Thank me if you want | |
| |
| | (permalink) |
| In Circuit Serial Programming Means that you connect a 5-wire cable to the target circuit to reprogram it in place, rather than pry the PIC out and take the chip to the programmer.
__________________ ========================= Futz's Microcontrollers & Robotics ========================= | |
| |
| | (permalink) | |
| Quote:
Figure 14-5 in the datasheet gives an upper bound for the value for one of the resistors and a lower bound for the value of the other, but doesn't seem to indicate what the capacitor value should be. Any ideas? or have I just not looked carefully enough? | ||
| |
| | (permalink) |
| I think setting a resistor <40k is neccesary between MCLR and vdd now. I searched the datasheet of 16F84A as david said a capacitor must be included and also i found out that another resistor and diode is needed. Q> What is the value of C and diode that i must used?
__________________ Hesham Ismail Mohammed Sharif Thank me if you want | |
| |
| | (permalink) | |
| Quote:
A 0.1uF capacitor between VDD and VSS is a good idea. Place it as close to the chip as possible.
__________________ ========================= Futz's Microcontrollers & Robotics ========================= Last edited by futz; 18th June 2008 at 03:00 AM. | ||
| |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Title | Starter | Forum | Replies | Latest |
| Visual Basic for Electronics Engineering Applications | ThermalRunaway | Electronic Books | 25 | 26th November 2008 09:56 AM |
| It is BASIC or is it BABL | 3v0 | Micro Controllers | 22 | 7th May 2007 03:09 PM |
| free pic basic complier | dstich | Micro Controllers | 7 | 1st August 2006 08:13 PM |
| Assembly to Basic Coding | AZdave | Micro Controllers | 3 | 23rd January 2005 03:28 PM |
| PIC basic and Basic stamp | Cyborg | Micro Controllers | 5 | 21st April 2004 09:44 AM |