Help me in this code

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
Eng_Bandar
Posts: 65
Joined: 04 Jun 2010 01:13

Help me in this code

#1 Post by Eng_Bandar » 05 Aug 2010 20:09

my project if I send letter G from computer to pic led will on and this is my code

Code: Select all

char data;
void main()
{ 
trisb=0; // all portb are output
UART1_Init(9600); // speed is 9600
while(1)
{
if(UART1_Data_Ready()==1)
{ // when receiving data
data = UART1_Read(); // read data and store it in variable
if(data=='G') {portb.f0=1;}
}
}
}
my comiler is MikroC Pro 3.8 when I build the code errors come to me and these errors in attachments
Attachments
screenshot.jpg
screenshot.jpg (79.48 KiB) Viewed 1186 times

p.erasmus
Posts: 3391
Joined: 05 Mar 2009 10:28

Re: Help me in this code

#2 Post by p.erasmus » 05 Aug 2010 20:21

It seems that the variable data you are using is a keyword and reserved for the
C language or the mE compiler !!
I changed it to data_1 and the project compiles properly
Please read the language reference manual to inform your self about
the restricted words

Code: Select all

char data_1;
void main()
{
trisb=0; // all portb are output
UART1_Init(9600); // speed is 9600
while(1)
{
if(UART1_Data_Ready()==1)
{ // when receiving data
data_1 = UART1_Read(); // read data and store it in variable
if(data_1=='G') {portb.f0=1;}
}
}
}
Attachments
1.png
1.png (19.06 KiB) Viewed 1184 times
P.Erasmus
Saratov,Russia
--------------------------------------------------------------

Eng_Bandar
Posts: 65
Joined: 04 Jun 2010 01:13

Re: Help me in this code

#3 Post by Eng_Bandar » 06 Aug 2010 15:26

^^^^^^^^^
Thank you for your helping

Post Reply

Return to “mikroC PRO for PIC General”