Electronics > Microcontrollers

PIC 12F675 ASM file structure

(1/1)

EENG:
Hallo

I recently  bought a PIC KIT 1 which uses the PIC 12F675 chip. This is my first attempt ever to programme a PIC, so forgive me for the questions.

Can you please advise what the skeleton structure of the ASM file should be excluding the main SW part? Is there a web site where I can get this "skeleton" structure? Basically I jusy want open a skeleton ASM file and start adding a few lines of code in the main body to get going.

I have opened up a tutorial ASM file and deleted the main body of SW as shown below. Can this suffice as being the "skeleton" structure for all future programs that I write?


list      p=12F675      ; list directive to define processor
#include <p12f675.inc>   ; processor specific variable definitions

__CONFIG  _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON & _INTRC_OSC_NOCLKOUT & _MCLRE_OFF & _CPD_OFF



;****************************************************************************
;Defines
;****************************************************************************

;****************************************************************************
;General Purpose Registers (GPR's)
;****************************************************************************



;****************************************************************************
;Reset Vector
;****************************************************************************
   ORG     0x000      ; processor reset vector
   nop          ; required by in circuit debugger
   goto    Init      ; go to beginning of program

;****************************************************************************
;Interrupt Vector     
;****************************************************************************
   ORG     0x004
   return          ; interrupt trap - return without re-enabling

;****************************************************************************
;Initialization
;****************************************************************************

;****************************************************************************
;Main
;****************************************************************************
Main

END

mobbarley:
Looks okay - except that it says "goto Init" - but there is no Init.

Here is a good step by step PIC ASM tutorial.
http://www.mstracey.btinternet.co.uk/pictutorial/picmain.htm

EENG:
Thanks for the weblink supoplied. I visited that web link and I am busy reading this step by step

So If I understand you correctly, the structure below wil suffice after I have deleted the "goto init" right?

mobbarley:
No - but usually you will 'goto init' to get to the initialisation section where you will configure the device, and then it will enter the main portion of the program (usually a loop). Run through that tutorial - you won't need your structure yet. By the end of it you should know the use of gotos and orgs.

EENG:
I am starting to get the hang of it

I turned on my first LED. The tutprial on the HTTP link is very very useful...thanks

Navigation

[0] Message Index

There was an error while thanking
Thanking...
Go to full version