View previous topic :: View next topic |
Author |
Message |
ferkar
Joined: 14 Jul 2007 Posts: 38
|
lcd causes lagging of synchronization! |
Posted: Fri Jan 23, 2009 1:13 am |
|
|
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 .
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
|
|
Posted: Fri Jan 23, 2009 5:49 am |
|
|
Quote: | How I am going to solve this problem? | Think hard and then change the program to work correct.
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
|
|
Posted: Fri Jan 23, 2009 6:16 am |
|
|
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) |
Posted: Tue Jan 27, 2009 4:44 am |
|
|
first of all thanks for your help...
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
|
|
Posted: Tue Jan 27, 2009 10:03 am |
|
|
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: 1615 Location: Central Illinois, USA
|
|
Posted: Wed Jan 28, 2009 4:21 pm |
|
|
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 |
|
|
|