******************************************************************************************
;
; OSC : OSC 12MHz
;
;******************************************************************************************
LIST P=PIC12F1840,ST=OFF,R=DEC
INCLUDE "P12F1840.inc"
__CONFIG _CONFIG1, _FOSC_HS & _WDTE_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
__CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_HI & _LVP_OFF
;*******************************************************************************
; Constants
;*******************************************************************************
RAM_START equ 0x20
;Cycle time = 1/3000000 = 0.33333333333 uS
;150 Khz cycle time = 6.66666666 uS
;*******************************************************************************
; Pin Assignments
;*******************************************************************************
;
; PIC signals
;
; I/O pin use
; RA0 Not used (Pin 7) (To pin 4 on programmer connection)
; RA1 Not used (Pin 6) (To pin 5 on programmer connection)
; RA2 Output (Pin 5)
; RA3 Not used (Pin 4) NOTE THIS PIN CAN ONLY BE USED AS AN INPUT.
; (This is VPP for programming This could be connected to pin 3 or 5 of the header to program the chip on header.)
; RA4 crystal (Pin 3)
; RA5 crystal (Pin 2)
; Define GENERAL PURPOSE RAM AREA (80 bytes maximum)
;*******************************************************************************
; File Register Variables
;*******************************************************************************
cblock RAM_START
endc
;
;*******************************************************************************
;*******************************************************************************
; Define Macro Takes 2 uS
;*******************************************************************************
SELBANK MACRO #BANK_NO
MOVLW #BANK_NO ;1 cycle - 1 uS
MOVWF BSR ;1 cycle - 1 uS
ENDM
; *****************************
ORG 0h
GOTO START
ORG 4h
GOTO START
START
; *****************************
; Initialized Segment
; *****************************
; Initialise OSC (12MHz, )
BCF INTCON,GIE
; Initialise I/O port
SELBANK 1 ; SET BANK1
MOVLW B'11111001' ; Bits 1, 2 output Bit 0, 3, 4, 5 input.
MOVWF TRISA
SELBANK 0 ; SET BANK1
Loop:
MOVLW B'11111101'
MOVWF PORTA
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
MOVLW B'11111011'
MOVWF PORTA
NOP
NOP
NOP
NOP
NOP
NOP
GOTO Loop ;(2 cycles)
end