also I see (for example in nigels tutorial) a reference to an *.inc file what exactly us this.
bsf 0x03, 0x02
bsf STATUS, Z
LIST
; P16F628.INC Standard Header File, Version 1.01 Microchip Technology, Inc.
NOLIST
; This header file defines configurations, registers, and other useful bits of
; information for the PIC16F628 microcontroller. These names are taken to match
; the data sheets as closely as possible.
; Note that the processor must be selected before this file is
; included. The processor may be selected the following ways:
; 1. Command line switch:
; C:\ MPASM MYFILE.ASM /PIC16F628
; 2. LIST directive in the source file
; LIST P=PIC16F628
; 3. Processor Type entry in the MPASM full-screen interface
;================================================= =========================
================================================= =========================
;
; Revision History
;
;================================================= =========================
;Rev: Date: Reason:
;1.01 13 Sept 2001 Added _DATA_CP_ON and _DATA_CP_OFF
;1.00 10 Feb 1999 Initial Release
;================================================= =========================
;
=========================
IFNDEF __16F628
MESSG "Processor-header file mismatch. Verify selected processor."
ENDIF
;================================================= =========================
That's the best reason I can think of for using a .inc file for any given chip. Figuring out the hex equivalent registers for any one chip would be hard enough. Keeping them straight in your head (e.g. which hex values represent which register functions) when you start using more than one chip would be near impossible.Diver300 said:Also it makes the source code more portable, meaning that it is easier to translate for other processors.
I'm not sure what the "LIST.. ...NO LIST" part's suppose to do exactly, so maybe someone else can clarify that.
For all my smart remarks, you'd think I'd be able to shed some light on how the stuff that isn't the code remarks works, but I can't. I'm not sure exactly how this "IF" statement works, but it looks like at this point in the .inc file it checks to make sure you did indeed select this particular chip before it goes ahead and does all the rest of the work in the .inc file. If the chip you've selected is different than this .inc file (i.e. the include file you've indicated in your .asm code in MPLAB), the .inc file returns an error at this point.Code:========================= IFNDEF __16F628 MESSG "Processor-header file mismatch. Verify selected processor." ENDIF ;================================================= =========================
ok so how do I set up the peripherals to my liking ? for example on the 16F88 how do I choose what the ports should be (PWM, ADC, standard) how do I choose the clock speed and clocking method ?
PORTA EQU H'0005'
ok so how do I set up the peripherals to my liking ? for example on the 16F88 how do I choose what the ports should be (PWM, ADC, standard) how do I choose the clock speed and clocking method ?
ah right so basically the inc file is just telling the assembler what I'm talking about when i name a register or port its not about telling the pic what i want the pins to be
you dont tell the pic which pins is what ......you select its option for that specific pin. Like look at the pic diagrams. in the datasheet. It will tell you what pin does what.
you control the pins from code. Not what port should be this and that but ... what this and that can do on the port its on.
Hope your not too confused with this post lol
To make things even more confusing, with some of the highest spec PICs (24F. dsPIC, and so on) for some pins and functions you can control which functions are on which pins (Peripheral Pin Select).
in case you forgot the 16F88 does that too thats what I'm on about configuring the ports for what i want the 16F88 has ADC, timer, PWM outputs, and standard TTL logic
thats what i'm trying to say.
so if i get this right at the begining of the program I move a byte (or two) into a few registers which set it up the way I want just like i am writing a byte to any port or register.
in case you forgot the 16F88 does that too thats what I'm on about configuring the ports for what i want the 16F88 has ADC, timer, PWM outputs, and standard TTL logic
thats what i'm trying to say.
so if i get this right at the begining of the program I move a byte (or two) into a few registers which set it up the way I want just like i am writing a byte to any port or register.
oh I'm not confused by whats available etc I'm aware that a pic can do a few of many things at one time and as long as you set up the ports to be what you want you can work trouble free not worrying about the unused functions, yes even the 16F88 has more than one pin that can do things like ADC
for example:
PIC microcontrollers : chapter 7 - Examples
the line below the pic model *.inc line is something i never really found explanations for are these what declare the functions of the ports the clock speed the type of clock used etc etc
ok looks like i need to keep the datasheet very handy
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?