CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

lcd causes lagging of synchronization!

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ferkar



Joined: 14 Jul 2007
Posts: 38

View user's profile Send private message

lcd causes lagging of synchronization!
PostPosted: Fri Jan 23, 2009 1:13 am     Reply with quote

hi everyone,

I have been working on a special motor project namely, switched reluctance motors. I have s6 tator and 4 rotor poles. What I am doing is to read rotor position regularly by using RB interrupts and then decide that which one of the three phase will be energized.

Up to here there is no problem.
Here is the problem:
I would like to see the speed of motor and feedback current on a 4x20 LCD .
Confused
I am checking the driving of phases with and without LCD subprogram. then it is seen that if the LCD sub active the resultant waveshapes are not proper. Some of them are missing and sometimes they are shifting and they are losing synchronization with input sensors.

If LCD subprogram is not active all signals are shown proper.

How I am going to solve this problem?
PIC:16f877A 8Mhz
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Jan 23, 2009 5:49 am     Reply with quote

Quote:
How I am going to solve this problem?
Think hard and then change the program to work correct. Wink
Sorry, this won't help you a lot but without more details this is the best answer I can give you right now.

The problem you are facing is very common in real-time systems. Your hardware requires actions at precise intervals and by adding an extra function to your system you corrupted this precise timing. One good thing, you know which module is creating the timing problem: the LCD-module.

Have a good look at the timing requirements of your system:
- What is the maximum allowed delay before energizing the phases?
- What is the delay introduced by the LCD module?

Which LCD software driver are you using? The CCS driver or another one? If it is the CCS driver than post your compiler version number, otherwise post the code.
Ttelmah
Guest







PostPosted: Fri Jan 23, 2009 6:16 am     Reply with quote

A couple of comments:
Have you got warnings enabled on the compiler?. If so, are they warning?. If not, try turning them on.
Look especially at whether any code is used both inside and outside the interrupt. The most 'likely' cause of problems is something like a delay, in the interrupt handler, leading to interrupts being disabled around these in the external code.

Best Wishes
Guest








lcd causes lagging of syncronisation!(2)
PostPosted: Tue Jan 27, 2009 4:44 am     Reply with quote

first of all thanks for your help...
Question

i tried a couple of simple sub programs to see the effcet of each module in terms of timing.

I made disactive all the sub programs except LCD module. i measured the time required for LCD .it is 80ms!. it is too long for my applications. then i looked at the LCD420.h file and it is clear that there are 2 differenet delay making 30 ms .

so i tried to use LCD module in an timimg interrupt then ı saw irregularities agin at the output.

therefore i changed my mind. now i am thinking to an additional pic16f877 that is only responsible for LCD drive and RS232 communication.

has anybody suggest how i am going to mke communication between these two without using RX/TX pins.

thanks.
Ken Johnson



Joined: 23 Mar 2006
Posts: 197
Location: Lewisburg, WV

View user's profile Send private message

PostPosted: Tue Jan 27, 2009 10:03 am     Reply with quote

Run the motor in an isr, and the lcd in the main loop

It's ok if the lcd is delayed while servicing the motor, but not the other way.

Ken
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Wed Jan 28, 2009 4:21 pm     Reply with quote

Ken Johnson wrote:
Run the motor in an isr, and the lcd in the main loop

It's ok if the lcd is delayed while servicing the motor, but not the other way.

Ken


I was going to suggest the same thing. Interrupts are powerful tools when used properly.

Interrupts are for just that...

"What am I doing that's more important than anything else".....

Then make your interrupt do that. :D

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group