PIC 12F675 ASM file structure  - Page 1
Forum section: electronics / general

author: EENG
author_rank: Contributor
timestamp: January 21, 2012, 01:55:28 pm
content: HalloI 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 vectornop ; required by in circuit debuggergoto Init ; go to beginning of program;****************************************************************************;Interrupt Vector;****************************************************************************ORG 0x004return ; interrupt trap - return without re-enabling;****************************************************************************;Initialization;****************************************************************************;****************************************************************************;Main;****************************************************************************MainEND

author: mobbarley
author_rank: Regular Contributor
timestamp: January 21, 2012, 02:09:25 pm
content: 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

author: EENG
author_rank: Contributor
timestamp: January 21, 2012, 02:17:46 pm
content: Thanks for the weblink supoplied. I visited that web link and I am busy reading this step by stepSo If I understand you correctly, the structure below wil suffice after I have deleted the "goto init" right?

author: mobbarley
author_rank: Regular Contributor
timestamp: January 21, 2012, 02:20:53 pm
content: 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.

author: EENG
author_rank: Contributor
timestamp: January 21, 2012, 03:28:26 pm
content: I am starting to get the hang of itI turned on my first LED. The tutprial on the HTTP link is very very useful...thanks