CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Trouble with bidir IO

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
spacewatch



Joined: 26 Nov 2003
Posts: 2
Location: University of Arizona

View user's profile Send private message Visit poster's website

Trouble with bidir IO
PostPosted: Sat Dec 20, 2003 9:34 pm     Reply with quote

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.

------------
In my .h file

#use delay(clock=20000000,restart_wdt)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7,RESTART_WDT)
#use fast_io(A)
#use fast_io(B)
#use fast_io(C)
#use fast_io(D)

My .c 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

View user's profile Send private message Visit poster's website

PostPosted: Mon Jan 12, 2004 1:18 pm     Reply with quote

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.

Andrew
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group