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

Help me with dsPIC

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



Joined: 10 Mar 2010
Posts: 10

View user's profile Send private message

Help me with dsPIC
PostPosted: Tue Jul 13, 2010 6:23 am     Reply with quote

Hi everybody !

I'm new in dsPIC, I wrote a program, very simple, this is my code :

Code:
#include <30F2020.h>
#device *=16
#FUSES NOPROTECT, NOWDT, FRC
#use fast_io(d)

void main(){
   set_tris_d(0);
   setup_oscillator(OSC_RC);
   output_d(0);
   while(1);
}


I want set port D at low logic, but I when I tested, logic level of port is not high, I don't know where is problem, please help me, thank a lot !
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Wed Jul 14, 2010 11:35 am     Reply with quote

Where's the code for the function output_d(0);??

Post your full code (if it's short) or a test program (which that seems to not be) with your compiler version.

I think you need a #use delay (clock=<freq>) declaration.

Also, I think the setup_oscillator is redundant since you have a #FUSE to set the INTRC

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
pmuldoon



Joined: 26 Sep 2003
Posts: 218
Location: Northern Indiana

View user's profile Send private message

PostPosted: Thu Jul 15, 2010 12:21 pm     Reply with quote

What I see is:

Set all Port D pins to outputs;
Clear all Port D pins (logic low);
Wait forever;

And you say that you set port D low and when testing the port it is not high.

I don't see the problem.
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Thu Jul 15, 2010 12:25 pm     Reply with quote

pmuldoon wrote:
What I see is:

Set all Port D pins to outputs;
Clear all Port D pins (logic low);
Wait forever;

And you say that you set port D low and when testing the port it is not high.

I don't see the problem.


I don't either. (reviewing that output_d() is a CCS command I never use)...

Your code does exactly what you describe.

PORT D (all of it) has been set to 0.

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
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