Author Topic: PIC 12F675 ASM file structure  (Read 4520 times)

0 Members and 1 Guest are viewing this topic.

Offline EENGTopic starter

  • Contributor
  • Posts: 21
PIC 12F675 ASM file structure
« on: January 21, 2012, 01:55:28 pm »
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
 

Offline mobbarley

  • Regular Contributor
  • *
  • Posts: 200
  • Country: au
Re: PIC 12F675 ASM file structure
« Reply #1 on: January 21, 2012, 02:09:25 pm »
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
 

Offline EENGTopic starter

  • Contributor
  • Posts: 21
Re: PIC 12F675 ASM file structure
« Reply #2 on: January 21, 2012, 02:17:46 pm »
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?
 

Offline mobbarley

  • Regular Contributor
  • *
  • Posts: 200
  • Country: au
Re: PIC 12F675 ASM file structure
« Reply #3 on: January 21, 2012, 02:20:53 pm »
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.
 

Offline EENGTopic starter

  • Contributor
  • Posts: 21
Re: PIC 12F675 ASM file structure
« Reply #4 on: January 21, 2012, 03:28:26 pm »
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
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf