ON 20070709@8:26:39 PM at page: http://www.piclist.com/microchip/language/c/time.htm#39271.9408217593 James Newton[JMN-EFP-786] removed post 39271.9408217593 |Delete ' chapalapachala ' ON 20070725@9:53:22 AM at page: http://www.piclist.com/techref/microchip/language/c/serial2spi-dk.htm# James Newton[JMN-EFP-786] edited the page. Difference: http://www.piclist.com/techref/diff.asp?url=H:\techref\microchip\language\c\serial2spi-dk.htm&version=1 ON 20070725@9:54:09 AM at page: http://www.piclist.com/techref/microchip/language/c/serial2spi-dk.htm#39287.9961805556 James Newton[JMN-EFP-786] published post 39287.9961805556 sharma_atul13@yahoo.com asks:
I am a begginer in Embedded systems field.I am currently working on PIC16F913 and trying to establish serial communication between two wireless modules using this PIC .I am unable to establish it by the following code:
#include <16f913.h>

#byte osccon=0x8f
#byte cmcon0=0x9c
#byte ansel=0x91
#byte port_a=5
#byte port_c=7
#byte port_b=6
#byte port_e=9
#byte lcdps=0x108
#byte lcdse0=0x11c
#byte lcdse1=0x11d
#byte lcdcon=0x107
#byte	lcddata0=0x110
#byte	lcddata1=0x111
#byte	lcddata3=0x113
#byte	lcddata4=0x114
#byte	lcddata6=0x116
#byte	lcddata7=0x117
#byte	lcddata9=0x119
#byte	lcddata10=0x11a
#byte pir1=0x0c
#byte pie1=0x8c
#byte tmr1h=0x0f
#byte tmr1l=0x0e
#byte eecon1=0x18c
#byte eecon2=0x18d
#byte eeadrl=0x10d
#byte eeadrh=0x10f
#byte eedatl=0x10c
#byte eedath=0x10e
#byte intcon=0x0b
#byte t1con=0x10
#byte tmr0=0x01
#byte option_reg=0x81
#byte trisb=0x86
#byte trisc=0x87
#byte trisa=0x85
#byte sspcon=0x14
#byte sspstat=0x94
#byte sspbuf=0x13
#byte intcon=0x0b

#use  delay(clock=8000000)

void main()
{
			osccon    =0x71;/*internal osc freq. 8 Mhz*/

         cmcon0    =0x07;/*make the comparators off*/
			ansel     =0x00;/*make the pins as digital i/o*/
         trisa     =0x20;/*according to the port a*/
         trisc     =0x80;/*enabling data out through SDO*/

         sspstat  |=0xc0;/*set the sample and phase*/
         sspcon    =0x30;/*enable the serial port bits and master mode fosc/4*/

         intcon   |=0xc0;/*enable all interrupts*/
         pie1     |=0x08;/*enable peripheral interrupt*/
         pir1     &=0xf7;/*reset peripheral interrupt flag*/
         sspbuf    =0x89;
         sspbuf    =0x0a;/*put the data to be sent */

         port_a &= 0xFE;/*led off*/
         delay_ms(200);/*delay 1 sec*/


 while(sspstat & 0x01);/*comparison for the int flag bit to be 1 if true go in*/


            port_a |= 0x01;/*led glow*/
            delay_ms(200);/*delay 1 sec*/
            port_a &= 0xFE;/*led off*/
            delay_ms(200);/*delay 1 sec*/

            pir1 &= 0xf7;/*make the flag bit zero again*/



         if(sspbuf !=0x0a)
         {

            port_a |= 0x01;
            delay_ms(1000);
            port_a &= 0xFE;
            delay_ms(1000);
        }


}
Please tell me what is the fault with this code??
|Delete 'P-' before: '' but after: '