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

Port D and E as input 16F874A

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







Port D and E as input 16F874A
PostPosted: Mon May 19, 2003 3:50 am     Reply with quote

I use PCM 3.091.
I have problem with setting port D and E as input.
I used NO_ANALOGS and PSP_DISABLED, but I still have problem that port D works only when there is high level on RE0. I supose that its becouse of PSP.
Listing I will include tommorow.
Thanks for any suggestion.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514542
Bieli
Guest







Re: Port D and E as input 16F874A - Listing
PostPosted: Tue May 20, 2003 2:16 am     Reply with quote

Am I doing something wrong or port D is always depend on RE0?
Port D work as input only when RE0 is high. Otherwise some bits works other (ex. RD0) doesn't

#include <16F874A.h>
#fuses HS, NOLVP, NOPROTECT, NOWDT

#use delay(clock=4000000)

#include <lcd.c>

byte Dane1, Dane2;

main()
{ byte a;
setup_adc_ports(NO_ANALOGS);
setup_psp(psp_disabled);
lcd_init();
printf(lcd_putc,"Start");
delay_ms(1000);
while(1)
{

Dane1=input_e();
Dane2=input_d();
a=7;
printf(lcd_putc,"\f");
do
{ printf(lcd_putc,"\%d",bit_test(Dane1,a));
a--;
} while(a!=0xFF);
a=7;
do
{ printf(lcd_putc,"\%d",bit_test(Dane2,a));
a--;
} while(a!=0xFF);
delay_ms(100);
}
}

Thanks for help.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514574
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Port D and E as input 16F874A - Listing
PostPosted: Tue May 20, 2003 12:35 pm     Reply with quote

:=Am I doing something wrong or port D is always depend on RE0?
:=Port D work as input only when RE0 is high. Otherwise some bits works other (ex. RD0) doesn't.
---------------------------------------------------------

Both ports D and E have Schmitt trigger inputs. This means
that a high level must be at least 4 volts, before you can
read it as a logic "1". (This assumes your Vcc is 5 volts).

What voltage do you have on the pins ?
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514599
Bieli
Guest







Re: Port D and E as input 16F874A - Listing
PostPosted: Wed May 21, 2003 2:18 am     Reply with quote

:=What voltage do you have on the pins ?
About 4,9V

For now it works when I added #use fast_io(E)
But if You have any suggestion I'll be greatfull.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514621
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