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 CCS Technical Support

18f458

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



Joined: 05 Jan 2006
Posts: 105

View user's profile Send private message

18f458
PostPosted: Thu Oct 05, 2006 11:27 am     Reply with quote

hi all
i try to use pic18f458,,i write simple code that input avalue from port and out it into other port but it dosent work,,,i use proutus simulator
please if any have some sample code and schematic
thanx
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Oct 05, 2006 4:02 pm     Reply with quote

Quote:

I write simple code that input a value from port and out it into other port
but it doesn't work

This is very easy to do, if you use the CCS functions to read a port
and output to a port. In the example below, the program reads Port B
and writes the data to Port D. The compiler will handle setting the
correct TRIS. You don't have to do it.
Code:

#include <18F458.h>
#fuses XT,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4000000)

//====================================
void main(void)
{
int8 value;

while(1)
  {
   value = input_b(); // Read Port B
   output_d(value);   // Write to Port 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