How to do PIO programming?

Post content lost due to vandalism by author

Hello senioriceman,

You will find an example in this thread, reply #1 :

https://forum.arduino.cc/index.php?topic=441048.0

and chap. 31 of Sam3x datasheet is your best friend for PIO programming.

Furthermore, in the folder ...\Arduino15\packages\arduino\hardware\sam\1.6.9\system\CMSIS\Device\ATMEL\sam3xa you can find all register adress defines and also an HTML documentation for every register! It's really great I use it alot!

If you are interested you can use pointers too! But it's necessary to refer and understand the datasheet first :wink:

// Example for just to give you an Idea. Don't use this as it is
// This is to Write data to the ADC Channel Enable Register
// Memory Address = 0x400C0010
// Register Name = ADC_CHER
// Analog channels that I want to enable = 0,1,2,9
// Page no. 1338 on Datasheet

uint32_t * ADC_CHER = (uint32_t*)0x400C0010 //You can do this declaration on void setup or outside

// Writing values to the register

void setup(){

*ADC_CHER = 0x00000207; //Look in the page 1338 on data sheet.

}

This method will increase the speed of your code(According to my knowledge)

But be very careful when you are addressing registers