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 support@ccsinfo.com

I have problems with port D for pic18f4620 PLEASE HELP!!!!!!

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



Joined: 23 Mar 2006
Posts: 3
Location: Caracas, Venezuela

View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger

I have problems with port D for pic18f4620 PLEASE HELP!!!!!!
PostPosted: Thu Mar 23, 2006 8:54 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Mar 24, 2006 12:43 am     Reply with quote

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;
}

}
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