Hi @autics,
Each port pin is mapped to the following 32-bit GPIO registers, each bit represents a pin in the port x:
- GPIOx->PDOR. Data Output
- GPIOx->PSOR. Set Output
- GPIOx->PCOR. Clear Output.
- GPIOx->PTOR. Toggle Output
- GPIOx->PDIR. Input register
- GPIOx->PIDR. Input disable register
- GPIOx-> PDDR. Data Direction register
If the PDIR of a pin is cleared, then it is configured as an input. If the PDIR of a pin is set, it is configured as output, which means that the logic state is controlled via PDOR or PCOR, PSOR and PTOR.
In your code modification, you are trying to clear the output for PTD0 with "PTD->PDOR|= 0<<PTD0". To clear a bit, it should be instead done with the AND operator, for example: "PTD->PDOR&= ~(1<<PTD0)"
Clearing the bit could be done this way, or (as the example includes) with the PCOR register. This is the same as setting the bit with PDOR or with PSOR (as the example includes).
I hope you find this helpful.
Best regards,
Julián.