#156929 - Key_46 - Fri May 16, 2008 10:37 am
hi, i am trying to connect a small DC motor(not like Rumble Pack) and a small switch and i don't know what pins should i use and how to access the via code... i am thinking to use /WR for out and /RD for in. will this work?
#156931 - Maxxie - Fri May 16, 2008 11:03 am
/RD and /WR are not data, they control the dataflow on the Adr/Data Lines
#156954 - Maxxie - Fri May 16, 2008 8:29 pm
You can't as it is NOT a single address IO Port.
For a simple IO that runs on every address on that bus (you can access it by reading or writing any address from 0x08000000 to 0x09FFFFFF) you need to apply two latches.
The input should only be passed to the bus (on the AD lines), when /CS = 0 and /RD = 0.
The output is only valid to read when /CS = 0 and /WR = 0. You need to buffer the output if you want to work with it.
#157139 - griff - Mon May 19, 2008 7:29 pm
Do you think it's possible to make a serial communication using the GBA port, to communicate with a PC or something like that?!
#157204 - Key_46 - Tue May 20, 2008 10:18 am
Again, a new solution, this time a little bit more complicated: A Little Microcontroller connected to /WR, /RD, AD1, AD2, my actuator (via transistor ) and my switch. When i press the switch the PIC forces /WR to high and /RD to low, AD1 to high. When i release it, the PIC forces /RD to high and /WR to low and controls the motor using AD2.
*i will try do something more simple using just logical ports...
And, for the code, how can i know if the DS is in read or write mode?