Page 1 of 1

xbee + sk40c

PostPosted: Mon Nov 18, 2013 4:01 pm
by atikahIsmail
i have write the code same like the tutorial at http://tutorial.cytron.com.my/2011/07/3 ... ontroller/ but there are some error..i don't know where the mistake..because this is first time i try to write in C..can u help me..

#include <pic.h>
#include <htc.h>
#include <string.h>

void uart_init(void)
{
SPBRG=129;
BRGH=1;
TXEN=1;
TX9;
RX9;
CREN=1;
SPEN=1;
}

unsigned char uart_rec(void)
{
unsigned int rec_data;
while(RCIF==0);
rec_data = RCREG;
return rec_data;
}

void uart_send(unsigned char data)
{
while(TXIF==0);
TXREG=data;
}

void uart_str(const char *s)
{
while(*s)uart_send(*s++);
}

void main(void)
{
uart_str(&quot;+++&quot;);
delay_ms(200);

uart_str(&quot;atmy1111&quot;);
uart_send(0xD);
delay_ms(200);

uart_str(&quot;atwr&quot;);
uart_send(0xD);
delay_ms;

uart_str(&quot;atdl2222&quot;);
uart_send(0xD);
delay_ms;

uart_str(&quot;atwr&quot;);
uart_send(0xD);
delay_ms(200);

uart_str(&quot;atcn&quot;);
uart_send(0xD);
delay_ms(200);
}

Re: xbee + sk40c

PostPosted: Wed Nov 20, 2013 3:35 pm
by yonghui
Show us the error shown by compiler at output

Re: xbee + sk40c

PostPosted: Wed Nov 20, 2013 7:16 pm
by atikahIsmail
this is the error..i still looking to solve this error..but i still can't find this

Re: xbee + sk40c

PostPosted: Thu Nov 21, 2013 11:33 am
by yonghui
U didnt write ur code properly. Double click the error in output to bring u to the line that contains error. Or find the error shown by report, got line and column there. 1st significant one u don't declare ur variable quot before use