Problem with the Item post in the queue

nobody wrote on Wednesday, February 14, 2007:

Hi, Hope all is great there…

I´m trying to make 2 easy tasks with send and received function:

I defined the send function like this :

if( cQueueSend( ParamEvento.xQueueEvento,( void * ) &mensaje_e, pParamEvento->xBlockTime ) != pdPASS ) 

and the received like :

if(cQueueReceive( ParamEvento.xQueueEvento, &usDataRxEvento, ParamEvento.xBlockTime ) == pdPASS)

where mensaje_e and usDataRxEvento are signed portSHORT;

Tasks are running well but when I try to see wich is the value sent (in this case mensaje_e) the tasks doesn´t work.

These are the definitions: 

typedef struct PARAMETROS_DE_EVENTO
{
    xQueueHandle xQueueEvento;                   
    portTickType xBlockTime;
    char mensaje;
    portTickType DelayTime;        
}Param_evento;

static void Task_Ruedas( void *pvParameters );
static void Task_Encoder( void *pvParameters );

and the problem is when i´m trying to make something like:

if(ParamEvento.mensaje==usDataRxEvento){
      DUTY_PWM1=400;
      DUTY_PWM2=400;
      direccion=1;
       Configuracion_PWM();
      PORTBbits.RB4=direccion;
      PORTBbits.RB5=direccion;
     }     

Thanks so much for your help, i´ll waiting all your good ideas i don´t know what else can i do find a solution for this problem.

Thanks again and have a nice day!!!

Best Regards,

Lilian 

nobody wrote on Wednesday, February 14, 2007:

I cannot see anything wrong with your queue send or receive calls provided your mensaje and usDataRxEvento are just unsigned shorts, not pointers to unsigned shorts.

Is your problem simply that the value you send to the queue is not the value received?

Dave.

nobody wrote on Wednesday, February 14, 2007:

Hello Dave! thanks so much for your help…

yeah my problem is that…the value sent is not the value received… Do you know what is probably the reason ?

Thanks again for your help…i´ll waiting good news!!

Regards,

Lilian

nobody wrote on Thursday, February 15, 2007:

Hi,

Can you tell the statement for creating the queue?

Are you using the same structure for sending in queue , which you used in creating the queue??

It is very obvious that you would have done so, but just trying to find out the problem.

-regards

nobody wrote on Thursday, February 15, 2007:

Hi! thanks for your help this is the statement where I created the queue, and i´m using the same structure Param_Evento to send and receive:

typedef struct PARAMETROS_DE_EVENTO
{
xQueueHandle xQueueEvento; 
portTickType xBlockTime;
char mensaje;
portTickType DelayTime; 
}Param_evento;

pParamEvento1 = ( Param_evento * )pvPortMalloc( sizeof(Param_evento ) );
pParamEvento1->xQueueEvento = xQueueCreate(LONG_COLA,TAM_MENSAJE );    
pParamEvento1->xBlockTime = xDontBlock;
pParamEvento1->mensaje = 1;
pParamEvento1->DelayTime = ( portTickType ) 200 / portTICK_RATE_MS;

The creation of the task are:

sTaskCreate( Task_Ruedas, ( const portCHAR * const ) "Ruedas", portMINIMAL_STACK_SIZE, ( void * ) pParamEvento1,mainTASK_RUEDAS, NULL );
sTaskCreate( Task_Encoder, ( const portCHAR * const ) "Encoder", portMINIMAL_STACK_SIZE, ( void * ) pParamEvento1,mainTASK_ENCODER, NULL );
 

and the function send and receive are:

cQueueSend( ParamEvento.xQueueEvento,( void * ) &mensaje_e, pParamEvento->xBlockTime ) != pdPASS )

cQueueReceive( ParamEvento.xQueueEvento, &usDataRxEvento, ParamEvento.xBlockTime ) == pdPASS)

thanks again for your help!

Hope we find the mistake soon i don´t what else change to make it works well…

Best Regards,

Lilian

nobody wrote on Friday, February 16, 2007:

Hi,

It seems the problem is not in the calling of functions. problem is somewhere in using pointers.

So we can recheck everything related to pointers (again obvious things but its better to recheck):

1.Queue handle is in pParamEvento1 but you are using pParamEvento to access the queue. Then pParamEvento1 should be assigned to pParamEvento, "pParamEvento = *pParamEvento1;". IS it??

2. You should check whether the pvPortMalloc was successfull in alloacting the memory or not.

3. Also it is good to check whether queue was created successfully or not

-regards