Re: Problem med att få livstecken ur en PIC12F675
Postat: 24 augusti 2009, 21:55:52
Hä hä... Installerade MPLAB IDE på denna datorn. Nu har jag kopierat MPLAB's "Template"-kod som jag helt har utgått ifrån...
Här är koden UTAN någon som helst ändringar, förutom att jag lagt till en "låda" där jag antar att egen kod skall vara.. Det är alltså den rena template-koden från mplab...
Koden jag skrev i första inlägget haffsade jag bara ner direkt här... TAB fungerar inte här vad jag märkt..
Är det något i templatekoden man bör ändra / ta bort??
Här är koden UTAN någon som helst ändringar, förutom att jag lagt till en "låda" där jag antar att egen kod skall vara.. Det är alltså den rena template-koden från mplab...
Kod: Markera allt
;**********************************************************************
; This file is a basic code template for assembly code generation *
; on the PIC12F675. This file contains the basic code *
; building blocks to build upon. *
; *
; Refer to the MPASM User's Guide for additional information on *
; features of the assembler (Document DS33014). *
; *
; Refer to the respective PIC data sheet for additional *
; information on the instruction set. *
; *
;**********************************************************************
; *
; Filename: xxx.asm *
; Date: *
; File Version: *
; *
; Author: *
; Company: *
; *
; *
;**********************************************************************
; *
; Files Required: P12F675.INC *
; *
;**********************************************************************
; *
; Notes: *
; *
;**********************************************************************
list p=12f675 ; list directive to define processor
#include <p12f675.inc> ; processor specific variable definitions
errorlevel -302 ; suppress message 302 from list file
__CONFIG _CP_OFF & _CPD_OFF & _BODEN_OFF & _MCLRE_ON & _WDT_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT
; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See data sheet for additional information on configuration word settings.
;***** VARIABLE DEFINITIONS
w_temp EQU 0x20 ; variable used for context saving
status_temp EQU 0x21 ; variable used for context saving
;**********************************************************************
ORG 0x000 ; processor reset vector
goto main ; go to beginning of program
ORG 0x004 ; interrupt vector location
movwf w_temp ; save off current W register contents
movf STATUS,w ; move status register into W register
movwf status_temp ; save off contents of STATUS register
; isr code can go here or be located as a call subroutine elsewhere
movf status_temp,w ; retrieve copy of STATUS register
movwf STATUS ; restore pre-isr STATUS register contents
swapf w_temp,f
swapf w_temp,w ; restore pre-isr W register contents
retfie ; return from interrupt
; these first 4 instructions are not required if the internal oscillator is not used
main
call 0x3FF ; retrieve factory calibration value
bsf STATUS,RP0 ; set file register bank to 1
movwf OSCCAL ; update register with factory cal value
bcf STATUS,RP0 ; set file register bank to 0
; remaining code goes here
;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;
; initialize eeprom locations
ORG 0x2100
DE 0x00, 0x01, 0x02, 0x03
END ; directive 'end of program'
Är det något i templatekoden man bör ändra / ta bort??