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

problem with changing OUTPUT ports

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



Joined: 28 Sep 2010
Posts: 1

View user's profile Send private message

problem with changing OUTPUT ports
PostPosted: Tue Sep 28, 2010 4:54 pm     Reply with quote

I'm new in pic programing and so I get sample source from here to dim led... but I do something wrong.. the pin stays HIGH all the time.
Can someone correct this source?
The source is:
Code:

#INCLUDE <16F684.h>

#USE DELAY (CLOCK=4000000)
#FUSES INTRC_IO,NOWDT,NOPROTECT,NOPUT

void main(){
set_tris_a(1);
set_tris_c(0);
  while(1){
       output_high(PIN_C4);
       delay_ms(1000);
       output_low(PIN_C4);
       delay_ms(1000);
       }
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Sep 29, 2010 11:25 am     Reply with quote

Delete the TRIS statements. You don't need them. The compiler will set
the TRIS.

What is your compiler version ? It's given at the top of the .LST file,
which will be in your project directory.

How are you testing this ? In Proteus, or in hardware ? Have you ever
made this PIC do anything ? Is this your first PIC project ? Do you
have a pull-up resistor on the MCLR pin ? Etc.
W4GNS



Joined: 28 Sep 2010
Posts: 14
Location: Virginia, USA

View user's profile Send private message

works here
PostPosted: Wed Sep 29, 2010 7:24 pm     Reply with quote

I tried your program with only changing the 16f to a 18f2520 as my compiler is resriticted to 18f parts, and changed the delay from 1000 to 10, and all was fine. If you're using a software simulator to test your code 1000 delay will take forever, so drop delay to 10 and you should see the blinky. and remember to change the delay back to 1000 if you try it in real hardware.
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