Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


PIC32 accessing xLCDQueue from other modules

Posted by Ralf Anders on January 18, 2009
in order to send msg's to the LCD from other modules, I made the following changes to demo code

// main.c :
//static xQueueHandle xLCDQueue;
extern xQueueHandle xLCDQueue;

// main.c :
// xLCDQueue = xStartLCDTask();
/* xLCDQueue = */ xStartLCDTask();

and I intended to put the following code to other module (e.g. comtest.c):

extern xQueueHandle xLCDQueue;
static portCHAR sLCDBuffer[17];
static xLCDMessage xLCDMsg = { 500 / portTICK_RATE_MS, sLCDBuffer };
xLCDMsg.pcMessage = "TX...";
xQueueSend( xLCDQueue, &xLCDMsg, 0);

So in all cases the xLCDQueue defined in lcd.c should be used (instead of
the static copy in main.c, which is not accessible from other modules).

This seemed to work.
My intention is, to show (some of the) transmitted characters on the LCD.
So I additionally lowered the frequency of transmission by
#define comTX_MIN_BLOCK_TIME ((portTickType)(1500 / portTICK_RATE_MS))
to have a chance to see the characters on LCD.
(Note: Making it too low causes "COM errors" - that's OK)

But there is a certain behavior: It often happens, that the LCD-lines are not
swapped and the first character is missing.
For example there is "ass 9" instead of "Pass 9".

Note: This happens already with a large comTX_MIN_BLOCK_TIME and without
queuing from other tasks.

what do I wrong?

RE: PIC32 accessing xLCDQueue from other modu

Posted by MEdwards on January 18, 2009
There is nothing wrong with the way you are accessing the queue handle. I suspect the problem is how the characters are written to the lcd. Could they be wrapping around?

RE: PIC32 accessing xLCDQueue from other modules

Posted by Ralf Anders on January 18, 2009
I just took an original v.5.0.3-demo and made my described modifications.
And sorry, I can not reproduce my troubles.
I come back, as soon as I can give a reproduceable description...

RE: PIC32 accessing xLCDQueue from other modu

Posted by Ralf Anders on January 20, 2009
in the mean time I found a short reproduceable way:

- Take the PIC32-Demo
- Remove the Blocktime-Task from project (3 locations in main.c)
- set configTICK_RATE_HZ (in FreeRTOSConfig.h) to a lower value !

1. configTICK_RATE_HZ = 50
- the LCD is updated every second (like in error cases), but with "Pass 1", "Pass2", ...
- the LCD line-switch does not work properly
(If the BlockTime-Task was not removed, their supervising fires errors)

2. configTICK_RATE_HZ = 20
- "Error: Int queue" is shown permanent
- but sometimes (very rarely) the "E" is missuing and You see "rror: Int queue"
- the LCD line-switch does not work properly

3. configTICK_RATE_HZ = 100
- the original demo seems to work
- but queuing LCD-messages from the COM-Task (that's my original intention)
cause heavy problems:
* the LCD line-switch does not work properly
* the first character is lost very often.

For my intentions I do not need a tickrate of 1000 Hz. This is according to the documentation.
But at least the demo LCD-task should work properly at nearly all lower tickrates.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner