Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem with power down mode in 8051

Status
Not open for further replies.

seemanta

Member level 4
Member level 4
Joined
Jun 10, 2006
Messages
71
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,288
Activity points
1,968
power down mode 8051

Hi,

I have an RTC chip (DS12887) that periodically asserts the IRQ line which is connected to the INT0 line of my AT89S52.

I have seen that if my micro is in idle mode, the ISR for INT0 gets called periodically, without any intervention.

However, if my micro is in power down mode, the ISR does not get called. In power down mode the only way to invoke the ISR is to short the INT0 pin to the ground momentarily.

I am not able to understand why manually shorting to ground works in PD mode but asserting the IRQ line from the RTC does not work. :-(

Any help/pointers? Because of this, I am not able to implement power down mode in my digital clock :-(

Idle mode seems to work but it is power down mode in which I am more interested.

Any help would be greatly appreciated!


P.S. As per the data sheet, AT89S52 does seem to wakeup from power down mode by external interrupt. I am therefore clueless why this is not working !! :-(
 

8051 power down mode

Hi Seemanta,
You have still not gotout of this problem, it appears, the INTO pin in power down may need to sink more current , which RTC is not able to sink?, try using a buffer in between, it is only my guess. Please also check the logic level at INTO when RTC drives the pin.
Regards,
Laktronics.

Added after 4 hours 16 minutes:

Hi,
More than the level of the signal, it is the width of the signal that is important. The INT0 should be level triggered in this case and the level of the signal should remain low till the oscillator stabilises and switches to interrupt routine. So, either stretch the pulse a bit using a CMOS monoshot or clear an HC flipflop which will generate INT0- and in the interrupt routine set the flipflop usind a port pin if available.

Regards,
Laktronics.
 

8051 power down

Thanks a lot for your reply!
Just a thought, can I use a transistor for the same? I can connect the IRQ to the base and then use it as a switch to obtain a high current and drive the IRQ pin.

The reason I am more interested for using a transistor because I already have some at home and I need not go 15 KM again for shopping for the parts you have mentioned.

Provided of course, the pulse duration suffices. Otherwise as you mentioned I would have to use a flip-flop. But for that I would have to make use of a free port pin, which is what I do not have at the moment :-(

I am doomed, I guess :cry:

regards,
Seemanta
 

power down mode

Hi,
Most likely the problem is not with the drive problem, it would be the pulse width problem. Try if you can stretch the pulse and apply to interrupt using a gate and an RC circuit, using FF will be a clean job. I suppose you are already using level triggering for interrupt? Tell me how much is the width of the pulse output from RTC? If there is a problem. IT SHALL BE SOLVED to get over it, no other shortcuts.
Regards,
Laktronics.
 

8051 power-down

Hi Laktronics,
I just checked the data sheet of the DS12887 RTC chip. Here is what is written:

The IRQ output
remains low as long as the status bit causing the interrupt is present and the
corresponding interrupt-enable bit is set. The processor program normally
reads the C register to clear the IRQ pin. The RESET pin also clears pending
interrupts. When no interrupt conditions are present, the IRQ level is in the highimpedance
state.

So it may not be due to the pulse width. The first thing I do in my ISR is to read register C which clears the IRQ pin. But here my ISR itself is not getting hit, so I am not able to go to the next step of clearing the IRQ pin by reading register C.

Do you think it could be due to the sinking current problem? Shall I try using a transistor to boost the current ?
~seemanta
 

8051 int0 pullup

Hi,
You are very right. Before trying with transistor, please measure with a mutimeter what signal low level you are getting when RTC is interrupting, as you have mentioned, if the condition lasts until it is cleared, you should be able to check the levels. Also while using transistor, take care to apply logic low to interrupt line. Also, under what condition this interrupt is generated now?
Regards,
Laktronics
 

monostable multivibrator ls121

Also, under what condition this interrupt is generated now?

Do you mean under what conditions my interrupt is generated? Well, it is a periodic interrupt generated each second after the time is updated within the RTC12887.

My ISR reads the time and updates the LCD.

And yes, I shall measure the current and let you know my findings.

regards,
Seemanta

Added after 17 minutes:

Hi Laktronics,

I checked the level. It stays at 0 Volts till I read the register C. So it means that I can use a transistor to boost the current.

I shall now put a transistor and let you know whether it worked or not.
Thanks for your helpful insight! :D

regards,
Seemanta
 

power-down mode 8051

Hi,
Interrupt after update is quite fine. Now did you measure the level when the CPU was put in power down mode and RTC interrupt connected to INT- pin of CPU. If then also if you read a proper 0 level, what more can you expect from RTC? I am going by your statement that when INT- pin is shorted to ground, the CPU recovers from sleep mode.
Also please confirm that the CPU is programmed for LEVEL triggering of the interrupt, which I think should be the case, as otherwise external shorting should also have failed. If the INT- line shows very near 0Volts in sleep mode when IRQ output of RTC goes low, I have little hope in usage of transistor, problem is something else.
Regards,
Laktronics
 

power down mode in 8051

Hi,

You have to take care of the following if RTC IRQ signal level is found OK:
1. Program external interrupt for level triggering only and not for edge triggering.
2. Disable external interrupt within the external interrupt routineand enable it before going to sleep mode.
3. Since you said, you are reading the C register inside the external interrupt routine, it would be equivalent to step 2 itself.

With this much done. your software should work unless the chip version does not support wake up from sleep with interrupt, may be you have to contact Atmel support for further help. What you see by shorting int- pin to ground by a wire, may be due to your injecting some noise into the int- pin in that case?

Regards,
Laktronics
 

simple-power-down c code

Hi Seemata,
What happened to your problem? I think I have the solution for you. Though from Atmel S52 catalogue it is not clear, comparing with S2051, it appears that you have to give only a pulse of about 3msec to the iNT- input. So, at least for testing purposes use a CMOS monoshot and get a negative pulse of about 3 msec from RTC INTREQ- ( you need to pull up this pin as it is open drain) and apply the pulse to INT- pin of CPU. In your interrupt routine, also check for the INT- pin to go high and then start executing your interrupt routines.
I am sure it should work.
Regards,
Laktronics
 

once mode in 8051

Hi Laktronics,
Thanks for your persistent help in this matter! I am obliged. Yes I did a bit of research on this matter.
I even tried using an RC circuit to limit the duration of the LOW IRQ pulse. Unfortunately that did not work :(

So I came to the conclusion that a one shot circuit is the best solution.
But I have never used one before so taking some time to learn more about it.
My main problem is I am not able to find out which IC to use as monoshot.
This may be a stupid question, but can you please tell me which IC you are referring to here when you say 'CMOS Monoshot' ?

Although I do know what a monoshot circuit is (a monostable multivibrator) and also know that it can be made using a 555 timer, my other problem is that I can't use a very bulky or big IC because already my prototyping has been done and very little space is left on the circuit board. :(

As again, I shall be grateful for your help! (And add help points too :D)

regards,
Seemanta

P.S. In my current design I am not using any external pull up since I figured out that port P3(which contains the /INT0 pin, has an internal 10k pull up. The clock seems to work. So am I right in eliminating the pull up?

P.P.S Another question which I had was, if I add another active electronic component in the form of this monoshot IC, won't I be increasing the power consumption of the circuit as a whole and defeat the purpose of power down ?
I hope the power consumption increase by adding a monoshot will be less than what I will save by going into power down mode!
 

8051 power down irq

Hi Seemanta,
Good that you have not left the thread.
1. You can use NE555 itself as monoshot just for testimg purposes, without worrying about the power consumption, since the point is to investigate the condition of power down. In fact I was referring to NE555 itself in CMOS version, I think the part number is NE7555 and its power consumption will be justifiable in PDn applications. You can mout this IC on a small daughterboard and mount somewhere in your Clock Project without affecting your main PCB layout. I did not suggest the RC solution since it will require large capacitor for generating such long delays and a clamping diode to protect will also be required and still the timing can not be calculated correctly.
2. The pullup on INT- pin is OK in your present case.

Regards,
Laktronics
 

    seemanta

    Points: 2
    Helpful Answer Positive Rating
8051 idle mode and power down mode

Thanks a lot for your help!
I shall try out the 555 variant that you have mentioned and let you know what happened to my problem!

regards,
Seemanta

Added after 1 hours 42 minutes:

I also came to know about 74LS121 chip. It seems this is a dedicated one shot IC and I guess the number of peripherals needed here would be much less (other than a standard resistor and a standard capacitor).

I shall try both 555 and 74LS121 and let you know the results.

regards,
Seemanta
 

power modes in 8051

I used a 74LS121 and It worked!! :D
Thanks a lot to your constant guidance, Laktronics!

However I have two questions:

1. Will not adding the 74LS121 increase the current drawn and thereby increase the power consumption and offset any benefit I would have got by going to power down mode?

I plan to measure the current drawn in normal and PD mode and then find out the average current to really decide whether I would eventually deploy the 121. But wanted to know if others have had a similar experience on this.

2. My code looks something like this:

Code:
                  ORG 0003H ;ISR for /INT0
                  LCALL INT0_ISR
                  RETI

                 ORG 0030H
         MAIN: ;main line code
                  ;some code...
                  ;still more code...
                  ;still some more code...
        HERE: MOV PCON,#02H ;going to power down mode
                 SJMP HERE

                 INT0_ISR: ;ISR for my interrupt
                 ;do stuff
                 ;do more stuff
                 RET


Is this correct? I mean is the method of continuosly running in a loop and setting the micro to PD mode correct?

The above code works though but I want to be very sure before going ahead with deploying my 121.

regards,
Seemanta[/code]
 

power down of 8051

Hi,
Great to know that the Sleep mode works.

1. Well, the way you are doing everything in the interrupt routine, this is how it should be to put the CPU back in sleep mode using an 'sjmp here' soon after the sleep instruction. Alternatively, you can make the inerrupt routine small and put most of the remaining program just after sleep instruction with a final jump to the sleep instruction, though I am not able to find any advantage in doing it.
By the way, the set of codes that you need to do every second may be already there before first time entering the sleep mode, what you can do is not to repeat all those codes again in the interrupt routine, instead just put a jump after the sleep instruction to that code set, so that, after executing those codes, the program will automatiaclly run into the sleep instruction as the first time. Remember, once the sleep instruction is executed, CPU does not do anything else untill the nect interrupt.

2. Do not use LS121, use an HC121 or a CMOS 555 to save power.

All the best,
Regards,
Laktronics
 

interruption with ne555

Thanks a lot for your reply!

I do have a NXP 7555 chip. Is this a CMOS low power variant? I also have a NE555 from ST Micro. Which one is better of the two?

Also I have heard that HC and HCT are two different series. What are the differences between the two. Both I presume are low power variants of 74LS121, am I right?

But I would want to go with the better of the two. Also, is there a HC variant of my AT89S52 too? I guess AT89S52 already uses CMOS technology so it is already low power consuming, right ?

Sorry about such stupid questions!

regards,
Seemanta
 

power down mode software 8051

Hi,

1. 7555 is a low power device. But do not use plain 555 IC.

2. HCT devices are made interface compatible with TTL, but in your application since you are not using TTL, HC will work well and will provide better noise margins.

3. I think you should be satisfied for the present with the power dissipation of S52 in powerdown mode, I do not know if pinouts of 89S2052 will suffice your requirements, it may have probably even lesser current requirement.

Regards,
Laktronics
 

software for power down mode + 8051

Hi,
Are you saying that my project is NOT TTL? I was under the impression that all my components were TTL based.

Because, all I am using is a AT89S52 and a DS12887.


And yes, I would go and get some HC components and try out the same thing.
Will keep you posted!

regards,
Seemanta
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top