Author Topic: PIC - Use of 'ifdef' directive  (Read 957 times)

0 Members and 1 Guest are viewing this topic.

Offline SparkyChrisTopic starter

  • Newbie
  • Posts: 2
  • Country: gb
PIC - Use of 'ifdef' directive
« on: November 03, 2017, 01:48:48 pm »
Hello Everyone,

I'm hoping one of you smart people might be able to help my understanding on something.
I have been given some code to familiarize myself with, and I'm a bit confused with the use of the 'setdef' as shown below, can anyone shed some light on what its doing?.
This is code written in MBLAB IDE for a PIC18F452

Code: [Select]
ifdef #GaugeResultLine1
   setdef @GaugeResultLine1, #GaugeResultLine1
endif

Many Thanks,
Chris
 

Offline cv007

  • Frequent Contributor
  • **
  • Posts: 825
Re: PIC - Use of 'ifdef' directive
« Reply #1 on: November 03, 2017, 02:38:15 pm »
'setdef' is most likely a macro (in the same file, or include file)
probably something like-

setdef macro a,b
    #define a b
    endm

so, basically- if #GaugeResultLine1 is defined, also define @GaugeResultLine1 to be the same
 
The following users thanked this post: SparkyChris

Offline SparkyChrisTopic starter

  • Newbie
  • Posts: 2
  • Country: gb
Re: PIC - Use of 'ifdef' directive
« Reply #2 on: November 03, 2017, 02:58:06 pm »
Thanks, that was spot on. I searched for, and found the macro inside an include file...and a few more which explains a few others!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf