TrevorH
Newbie level 3
- Joined
- Oct 10, 2014
- Messages
- 4
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 43
Code ASM - [expand] 1 2 3 4 5 list p=16F628A #include <P16F628A.inc> __CONFIG _FOSC_EXTRCCLK & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _BOREN_ON & _LVP_ON & _CPD_OFF & _CP_OFF END
;**********************************************************************
; This file is a basic code template for assembly code generation *
; on the PIC16F628A. 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: P16F628A.INC *
; *
;**********************************************************************
; *
; Notes: *
; *
;**********************************************************************
list p=16f628A ; list directive to define processor
#include <p16F628A.inc> ; processor specific variable definitions
errorlevel -302 ; suppress message 302 from list file
__CONFIG _CP_OFF & _DATA_CP_OFF & _LVP_OFF & _BOREN_OFF & _MCLRE_ON & _WDT_OFF & _PWRTE_ON & _INTOSC_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 0x7E ; variable used for context saving
status_temp EQU 0x7F ; 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
main
; remaining code goes here
goto main ;loop forever, remove this instruction, for test only
; initialize eeprom locations
ORG 0x2100
DE 0x00, 0x01, 0x02, 0x03
END ; directive 'end of program'
The info is given in the MPLAB device info quoted by WP100 (ICD Header rquired) and also in the datasheet:What IS the difference I should look for when I'm choosing a PIC, what info on a PIC tells YOU that you cannot debug it?
14.13 In-Circuit Debugger
Since in-circuit debugging requires the loss of clock, data and MCLR pins, MPLAB® ICD 2 development with an 18-pin device is not practical. A special 28-pin PIC16F648A-ICD device is used with MPLAB ICD 2 to provide separate clock, data and MCLR pins and frees all normally available pins to the user. Debugging of all three versions of the PIC16F627A/628A/648A is supported by the PIC16F648A-ICD.
Thank you WP for your information, much appreciated.
I will get and look at the 16F88 to start instead, there was no specific reason I went for the 628. What IS the difference I should look for when I'm choosing a PIC, what info on a PIC tells YOU that you cannot debug it?
I have not looked at the Simulator yet but will do. The only difference I can think of why I had it working, and you may be able to answer this one; The PICKit2 I have is a new one but a couple of weeks ago I must have been holding the button when I plugged it in and I had to download the operating system again (from the internet). Could the original OS have enabled me to do this?
Regarding the bit of code, it was actually the last I had been trying. Up until then I have been using the Internal Oscillator and the "flashing LED" circuit worked perfectly.
Thank you for all your help.
Trevor
Regards your last reply saying "While it shows that X can debug the 628A , it does not show that an adapter is needed"
does this mean I should be able to use the debugger with the 628a I have? It Definitely worked for a short while, have been looking at the "simulator" today and was definitely not that what I was using last time.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?