Yesterday 20:20
Forum: Proton Plus Compiler v3
Starter: Dave-S
Views: 0
Replies: 0
Yesterday 18:25
Forum: The Lounge
Starter: Henk57
Views: 0
Replies: 104
Yesterday 11:22
Forum: WIKI Discussion
Starter: AlbertoFS
Views: 0
Replies: 14
+ Reply to Thread
Results 1 to 3 of 3

Thread: Preprocessor woes94 days old

  1. #1
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,691
    Thumbs Up
    Received: 150
    Given: 151
    Total Downloaded
    2.83 GB

    0 Not allowed!

    Default Preprocessor woes

    In a previous thread here about $if Les posted

    That's because the $define now equals "19200 Then" and not just "19200", so it will always be false.

    $defines work purely on text.
    As a 16F690 has 1 USART, _usart should and appearently is 1. Why isn't the preprocessor error generated?

    Code:
      Device = 16F690
    
      $define D_HardSerialNum 2
        
      $if D_HardSerialNum > _usart
        $error "Incorrect setting for D_HardSerialNum - nonexistant USART" 
      $endif
    Am I comparing the text "2" with the text "_usart"? if so then thats weird cause I use comparisons like that that produce correct results. eg $if _xtal = 48
    Last edited by towlerg; 15th April 2018 at 16:13.
    George

  2. #2
    Fanatical Contributor Les's Avatar
    Join Date
    Feb 2002
    Posts
    2,898
    Thumbs Up
    Received: 294
    Given: 109
    Total Downloaded
    1.50 GB

    0 Not allowed!

    Default Re: Preprocessor woes

    The preprocessor has the $define _uart 1, so the code below works as expected:

    Code:
        Device = 16F690
    
      $define D_HardSerialNum 2
        
      $if D_HardSerialNum > _uart
        $error "Incorrect setting for D_HardSerialNum - nonexistant USART" 
      $endif
    I'll change the .def files so that both _usart and _uart are assigned, because MIcrocohip changed their mind about the peripheral's name. It was, and still is, a UART, but is now designated a USART! I'll also add it to the manual, and change the IDE's mcp file to match.
    For more example programs for Proton and Proton24 or updates, please visit: Proton WIKI or Proton Files

  3. #3
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,691
    Thumbs Up
    Received: 150
    Given: 151
    Total Downloaded
    2.83 GB

    1 Not allowed!

    Default Re: Preprocessor woes

    Thanks Les, how foolish of me though, I looked in the def file but didn't see the difference in the spelling.
    George

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Bootloader woes
    By towlerg in forum Proton Plus Compiler v3
    Replies: 4
    Last Post: 24th June 2016, 18:20
  2. HRSIN woes !
    By C_Moore in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 3rd August 2008, 16:35
  3. RS232 Woes
    By Whitt in forum Proton Plus Compiler v3
    Replies: 5
    Last Post: 19th October 2006, 19:06
  4. Bootloader woes
    By ScottBridges in forum Mecanique - IDE
    Replies: 3
    Last Post: 26th January 2006, 14:37

Members who have read this thread since 15th July 2018, 15:36 : 0

Actions :  (Set Date)  (Clear Date)

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts