|
|
View previous topic :: View next topic |
Author |
Message |
hadeelqasaimeh
Joined: 05 Jan 2006 Posts: 105
|
18f458 |
Posted: Thu Oct 05, 2006 11:27 am |
|
|
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
|
|
Posted: Thu Oct 05, 2006 4:02 pm |
|
|
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
}
} |
|
|
|
|
|
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
|