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

Problems when changing from O/P to I/P

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







Problems when changing from O/P to I/P
PostPosted: Wed Mar 05, 2003 6:47 am     Reply with quote

Hello,

I am trying to link a pic16F877 to a sensirion SHT11 humidity sensor. I am basing my code on the sample code for an 80c51 processor.
It is a 1 wire interface, used for both reading and writing.
Initially I set it up using.

set_tris_b(0x01);
#USE FAST_IO(B)

next I send a data sequence to the device on RB2, then

set_tris_b(0x05); //RB2 as I/P, already given the name data
#USE FAST_IO(B)

while (DATA==1) {
delay_ms(1); }

This should loop until data has gone low but it exists this
loop straight away, when data is still high.
I dont think it is a timing problem as data is high for 5ms before the loop is called.

Any ideas??

Thanks
G Bremner
___________________________
This message was ported from CCS's old forum
Original Post ID: 12369
Hans Wedemeyer
Guest







Re: Problems when changing from O/P to I/P
PostPosted: Wed Mar 05, 2003 11:23 am     Reply with quote

:=while (DATA==1) {

What code are you using for DATA ?

Is it a #define or what ?
___________________________
This message was ported from CCS's old forum
Original Post ID: 12381
Graham Bremner
Guest







Re: Problems when changing from O/P to I/P
PostPosted: Thu Mar 06, 2003 4:55 am     Reply with quote

Hi,

Yes, I am just using #define.

I have got round the problem by using 2 pins. One for o/p and 1 for I/P. This now gives me a 2 wire connection to the pic and its works fine. Using an extra line but I had 2 spare anyway.

Thanks for your intrest

___________________________
This message was ported from CCS's old forum
Original Post ID: 12419
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Problems when changing from O/P to I/P
PostPosted: Thu Mar 06, 2003 1:59 pm     Reply with quote

:=Hi,
:=
:=Yes, I am just using #define.
:=
:=I have got round the problem by using 2 pins. One for o/p and 1 for I/P. This now gives me a 2 wire connection to the pic and its works fine. Using an extra line but I had 2 spare anyway.
:=
--------------------------------------------
I once posted some notes on how to convert their sample driver
for the SHT11 (written for the Keil compiler) to CCS.
<a href="http://www.pic-c.com/forum/general/posts/3989.html" TARGET="_blank">http://www.pic-c.com/forum/general/posts/3989.html</a>

Here's their sample driver:
<a href="http://www.sensirion.com/en/pdf/ApplNote_SHTxx_c1.pdf" TARGET="_blank">http://www.sensirion.com/en/pdf/ApplNote_SHTxx_c1.pdf</a>
___________________________
This message was ported from CCS's old forum
Original Post ID: 12442
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