16
Електроника / Проблем с PIC18F6620
« -: Май 15, 2010, 09:24:05 am »
Точно за такива високоенергийни частици става въпрос - т.нар. мюони. А схемите "И" и "ИЛИ" в случая се наричат схеми за съвпадение и съответно - антисъвпадение.
От тук може да видиш всички публикации на този потребител.
;******************************************************************************
; This file is a basic template for assembly code for a PIC18F6620. Copy *
; this file into your project directory and modify or add to it as needed. *
; *
; Refer to the MPASM User's Guide for additional information on the *
; features of the assembler. *
; *
; Refer to the PIC18FXX20 Data Sheet for additional information on the *
; architecture and instruction set. *
; *
;******************************************************************************
; *
; Filename: *
; Date: *
; File Version: *
; *
; Author: *
; Company: *
; *
;******************************************************************************
; *
; Files Required: P18F6620.INC *
; *
;******************************************************************************
LIST P=18F6620 ;directive to define processor
#include <P18F6620.INC> ;processor specific variable definitions
;******************************************************************************
;Configuration bits
;Microchip has changed the format for defining the configuration bits, please
;see the .inc file for futher details on notation. Below are a few examples.
; Oscillator Selection:
;******************************************************************************
;Variable definitions
; These variables are only needed if low priority interrupts are used.
; More variables may be needed to store other special function registers used
; in the interrupt routines.
CBLOCK 0x060
WREG_TEMP ;variable used for context saving
STATUS_TEMP ;variable used for context saving
BSR_TEMP ;variable used for context saving
ENDC
CBLOCK 0x000
EXAMPLE ;example of a variable in access RAM
ENDC
;******************************************************************************
;EEPROM data
; Data to be programmed into the Data EEPROM is defined here
ORG 0xf00000
DE "Test Data",0,1,2,3,4,5
;******************************************************************************
;Reset vector
; This code will start executing when a reset occurs.
ORG 0x0000
goto Main ;go to start of main code
;******************************************************************************
;High priority interrupt vector
; This code will start executing when a high priority interrupt occurs or
; when any interrupt occurs if interrupt priorities are not enabled.
ORG 0x0008
bra HighInt ;go to high priority interrupt routine
;******************************************************************************
;Low priority interrupt vector and routine
; This code will start executing when a low priority interrupt occurs.
; This code can be removed if low priority interrupts are not used.
ORG 0x0018
movff STATUS,STATUS_TEMP ;save STATUS register
movff WREG,WREG_TEMP ;save working register
movff BSR,BSR_TEMP ;save BSR register
; *** low priority interrupt code goes here ***
movff BSR_TEMP,BSR ;restore BSR register
movff WREG_TEMP,WREG ;restore working register
movff STATUS_TEMP,STATUS ;restore STATUS register
retfie
;******************************************************************************
;High priority interrupt routine
; The high priority interrupt code is placed here to avoid conflicting with
; the low priority interrupt vector.
HighInt:
; *** high priority interrupt code goes here ***
retfie FAST
;******************************************************************************
;Start of main program
; The main program code is placed here.
Main:
; *** main code goes here ***
clrf PORTG
clrf TRISG
bsf PORTG,3
;******************************************************************************
;End of program
END
#include <18F6620.h>
#device adc=8
#FUSES NOWDT
#FUSES WDT1 //Watch Dog Timer uses 1:1 Postscale
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOOSCSEN //Oscillator switching is disabled, main oscillator is source
#FUSES NOBROWNOUT //No brownout reset
#FUSES BORV25 //Brownout reset at 2.5V
#FUSES PUT //Power Up Timer
#FUSES NOCPD //No EE protection
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT //Program memory not write protected
#FUSES NOWRTD //Data EEPROM not write protected
#FUSES NOCPB //No Boot Block code protection
#FUSES NOEBTRB //Boot block not protected from table reads
#FUSES NOEBTR //Memory not protected from table reads
#FUSES NOWRTC //configuration not registers write protected
#FUSES NOWRTB //Boot block not write protected
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
#include "C:\Users\NRJ\Desktop\test\main.h"
void main()
{
output_high(PIN_G3);
while(1);
}