$define statements in my Main program not being recognised

Started by JohnB, Jun 09, 2022, 02:09 PM

Previous topic - Next topic

JohnB

I have been adapting the DS1307 RTC include file to the PCF8523 RTC as I wanted 3.3V working and I could not get hold of a DS1337 device.

In my Include file I have this:
$ifndef PCF8523_SCL_Pin
    $define PCF8523_SCL_Pin PORTB.0         ' SCL connected to this pin
    $SendWarning "The $define PCF8523_SCL_Pin is missing from the main program. Defaulting to using PORTB.0"
$endif
$ifndef PCF8523_SDA_Pin
    $define PCF8523_SDA_Pin PORTB.1         ' SDA connected to this pin
    $SendWarning "The $define PCF8523_SDAL_Pin is missing from the main program. Defaulting to using PORTB.1"
$endif
$ifNDef PCF8523_CLK_OUT_Pin
    $define PCF8523_CLK_OUT_Pin PortB.2      ' Square wave out connected to this pin
    $SendWarning "The $define PCF8523_ClkOut_Pin is missing from the main program. Defaulting to using PORTB.2"
$endIf

In my Main file I have

$define PCF8523_SCL_Pin PortB.1    ' RTC Clock
$define PCF8523_SDA_Pin PortB.0    ' RTC Data
$define PCF8523_ClkOut_Pin PortB.2    ' Square Wave Input pin

include "PCF8523.inc"

This is an extract from the Compiler report...

QuoteWarning! Line [22]   In file [D:\Documents\PDS\User\PoolController\PCF8523.INC]   *** The $define PCF8523_SCL_Pin is missing from the main program. Defaulting to using PORTB.0! ***
Warning! Line [26]   In file [D:\Documents\PDS\User\PoolController\PCF8523.INC]   *** The $define PCF8523_SDAL_Pin is missing from the main program. Defaulting to using PORTB.1! ***
Warning! Line [30]   In file [D:\Documents\PDS\User\PoolController\PCF8523.INC]   *** The $define PCF8523_ClkOut_Pin is missing from the main program. Defaulting to using PORTB.2! ***

I have the Main File Declares placed before the Include statement for the PCF8523 and all the procedures are being picked up so why are the defines not being seen?
JohnB

Dompie

In the .inc file: $ifNDef PCF8523_CLK_OUT_Pin
and in main:      $define PCF8523_ClkOut_Pin PortB.2    ' Square Wave Input pin

I think this is a typo (_ is missing) so the error for the other two still standing

Johan

JohnB

JohnB

Dompie

So that solves the other two also, lucky. I couldn't try it on my gsm.
Johan