Parallel Pin Control
hello
i have pretty specific question how address pins in parallel.
if send value 55 or "110111" pio_sodr (c) or address 0x400e1230 set pin 33 ( pin c1 ) on arduino due board.
if send 60 pin 35 ( pin c3 ) set.
now want set more 1 pin @ once.
but couldnt find ressource tells me how value send interpreted pioc.
i tried sendind 115 ( 60+55 ) set c1 , c3.
now used 60 xor 55 = 11 , set c1 , c3.
but xor doesnt work @ different values.
so question is:
how axcess different pin patterns inside pio (c).
i got pin-out diagramm there values setting 1 specific pin.
is there special method calculate values pinvalues @ pinout-diagramm.
i have pretty specific question how address pins in parallel.
if send value 55 or "110111" pio_sodr (c) or address 0x400e1230 set pin 33 ( pin c1 ) on arduino due board.
if send 60 pin 35 ( pin c3 ) set.
now want set more 1 pin @ once.
but couldnt find ressource tells me how value send interpreted pioc.
i tried sendind 115 ( 60+55 ) set c1 , c3.
now used 60 xor 55 = 11 , set c1 , c3.
but xor doesnt work @ different values.
so question is:
how axcess different pin patterns inside pio (c).
i got pin-out diagramm there values setting 1 specific pin.
is there special method calculate values pinvalues @ pinout-diagramm.
hello demokra,
i started lerning due issue.
and has taken several hours understand, how handle such things.
it rather easy, if understand background of software development. there lot of header files (*.h) describing memory organisation of microcontroller.
via c(c++) may address registers of microcontroller predefined pointers.
so e.g. reg_pioa_odsr points output data status register of port a.
to start easy:
use pinmode(i, output) setting pin of due used output.
look schematic of board, map pins of board ports of mikrocontroller.
to set 3 bits of port @ same time, connected board pins > 22, , not change other bit of port a, use e.g.
reg_pioa_odsr |= 0xc080;
to reset these 3 bits without changing other bit, use
reg_pioa_odsr &= ~0xc080;
in same manner can initialize port bits using reg_pioa_per, reg_pioa_oer, etc. instead of calling pinmode(...).
look @ databook of sam3x (atmel) meaning of per, oer, etc.
even can define own pointers (pointers 32 bit) registers using physical memory addresses given in databook. defined somewhere in \arduino-1.5.2\hardware\arduino\sam\system\cmsis\device\atmel\sam3xa\include\instance\instance_pioa.h
i hope, helps you.
i started lerning due issue.
and has taken several hours understand, how handle such things.
it rather easy, if understand background of software development. there lot of header files (*.h) describing memory organisation of microcontroller.
via c(c++) may address registers of microcontroller predefined pointers.
so e.g. reg_pioa_odsr points output data status register of port a.
to start easy:
use pinmode(i, output) setting pin of due used output.
look schematic of board, map pins of board ports of mikrocontroller.
to set 3 bits of port @ same time, connected board pins > 22, , not change other bit of port a, use e.g.
reg_pioa_odsr |= 0xc080;
to reset these 3 bits without changing other bit, use
reg_pioa_odsr &= ~0xc080;
in same manner can initialize port bits using reg_pioa_per, reg_pioa_oer, etc. instead of calling pinmode(...).
look @ databook of sam3x (atmel) meaning of per, oer, etc.
even can define own pointers (pointers 32 bit) registers using physical memory addresses given in databook. defined somewhere in \arduino-1.5.2\hardware\arduino\sam\system\cmsis\device\atmel\sam3xa\include\instance\instance_pioa.h
i hope, helps you.
Arduino Forum > Products > Arduino Due (Moderator: fabioc84) > Parallel Pin Control
arduino
Comments
Post a Comment