Joined: 26 Nov 2003 Posts: 2 Location: University of Arizona
Trouble with bidir IO
Posted: Sat Dec 20, 2003 9:34 pm
Hey Folks:
I have been having problems with bi-dir IO on a 16F877. My logic analyzer
says I'm doing output just fine, however I don't seem to be receiving data.
Here's my code.
int usb_read(int address) // The user MUST return the D bus to ALL_IN after using this function!
{
output_c(~(ADDRESS | WRITE | C_SEL)); // Place control bus in address/write state.
set_tris_d(ALL_OUT); // Set the D bus to all outputs.
output_d(address); // Present internal reg address.
delay_ms(1);
output_c(DEF_ST); // End address cycle.
delay_ms(1);
set_tris_d(ALL_IN); // Set the D bus to all inputs.
output_c(~(READ | C_SEL)); // Place control bus in data/read state.
return(input_d()); // Read data from port and return it.
}
spacewatch
Joined: 26 Nov 2003 Posts: 2 Location: University of Arizona
Posted: Mon Jan 12, 2004 1:18 pm
Hey Folks:
As it turns out, that code was working. I had a side issue with my SL811HS
that made it look like I had an issue with bidir coms. So this thread should
be considered closed.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum