I've been meaning to post this for while now, as I'm sure there are some Logic users who will/have run into this problem. The idea here is to be able to send MIDI to Csound from a track in Logic. The obvious choice in OSX would be to use the IAC bus. However, this tends to result in a MIDI feedback loop because of the way sequencers tend to read incoming MIDI data from all connected devices. The purpose of this post is to address the feedback loop in Logic, as it has to be done in the seldom used (for most users) Environment window.
First of all, go into OSX's Audio/MIDI Setup, click the MIDI Devices tab, and double click the IAC icon. Make sure there is a port available (click Add Port to create one if you need to) and that the "Device is online" box is checked. Now exit Audio/MIDI Setup.
Open Logic and create an external MIDI track. Set the track to whatever channel you want to use on the IAC bus. In Logic 8, you can just open the Library window on the right and drag the IAC channel to the track in the Arrange window. It would seem that this is all you should have to do. But, if you try to run Csound and record a MIDI track, you'll hear crap, if anything at all. This is because there is a feedback loop that constantly retriggering Csound.
Now, open the Environment window and go to the Clicks & Ports layer. You should see a Physical Input object on the right with your MIDI devices, including the IAC bus. This is where the MIDI feedback loop occurs. As data leaves the via the IAC bus, it is immediately being read back in at the Physical Input, which sends it to Logic, which sends it back out and reads it back in again. To fix this, create an object on this layer (I don't think it really matters which one). Connect the IAC port from the Physical Input to the new object. This will take the IAC's data from the SUM output, so it won't make its way back into Logic via the Sequencer Input object on the right.
After this, just run Csound (give it the -M flag corresponding to the IAC bus) and record a track into Logic. Everything should be working at this point.
If you also need to have MIDI coming into Logic from something else (such as Pd) via IAC, the simplest solution is to just create a new IAC port in Audio/MIDI Setup and use that. Feeding MIDI into Logic that doesn't need to go out doesn't get a feedback loop. If for some reason you really only want to use one port, you can connect the IAC output from the Physical Input object to a Channel Splitter object. Then just connect the SUM of the Channel Splitter to the Keyboard object and connect the channels going out of Logic to a different object like before.
Hope this helps someone.