I have a stand alone 4 pin 20 MHz oscillator (full circuit inside box) attached to the pin to the CLOCKIN (pin 2) of my PIC 12F675. I originally had my CONFIG word setup to _INTRC_OSC_NOCLKOUT and my program worked fine. I wanted to increase the internal clock speed to about 20 MHz so I took out the _INTRC_OSC_NOCLKOUT and replaced it with_XT_OSC and added the 20 MHz clock output to pin 2. Now I don't get any oscillations on my output pins after the simple change. Here is the code, what is wrong?
Rich (BB code):
list p=12f675 ; list directive to define processor
#include <p12f675.inc> ; processor specific variable definitions
__CONFIG _CP_OFF & _CPD_OFF & _BODEN_OFF & _MCLRE_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
;*************************** REGISTERS ********************************
cblock 0x20
PixelCounter ; file location PixelCounter will contain number of loops
HsyncCounter ; file location HsyncCounter will contain number of loops
VsyncCounter ; file location VsyncCounter will contain number of loops
endc
;*************************** CONSTANTS ********************************
#define Bank0 banksel 0x00 ; first registerr bank = Bank 0
#define Bank1 banksel 0x80 ;second register bank = Bank 1
#define Blank B'00000000' ; All LEDs off
#define ConfigTRI B'00111000' ; Configure I/O
;******************** INITIALIZATION PROTOCOL **************************
org 0x000 ; BIG BANG
goto Initialize ; Initialization call
org 0x005 ; Start of Programm Memory Vector
Initialize
Bank0 ; Bank 0 located at 0x00h
clrw ; clear w register
movlw 06h ; move integer 118 to w register making 118 pixels drawn per line
movwf PixelCounter ; move contents of w register to PixelCounter register location
movlw 30h ; move integer 118 to w register making 118 lines drawn per screen
movwf HsyncCounter ; move contents of w register to HsyncCounter register location
movlw 3Ch ; move integer 60 to w register making 60 screens per second
movwf VsyncCounter ; move contents of w register to VsyncCounter register location
clrf GPIO ; clear GPIO
movlw 07h ; move 07h into w register
movwf CMCON ; move contents of w register to CMCON register location
movlw B'00000011' ; set GPIO 0,1 to make both waveforms start at the same time
movwf GPIO ; move value in w to register GPIO
Bank1 ; Bank 1 located at 0x20h
clrw ; clear w register
clrf ANSEL ; clear ANSEL register which controls analog or digital configuration making DIGITAL
movlw ConfigTRI ; loads constant ConfigTRI
movwf TRISIO ; loads w register into TRISIO register which assigns I/O for GPIO pins
Bank0 ; return to Bank0 address
Main
bcf GPIO,0 ; clear GPIO 0 to increment pixel position
bsf GPIO,0 ; set GPIO 0 to draw new pixel at next location
decfsz PixelCounter ; decrement counter and skip goto Main when pixelcounter reaches end of line
goto Main ; return loop
bcf GPIO,1 ; clear GPIO 1 to increment line position
bsf GPIO,1 ; set GPIO 1 to allow pixel drawings at that line
movlw 06h ; store value 118 into w register
movwf PixelCounter ; store w register into PixelCounter so we can draw 118 more pixels on a new line
decfsz HsyncCounter ; decrement counter and skip goto Main when HsyncCounter reaches end of line time
goto Main ; return loop
bcf GPIO,2 ; clear GPIO 2 to start at the top of the screen
bsf GPIO,2 ; set GPIO 2 to allow pixels to be drawn
movlw 30h ; store value 60 into w register
movwf HsyncCounter ; store w register into HsyncCounter so we can draw pixels on 118 new line
decfsz VsyncCounter ; decrement counter and skip goto Main when VsyncCounter reaches end of screen
goto Main
movlw 3Ch ; store value 60 into w register
movwf VsyncCounter ; store w register into VsyncCounter so we can restart at the top of the screen
goto Main