PDA

View Full Version : plaese help check what is mean of this sentence,appreciate you



greatpic
- 14th April 2008, 07:11
I read a demo program , have this in the front of it, what is that mean?

DEFINE __16F876 1


"_ " seemed have some special function, related to the address of a varity? what about the double "_" meaning?

great thanks

mackrackit
- 14th April 2008, 07:57
That does not look like Pic Basic. Maybe protron?

mister_e
- 14th April 2008, 09:48
NAH certainely not Proton (PDS) they use DEVICE = 16F876.

I think this line have been taken somewhere on the forum. No real use in PBP unless you use it on ASM level.

If you use MPASM it already do that. Start a blank project and compile it, open the .LST file and you'll discover...

__16F876 00000001

Ok then what to do with it? Use MPASM AND paste the following line at the top of your code and try to compile for another pic than 16F877



asm
IFNDEF __16F877
ERROR "OPEN YOUR EYES.. YOU MUST SELECT 16F877 IN THE DROP MENU..."
ENDIF
ENDASM

:D

Still useful for conditional code compile.. ex if the PIC=16F877 do this, if it 18F452 do that etc etc etc.

You can define everything you want the way you want (almost)

DEFINE TGIF MISTER_E
DEFINE DOODAH_DOODAH 2

and use it later in asm level.

mackrackit
- 14th April 2008, 10:56
What does this line do?


DEFINE TGIF MISTER_E

Will it help my program?

mister_e
- 14th April 2008, 11:02
Depending the amount of cash, beer or freebies you assign to MISTER_E variable, it could help or totally ruin your whole life :D

mackrackit
- 14th April 2008, 11:06
OK, I will have to remember that :)

greatpic
- 15th April 2008, 08:00
I am sure this sentence is a part fo picbasic, withi ASM used.

still I do not know the function of "-"

"_ " seemed have some special function, related to the address of a varity? what about the double "_" meaning?

seemed always used as "_myvar" is ASM, and "myvar" in basic, they are the same value.

mister_e
- 15th April 2008, 16:05
Well yes and no, it depend how you define your variable

MyVar var BYTE
AnotherVar var BYTE SYSTEM
in asm, you will access MyVar as _MyVar, but AnotherVar will remain AnotherVar

Why the double underscore? I can't tell for sure, maybe just to avoid some double definition.. not much. _ is just another character.

You can't define a variable name which begin with a number though.
<hr>
i found an explanation... well sort of :o
http://mail.python.org/pipermail/python-list/2000-January/019711.html