I just wrote my first program and downloaded it to the Pic (JDM).
Everything worked well except nothing happens when I run it.
The program just turns a few pins on.
I have nothing connected to the Oscillator pins. I do not quite get what to do with them.
Do I have to get a external oscillator and if so which one?
I have connected VDD +5V and VSS to negative and MCRL thru a 4.7K to VDD.
The chip is a PIC16F876/20SP.
Here is the program:
'Chip model
#chip 16F876, 20
'Set the pin directions
dir PORTB.1 out
dir PORTB.2 out
dir PORTB.4 out
dir PORTB.5 out
ADOff
'Main routine
Start:
SET PORTB.1 ON
SET PORTB.2 ON
SET PORTB.4 ON
SET PORTB.5 ON
'Jump back to the start of the program
goto Start
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's okay to vary the capacitor values a little, I've also used 10 and 22 pf ones without trouble. According to the datasheet the resistor is optional, but I always include it anyway.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello!
I am a complete beginner to PIC's.
I just wrote my first program and downloaded it to the Pic (JDM).
Everything worked well except nothing happens when I run it.
The program just turns a few pins on.
I have nothing connected to the Oscillator pins. I do not quite get what to do with them.
Do I have to get a external oscillator and if so which one?
I have connected VDD +5V and VSS to negative and MCRL thru a 4.7K to VDD.
The chip is a PIC16F876/20SP.
Here is the program:
'Chip model
#chip 16F876, 20
'Set the pin directions
dir PORTB.1 out
dir PORTB.2 out
dir PORTB.4 out
dir PORTB.5 out
ADOff
'Main routine
Start:
SET PORTB.1 ON
SET PORTB.2 ON
SET PORTB.4 ON
SET PORTB.5 ON
'Jump back to the start of the program
goto Start
The 16F876 requires an external oscillator. I normally use this circuit:
http://gcbasic.sourceforge.net/osc.jpg
It's okay to vary the capacitor values a little, I've also used 10 and 22 pf ones without trouble. According to the datasheet the resistor is optional, but I always include it anyway.