PIC Hangs/Doesnt Work

spinnaker

Joined Oct 29, 2009
7,830
I'm glad they didn't, or at least standardize like these are. For zero cents in extra transistors you should be able to use any I/O pin as an analog pin.
I meant standardize on how common things are done like disable an analog pin to make it digital.



How pins read is important when you use constructs such as:
Rich (BB code):
   PORTA = ~PORTA;
so always turn analog off if not used.


Oh yes yes, now that you put it that way I see the importance of disabling the analog.
 

MrChips

Joined Oct 2, 2009
35,093
Never overlook the obvious.
What are you using for a power supply?
Are the power supply lines properly filtered with a 0.1uF and 10uF cap?
Is the RESET pin connected properly?
How is the MCU CLK driven?
How do you know that the MCU is being programmed correctly?
 

t06afre

Joined May 11, 2009
5,934
Never overlook the obvious.
What are you using for a power supply?
Are the power supply lines properly filtered with a 0.1uF and 10uF cap?
Is the RESET pin connected properly?
How is the MCU CLK driven?
How do you know that the MCU is being programmed correctly?
And also do you use series resistors for the LEDs. And are the LEDs placed correct in the circuit. LEDs are not lamps, they are diodes. So placed the wrong tway. The will stay dark ;)
 

Thread Starter

ssm14293

Joined Jul 14, 2011
90
What are you using for a power supply?
9V battery with 5V regulator
Are the power supply lines properly filtered with a 0.1uF and 10uF cap?
0.1uf, what if i dont use it? any problem might arise?
Is the RESET pin connected properly?
yep... receiving full 5V
How is the MCU CLK driven?
normal way... both pins to uC and to 2 caps of 22pF and caps to GND
How do you know that the MCU is being programmed correctly?
i guess so... its working now u know ;)
 
Last edited:

Thread Starter

ssm14293

Joined Jul 14, 2011
90
one question guyz...
my portB's one pin is working as portA
Rich (BB code):
void PIC_setting(void){
 ADRESH = 0x00;
 ADRESL = 0x00;
 TRISA = 0x00;
 TRISB = 0x00;
 TRISD = 0x00;
 TRISE = 0x00;
 ADCON0 = 0x00;
 ADCON1 = 0x07;
 PORTA = 0;
 PORTB = 0;
 }
void main() {
   PIC_setting();
   while (1){
         PORTA = ~PORTA;
         delay_ms(500);
   }
}
PORTB.6 is giving the same pulse as PORTA... whats wrong? :(
 

thatoneguy

Joined Feb 19, 2009
6,359
Is PORTB.1 an output for a peripheral as well?

Look closely at the datasheet.

I check both the port section AND any peripheral section that uses that pin (find functions from pinout).

Is it a USB Data out?
 

ErnieM

Joined Apr 24, 2011
8,415
Port B.6 is also PGFC (ProGram Clock) and is not associated with Port A at all.

0.1uf, what if i dont use it? any problem might arise?
Well, it may do any weird thing as the device turns on and off at odd intervals due to the 5V regulator oscillating. ADD THE PROPER CAPS AS THE REGULATOR DATA SHEET CALLS FOR.

Does "i guess so... its working now u know " mean the seven outputs of PortA are now flashing at a 1 second on/1 second off rate?
 
Top