Hi All, I have the problem of transfering information between 2 pics using SPI. I seem to be able to transfer 3 memory location from one to the other, but I cannot trasfer a fourth. The code I am using is as follows: MASTER: call select_2_mem_page movlw 0x11 movwf accelerating_lo_limit call select_2_mem_page movlw 0x55 movwf braking_lo_limit call select_2_mem_page movf accelerating_lo_limit,0 call write_sspbuf call select_2_mem_page movf braking_mid_limit,0 call write_sspbuf call select_2_mem_page movf braking_hi_limit,0 call write_sspbuf call select_2_mem_page movf braking_lo_limit,0 call write_sspbuf call select_2_mem_page movf accelerating_mid_limit,0 call write_sspbuf call select_2_mem_page movf accelerating_hi_limit,0 call write_sspbuf loop goto loop write_sspbuf ;writes the value in w to SSPBUF and wait for slave to read banksel SSPBUF movwf SSPBUF transmit_data banksel SSPIF btfss PIR1,SSPIF goto transmit_data bcf PIR1,SSPIF delay return SLAVE: call get_new_data call select_2_mem_page movwf accelerating_lo_limit call get_new_data call select_2_mem_page movwf braking_mid_limit call get_new_data call select_2_mem_page movwf braking_hi_limit call get_new_data call select_2_mem_page movwf braking_lo_limit call get_new_data call select_2_mem_page movwf accelerating_mid_limit call get_new_data call select_2_mem_page movwf accelerating_hi_limit loop goto loop get_new_data ;waitss for the interrupt ie new data has arrived in sppbuf ;then puts the data in w banksel SSPIF btfss PIR1,SSPIF goto get_new_data bcf PIR1,SSPIF banksel SSPBUF ; comf SSPBUF movf SSPBUF,0 At the beginning of the MASTER program I put a value in a memory location. At the end of SLAVE I read this memory location and put it on portD. This will work for the code above braking_lo_limit (ie portD is correct) This will not work for the code below and including braking_lo_limit (ie portD is incorrect) What am I doing wrong??? Thanks, Andrew Scott -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads