View previous topic :: View next topic |
Author |
Message |
Bieli Guest
|
Port D and E as input 16F874A |
Posted: Mon May 19, 2003 3:50 am |
|
|
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 |
Posted: Tue May 20, 2003 2:16 am |
|
|
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
|
Re: Port D and E as input 16F874A - Listing |
Posted: Tue May 20, 2003 12:35 pm |
|
|
:=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 |
Posted: Wed May 21, 2003 2:18 am |
|
|
:=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 |
|
|
|