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

Proteus run incorrect with SPI between 2 PIC18, help me !

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



Joined: 12 Mar 2011
Posts: 7

View user's profile Send private message

Proteus run incorrect with SPI between 2 PIC18, help me !
PostPosted: Mon Mar 14, 2011 1:17 pm     Reply with quote

Code:
#include<18F4520.h>
#use delay(clock=4000000)
#use FAST_IO(D)

void main()
{
   int number;

   setup_spi(SPI_MASTER );
   while(1)
   {
      number = input_D();
      spi_write(number);
   }
   
   
}



Code:
#include<18F4520.h>
#use delay(clock=4000000)
#use FAST_IO( D)


void main()
{
   int8 num;
   setup_spi(SPI_SLAVE );
   while(1)
   {
      num = spi_read();
      output_D(num);   
   }

}





PORTD of Slaver do not change when I change input to MASTER and it run incorrect.
Please help me. Thanks a lot.
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Mar 14, 2011 2:22 pm     Reply with quote

hmmm... you're using fast_io() but where's your setup of the tris registers ?
Have you disabled other peripherals you don't use ?
Do you need a chip select for the slave ?
Your hardware for switch and LED is incomplete.
active high, active low ?
iVoVa



Joined: 12 Mar 2011
Posts: 7

View user's profile Send private message

PostPosted: Tue Mar 15, 2011 3:55 am     Reply with quote

temtronic wrote:
hmmm... you're using fast_io() but where's your setup of the tris registers ?
Have you disabled other peripherals you don't use ?
Do you need a chip select for the slave ?
Your hardware for switch and LED is incomplete.
active high, active low ?


Thanks temtronic so much, i have solved problem, pin SS must be connected GND.
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