|
|
View previous topic :: View next topic |
Author |
Message |
oscarec60
Joined: 23 Mar 2006 Posts: 3 Location: Caracas, Venezuela
|
I have problems with port D for pic18f4620 PLEASE HELP!!!!!! |
Posted: Thu Mar 23, 2006 8:54 am |
|
|
I am programming the Pic18f4620 I have PCWH 3,203 and Plug-in of Mplab, and need to use port D for some things. I finish registering in the forum to request aid. Annexed I leave them I cosay that by very simple that it seems has errors and I have not been able to use port D that as much I need. Thank you very much reason why they
#include <18F4620.h>
#device adc=8
#use delay(clock=20000000)
#fuses NOWDT,WDT128,HS, NOPROTECT, IESO, BROWNOUT, BORV21, NOPUT, NOCPD, NOSTVREN, NODEBUG, NOLVP, NOWRT, NOWRTD, NOEBTR, NOCPB, NOEBTRB, NOWRTC, NOWRTB, NOFCMEN, NOXINST, NOPBADEN, NOLPT1OSC, NOMCLR
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
while (1)
{
delay_ms(500);
output_d(0x00);
delay_ms(500);
output_d(0x3f);
}
} |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Mar 24, 2006 12:43 am |
|
|
Maybe output_d() doesn't work on your version of the compiler.
I don't know, I don't have that version to test.
Try doing it this way:
Set the TRIS for Port D to be all output pins. Then write directly
to the Port D register. See the lines shown in bold below.
Quote: | #include <18F4620.H>
#fuses HS,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay (clock=20000000)
#byte PortD = 0xF83
//==============================
void main()
{
set_tris_d(0x00);
while (1)
{
delay_ms(500);
PortD = 0x00;
delay_ms(500);
PortD = 0x3F;
}
} |
|
|
|
|
|
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
|