Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

Help, error with types on constants and var's

Korean company maker of Robot kits and servos designed for of articulated robots. Re-incarnation of Megarobotics.
7 postsPage 1 of 1
7 postsPage 1 of 1

Help, error with types on constants and var's

Post by koli » Thu May 20, 2010 9:41 am

Post by koli
Thu May 20, 2010 9:41 am

Hi,
even they are declared as same type (char) I get the next error when I try to compile source:
a value of type 'const void' can't be assigned to an entity type 'unsigned char'
I'm using codevision AVR

The example of code is:

char PosSend(char ServoID, char SpeedLevel, char Position)
{
char Current;
SendOperCommand((SpeedLevel<<5)|ServoID, Position);
GetByte(TIME_OUT1);
Current = GetByte(TIME_OUT1); // LINE WHERE I GOT THE ERROR
return Current;
}

This code is an example of robobuilder-creator-users-manual.pdf page 63
Hi,
even they are declared as same type (char) I get the next error when I try to compile source:
a value of type 'const void' can't be assigned to an entity type 'unsigned char'
I'm using codevision AVR

The example of code is:

char PosSend(char ServoID, char SpeedLevel, char Position)
{
char Current;
SendOperCommand((SpeedLevel<<5)|ServoID, Position);
GetByte(TIME_OUT1);
Current = GetByte(TIME_OUT1); // LINE WHERE I GOT THE ERROR
return Current;
}

This code is an example of robobuilder-creator-users-manual.pdf page 63
koli
Robot Builder
Robot Builder
Posts: 7
Joined: Mon Apr 12, 2010 4:34 pm

Post by i-Bot » Thu May 20, 2010 2:09 pm

Post by i-Bot
Thu May 20, 2010 2:09 pm

The function prototype for GetByte in the example appears to have a void return:
void GetByte(char timeout); // Receive 1 Byte from serial port
I guess this should be a char returned to match your serial routines.
The function prototype for GetByte in the example appears to have a void return:
void GetByte(char timeout); // Receive 1 Byte from serial port
I guess this should be a char returned to match your serial routines.
i-Bot
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 1142
Joined: Wed May 17, 2006 1:00 am

Post by koli » Thu May 20, 2010 2:32 pm

Post by koli
Thu May 20, 2010 2:32 pm

thanks!!!

Please did you may, to put on the code of the function GetByte and that of the SendByte??

not find in any site,
GetByte receibe 1 byte from serial port
SendByte send 1 byte to serial port

Thank you very much in advance.
thanks!!!

Please did you may, to put on the code of the function GetByte and that of the SendByte??

not find in any site,
GetByte receibe 1 byte from serial port
SendByte send 1 byte to serial port

Thank you very much in advance.
koli
Robot Builder
Robot Builder
Posts: 7
Joined: Mon Apr 12, 2010 4:34 pm

Post by l3v3rz » Fri May 21, 2010 12:04 am

Post by l3v3rz
Fri May 21, 2010 12:04 am

I think you need these two routines .... (from Comm.c)

Note - the timeout seems to fixed at RX_T_OUT. Also needs the Timer Int running to update gMSec.

Code: Select all

#define RX_T_OUT       20  // from Comm.h

//------------------------------------------------------------------------------
// void SendByte(BYTE)
//------------------------------------------------------------------------------
void sciTx0Data(BYTE td)
{
   while(!(UCSR0A&(1<<UDRE)));    
   UDR0=td;
}


//------------------------------------------------------------------------------
// BYTE ReadByte()
//------------------------------------------------------------------------------
BYTE sciRx0Ready()
{
   WORD   startT;
   startT = gMSEC;
   while(!(UCSR0A&(1<<RXC)) ){    
        if(gMSEC<startT>RX_T_OUT) break;
        }
      else if((gMSEC-startT)>RX_T_OUT) break;
   }
   return UDR0;
}
I think you need these two routines .... (from Comm.c)

Note - the timeout seems to fixed at RX_T_OUT. Also needs the Timer Int running to update gMSec.

Code: Select all

#define RX_T_OUT       20  // from Comm.h

//------------------------------------------------------------------------------
// void SendByte(BYTE)
//------------------------------------------------------------------------------
void sciTx0Data(BYTE td)
{
   while(!(UCSR0A&(1<<UDRE)));    
   UDR0=td;
}


//------------------------------------------------------------------------------
// BYTE ReadByte()
//------------------------------------------------------------------------------
BYTE sciRx0Ready()
{
   WORD   startT;
   startT = gMSEC;
   while(!(UCSR0A&(1<<RXC)) ){    
        if(gMSEC<startT>RX_T_OUT) break;
        }
      else if((gMSEC-startT)>RX_T_OUT) break;
   }
   return UDR0;
}
l3v3rz
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by koli » Mon May 24, 2010 10:00 am

Post by koli
Mon May 24, 2010 10:00 am

These routines give me many mistakes

//------------------------------------------------------------------------------
// void SendByte(BYTE)
//------------------------------------------------------------------------------
void sciTx0Data(BYTE td) // ERROR:DECLARATION SYNTAX ERROR
{
while(!(UCSR0A&(1<<UDRE)));
UDR0=td; //ERROR: a value of type(*)()' can't be assigned to an entity of type unsigned 'sfrb'

}

void sciTx1Data(BYTE td)// ERROR:DECLARATION SYNTAX ERROR
{
while(!(UCSR1A&(1<<UDRE)));
UDR1=td; //ERROR: a value of type(*)()' can't be assigned to an entity of type unsigned 'unsigned char'

}

Not as solving them

Thank you
These routines give me many mistakes

//------------------------------------------------------------------------------
// void SendByte(BYTE)
//------------------------------------------------------------------------------
void sciTx0Data(BYTE td) // ERROR:DECLARATION SYNTAX ERROR
{
while(!(UCSR0A&(1<<UDRE)));
UDR0=td; //ERROR: a value of type(*)()' can't be assigned to an entity of type unsigned 'sfrb'

}

void sciTx1Data(BYTE td)// ERROR:DECLARATION SYNTAX ERROR
{
while(!(UCSR1A&(1<<UDRE)));
UDR1=td; //ERROR: a value of type(*)()' can't be assigned to an entity of type unsigned 'unsigned char'

}

Not as solving them

Thank you
koli
Robot Builder
Robot Builder
Posts: 7
Joined: Mon Apr 12, 2010 4:34 pm

Post by l3v3rz » Mon May 24, 2010 6:37 pm

Post by l3v3rz
Mon May 24, 2010 6:37 pm

assuming you're using gcc avr or windows equivalent then make sure you have Macro.h or at least include the following
Code: Select all
#define   BYTE   unsigned char
#define   WORD   unsigned int
#define   UDRE   5
#define   RXC      7

#define DATA_REGISTER_EMPTY   (1<<UDRE)
#define RX_COMPLETE         (1<<RXC)


The receive function requires the timer interrupt to enable timeouts, or you could remove that code
assuming you're using gcc avr or windows equivalent then make sure you have Macro.h or at least include the following
Code: Select all
#define   BYTE   unsigned char
#define   WORD   unsigned int
#define   UDRE   5
#define   RXC      7

#define DATA_REGISTER_EMPTY   (1<<UDRE)
#define RX_COMPLETE         (1<<RXC)


The receive function requires the timer interrupt to enable timeouts, or you could remove that code
l3v3rz
Savvy Roboteer
Savvy Roboteer
Posts: 473
Joined: Fri Jul 18, 2008 2:34 pm

Post by koli » Wed May 26, 2010 9:53 am

Post by koli
Wed May 26, 2010 9:53 am

Thank you, Macro.h was not using.

I am begginer, and do not know like well this works.
Thank you, Macro.h was not using.

I am begginer, and do not know like well this works.
koli
Robot Builder
Robot Builder
Posts: 7
Joined: Mon Apr 12, 2010 4:34 pm


7 postsPage 1 of 1
7 postsPage 1 of 1