Where are they defined?

I'm trying to understand a code, but there are variables in it that I can't find where they are defined. E.g.: DACC_INTERFACE_ID , DACC ,DACC_ACR_IBCTLCH0(0x02) , PIO_PB25B_TIOA0 ,...

  pmc_enable_periph_clk (DACC_INTERFACE_ID) ; 
  dacc_set_transfer_mode(DACC, 0);          
  dacc_set_power_save(DACC, 0, 1);         
  dacc_set_analog_control(DACC, DACC_ACR_IBCTLCH0(0x02) | DACC_ACR_IBCTLCH1(0x02) | DACC_ACR_IBCTLDACCORE(0x01));
  dacc_set_trigger(DACC, 1);           

  PIOB->PIO_PDR = PIO_PB25B_TIOA0;    // PIO Disable register 
  PIOB->PIO_IDR = PIO_PB25B_TIOA0;    // Interrupt disable register
  PIOB->PIO_ABSR |= PIO_PB25B_TIOA0;  // AB Select register 

I pretty much understand the commands just don’t know what values you give them.
Where are these defined?

In a .h file somewhere.

Which Arduino are you using ?
What devices is it connected to or communicating with ?

Please post a complete sketch rather than just a snippet so that the context of the question can be seen

For instance, are you using a library ?

I only use the Arduino Due there is no external circuitry.
The program makes a sinusoidal signal to the output of the DAC.
No library is invited.

I started from this program for the most part. Essentially, I want to understand how this works.

find . -name "*.h" | xargs grep -l "PIO_PB25B_TIOA0"

All you have to do is find an appropriate place for . to be.

1 Like

Only between more than 1000 files.

If you switch to the Arduino IDE 2.0 beta you can right click on the desired constant(variable, function, or whatever) and click "go to definition" and it will open the file where it is defined.

Eclipse / Sloeber supports this too. Try:

A tool like grep is used to locate strings in a whole directory structure - pretty much essential.

cd /

Maybe go for coffee or buy a new 'puter.


I'll check it out but I can't install it on this computer right now.

That's okay, but again, I'm basically there.
Here I just got what DACC_INTERFACE_ID is, but now I don't know what ID_DACC means.
I also looked at the microcontroller’s datasheet for example but there was none of either.

Then you search for the next identifier: ArduinoCore-sam/sam3x8c.h at 790ff2c852bf159787a9966bddee4d9f55352d15 · arduino/ArduinoCore-sam · GitHub

It's the peripheral identifier of the DAC peripheral, which makes sense because that's the argument that the pmc_enable_periph_clk function expects: https://asf.microchip.com/docs/latest/sam3x/html/group__sam__drivers__pmc__group.html#gad09de55bb493f4ebdd92305f24f27d62

Have you tried using grep, Google or GitHub search or your IDE's "go to definition" functionality?

Strange but allowed the computer to install.
The arduino 2.0 method works.

Thanks for the help.

I got exactly seven.


This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.