Why would you want to use it with an 4mhz external crystal, it has an internal 4mhz one already? Is this picbasic you are using? I'm not familiar with this version of basic but have you programmed it so that the pic knows it has an external osc, though it appears that you have.
You may require a series resistor on osc2 depending on what kind of crystal you are using.
Maybe try:
OUTPUT GPIO.2
Start:
HIGH GPIO.2
pause 500
LOW GPIO.2
pause 500
goto Start
Try your code with the internal osc and see if that works, if it does then you know the external osc is misconfigured.
I got it working with the 4MHz crystal now. I added the line ALL_DIGITAL = TRUE
But when i am using my 20 MHz crystal i am having problem again. It is VERY unstable. It may run for half a second then it stops, and then it runs a couple of seconds the not again.
What is the problem? You said something about a resistor. What value should is use then?
I run my 12f675's a 20mhz all the time for led pwm and they work fine, I run the osc with built in caps though.
Most compilers I've worked with have a look at the mhz value and make changes so that commands like pause are at the same timing no matter the osc mhz.
Assembley language probably does not take this into consideration and the programmer must implement it and that's where the problem lies with respect to changing the osc mhz with asm code.
They're usually called resonators and they only have three pins. The middle pin connects to ground and the pins on the side is connected to osc1 and osc 2, separately.
According to the data-sheet the maximum speed is 20MHz. I don't really need it now, but it would be good to know that it works.
I have another question about another thing. I have mostly worked with a basic compiler. I would like to learn some more assembler programming. Is there any good free tutorials, or e-books about assembler programming.
It have to be for newbies though =)[/code]