Thread: Analogue register AD1PCFG

  1. #1
    Registered User
    Join Date
    Jul 2021
    Posts
    20

    Analogue register AD1PCFG

    Hi,

    I am trying to set some pins to digital.
    The datasheet for PIC32MX575F256L, shows this register.

    https://cboard.cprogramming.com/imag...AASUVORK5CYII=

    So i code this.

    Code:
    AD1PCFGbits.PCFG0 = 1;      //make digital
    Upon compiling i get this error

    main.c:41:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token

    Commenting out the register command, my code compiles and runs properly with no errors or warnings.

    If i place this line inside main() it compiles fine.
    Why does this register command have to be inside main() to compile ?

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,068
    Quote Originally Posted by Kisen View Post
    Hi,

    I am trying to set some pins to digital.
    The datasheet for PIC32MX575F256L, shows this register.

    So i code this.

    Code:
    AD1PCFGbits.PCFG0 = 1;      //make digital
    Upon compiling i get this error

    main.c:41:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token

    Commenting out the register command, my code compiles and runs properly with no errors or warnings.

    If i place this line inside main() it compiles fine.
    Why does this register command have to be inside main() to compile ?
    Some commands are required to be inside functions!
    Does this command effect the real world? If yes it always needs to be inside functions!

    Edit See What's the difference between declaring and defining in C and C++ - Cprogramming.com

    Tim S.
    Last edited by stahta01; 08-02-2021 at 01:27 PM.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. EIP register
    By George2 in forum C++ Programming
    Replies: 3
    Last Post: 07-21-2008, 03:41 AM
  2. register bug
    By avgprogamerjoe in forum C++ Programming
    Replies: 8
    Last Post: 07-10-2007, 02:27 PM
  3. help programming an analogue clock
    By godhand in forum Game Programming
    Replies: 3
    Last Post: 04-10-2004, 02:40 PM
  4. moving byte pointed to by contents of a register into another register. dos debug.
    By Brian in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 04-18-2003, 05:48 PM
  5. do we have to re-register
    By iain in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 08-11-2001, 08:00 AM

Tags for this Thread