So dropping the 7805 completely out of the circuit is ok even though the SX chip will be pulling power from only 3 batteries which could cause an uneven charge across all 8 batteries?
I went to RadioShack and bought another 6V 1.5W solar panel along with a 12V zener diode and a few other resistors to complete the attached circuit in a previous post. I will attempt to build it and set the voltage to 11.5V if I can figure it out
EDIT : RadioShack also had a 7812 regulator which I suppose I could use in place of the LM317. I would basically just have to put the zener in place to ground the output of the solar panels once the batteries are full. Question is, the voltage on the zener once 12V is hit would be 12V - the voltage drop correct? With a 1K resistor after the zener, wouldn't that make the voltage at the base of the transistor around 10 volts which is way too high for the base?
If this refers to my prior post then I have to apologize. I thought you had decided to run everything directly from the 12V battery. If you are pulling more power from some of the cells you need to provide them with more charging current or time to charge them fully. What I posted will not work in this case.
I got a 1W 12V zener diode since that is all they had other than a 6 volt. I did find some diodes there that were 50A rated with 1.1V drop and 5.0uA reverse leakage current.
I have the charging circuit redone according to the changes you suggested except I did not have a 240ohm resistor and subbed it for a 220ohm....maybe a 270ohm, can't remember which one I used. I have the circuit charging the batteries right now in full sun light. The voltage going out of the regulator is set at 11.98V since I could not get it to 12V or higher. I wound up having to put a larger heatsink on the LM317 since it got warmer than it was before with just 2 solar panels. Output current to the batteries is around 200 to 220mA. What should the no-load output be of the LM317 in full sun light to properly make the charging circuit complete? And...how would I check which zener diode to use since you say there is a +/- 0.2V difference in some.
I like to learn fast pace since taking it slow for me is hard since I don't have much patience since I don't have a lot of time to work on all the projects I start This one I want to stick with till the end :P
Thanks Kwinn. Things seem to change very fast in this thread and it is hard to keep up with what is actually happening. But I think we are getting very close to a good solution.
I had to think about the 12 volt 5 watt zener diode proposal - No LM317, just one blocking diode - like a 1n4007. This is much simpler than what I proposed.
But since we are using 3 panels at 1.5 watts in series, that 5 watt zener should do fine. 3 x 1.5 watts = 4.5 watts total max output. It doesn't really matter what the exact voltage and amps are.
If there is a discharge every night, I am not very concerned about trickle charge creating a problem either. The NiMH can take c/10 charging for 10 hours at a time as solar may actually provide less. There seems to be a natural yo-yo cycle involved in the actual use.
Maybe a 7805 on the SX would actually be a good thing if the load isn't too much as it would contribute to the yo-yo effect and eliminate heat build up from the cells being topped off for many long hours.
The bottom-line is that it is nearly impossible to build a perfect battery charger as nobody wants to wait the extra time just to attempt to add a bit to battery life. I even suspect that most battery chargers are intended to shorten battery life by over cooking. This should work just fine if either the 5 watt zener approach is used or if the LM317 is used at an adjusted output of 11.3 volt with two blocking diodes (the voltage regulator needs an extra one). No need for the cut off circuit as it seems unnecessary.
RE: "Kwinn likes LDO regulators, but they have seriously odd behavior in the Low Dropout region that I and others have recommended you stay away from them for regulation of the solar panel output. The additional power draw could waste quite a bit of battery power unnecessarily or make solar charging unpredictible."
This is true when powering a circuit from batteries but it does not really apply in this case. The regulator is powered from the solar cell so cannot discharge the batteries, the circuit is such that any current the regulator draws has to pass through the batteries thus charging them, and the regulator would only be operating in the LDO region when the batteries are close to fully charged or the incident light level is low.
Do I need a higher wattage rating zener diode? I have a random grab bag of electronic components that was given to me a few years ago and it may have something in there I could use. I did find a 1N4148 zener diode, but I can't seem to find the voltage rating of it.
Update on the solar charging :
As of right now, the circuit is still running and charging the batteries. I have a meter connected to ground and to the diode on the output of the regulator. Current voltage is at 11.04. It has been hanging around there for about 3 to 5 minutes.
If I have 3 solar panels rated at 1.5W tied in series, the wattage should not multiply correct? I should still only have "1.5 watts" output correct? The voltage is the only thing that "multiplies".
EDIT : Not sure if the question was missed above, but I also need to know what the optimum output voltage should be of the LM317 under no load and in full sunlight.
A 220 or 270 ohm should do fine, after all it is an adjustible regulator and I saw that for 'minimal current' they suggested no higher than 1200 ohm in that position with a 20K pot. I just changed the value to reduce the wasted current a bit.
Just get it to output 11.3 volts and forget the zener and the cut off circuit. You should be able to follow a standard circuit in the LM317 PDF for an adjustible power supply 1.2 to 30 volts. But you still need a blocking diode on each side of the regulator, and you need to get the 11.3 on the output after the blocking diode where you connect to the battery + terminal.
I have a lot of problems with getting exact parts in Taiwan, so I am used to redesigning as I discover what is available. Let's see what happens. I really hope that this is near working.
NOPE 3 1.5 watt solar panels total 4.5 watts. This power, not volts or current. If you use the 3 in parallal, you get 6 volts with 4.5 watts (in more amps) If you use the 3 in series, you get 18 volts (but no increase in amps) for 4.5 watts.
When I started electronics many years ago I thought it was all about Ohms Law. But now I see clearly that good design is all about Watts = volts x amps. You can't get any work done without the right amount of power. And too much power just burns up hardware.
So I can simply disconnect the zener from the circuit and it should be ok? The reason I was going for a safer circuit with cut off capability was to prevent problems over several months of usage. This will be in use without being tampered with for as many months as possible until the rechargeable batteries give up on me. If I leave the cut off circuit in place, is that just another battery drain or could I leave it just in case the LM317 gives up the ghost eventually?
Not sure how much of a difference it would make, but what about putting the zener before the blocking diode on the Vout of the LM317? The zener should see 0.7V more than the other side of the blocking diode and would shut the circuit off at 11.3V if the output is set to 12V. Is this correct?
The LM317 is just going to regulate voltage - so in full sunlight - set it for 11.3 volts for now. If that is not enough of a charge, the setting can go up to as high as 12.8 volts. But I don't think you will gain much by going that high. It may just wear out batteries with overcharging.
Zener diodes have a different number for each voltage range and a different series of numbers for each wattage rating. You may be confusing regular diodes with zeners. Try using Google to verify what kind of diodes you actually have.
Do NOT use a zener as a blocking diode. Use a rectifier diode that is rated for at least 250 ma and 18 volts. But you will likely find you are using something rated at 200 volt and 1 or more amps. These are cheap and easy to find.
A zener diode will not have a 0.7 voltage drop if used properly. A 12 volt zener turns on at 12 volts and does not conduct below that (unless you install it backwards).
Leaving the cut off circuit in place doesn't really help anything. I won't work as a backup if the LM317 fails as it depends on the LM317 to work.
Since you have only the 12 volt zener (which I really think is too high), the cut off will just sit there and never operate. Why bother with it.
Use a conventional LM317 set up for an adjustable power supply, but add the two blocking diodes. It is really that simple. Capacitiors are optional and next to the regulator.
Should I set the output of the LM317 to 11.3 with the 7805 connected or without it connected?
Currently, the batteries are at 11.12V and holding. I am using 2 rectifier diodes and 1 zener diode. The rectifier diodes are rated at 1.5A 1000V. They have a voltage drop of 1.1V at 1.5A forward voltage. The reverse leakage current is 5.0uA which is better than the others they had at RadioShack.
Ummm... relocating the zener diode on the other side of the blocking diode might actually work if you really want to have that cut off circuit in place. But as I said before, the cut off circuit does depend on the LM317 and failure of the LM317 (highly unlikely) would mean that the cut off would fail as well.
Keep it simple and understandable. You are trying to learn electronics, so have a good reason for what you do.
Setting the LM317 with or without the 7805 connected really doesn't matter. It should hold the setting both ways. But if you are charging batteries while setting, you will NOT get a stable reading. Use an open output.
When charging the regulator cannot reach the 11.3 volts until the batteries are fully charged.
I have no idea what you are doing with that 12 volt zener diode. It is 4:50am here and I am going to bed. Your batteries are nearly fully charged or are fully charged. Calibrate the voltage output without the batteries. The zener diode may actually make it impossible to calibrate as I have no idea how you are using it.
Talk to me tomorrow. In the meantime, try not to destroy anything.
lol...I will try not to destroy anything I am good with doing that though! Right now, the batteries are still charging and I have not changed the circuit yet. I am about to remove the cut off circuit and let them charge for the rest of the day. Then tonight, I will attempt a full run on the batteries to see where I sit with usage and to see if they can even make it though the night.
Over the years I have used a variety of methods for charging batteries using solar cells. With the propeller chip, the advent of inexpensive switching regulators, and a variety of solar cells I have settled on a simple straight forward approach.
Select a battery that provides the highest voltage (usually 6, 12, or 24V) and capacity required.
Select solar cell(s) that provide the appropriate voltage and maximum allowable charging current (typically C/10) in full sunlight.
Place a blocking diode between the solar cell and battery.
Use a voltage divider and one propeller pin to sense when the battery is fully charged, and a second pin and a transistor to switch the solar cell in/out of the circuit.
Use switching regulators to provide the rest of the voltages.
And when you do a RETI, where does it go? I fear you will just return to your last SLEEP instruction.
No, the RETI would effectively return to the instruction following the SLEEP command. But the RETI *is* part of the ISR, which is why you need an ISR at $000 -- even if there is no actual useful code in the ISR, you still need the ISR in place at $000 with an RETI/RETIW (the latter only if the ISR is in use for other purposes than the interrupt-on-pin-change).
As of right now at 9:50pm the voltage is at 10.65V. The voltage when I removed the solar panels from the sun was about 11.22V which was about 6:30. So this means the battery voltage has dropped 0.57V in about 3 hours. This averages to 0.19V per hour. So for a time of 12 hours with no sun (7pm to 7am), the batteries should be at 8.94V which is decent except for cloudy days or rainy days. According to my math, running on batteries alone will last around 28 hours. (11.3V - 6V (minimum 7805 voltage)) / 0.19 = 27.89 Hours. Does my math seem correct? If so, I will need to find a way to double this. I will check the voltage in the morning to see if it is close to 8.94V.
One thing I still don't understand is how a series of 8 each 1.2V batteries equal out to 11.3V fully charged. That would make each cell at 1.4125V each. They seem to be draining slowly from 11.22V which I though was supposed to drop quickly down to around 9.6V according to another post on this topic. (Don't remember which one). Did I overcharge the batteries since they don't seem to be dropping down to 9.6V quickly?
The drop in the voltage is not linear. It drops relatively quickly to about 9.6V, then decreases more slowly until the battery is nearly discharged, and then decreases at a higher rate.
Hmmm. Well, it is 7:30am here and the battery voltage is at 10.35V which is way different than I expected! I tested the make sure the circuit was still on by manually activating the switch and it was still working. This is only a drop of 0.3V in about 10 hours. At this rate, the batteries should last 176 hours with no sun! That is 7 days. Wow....
I am sure that that time is probably a little high since at night the AC does not kick on and off as much as it does during the day as it does at night. If the batteries are supposed to drop quickly to 9.6V then either the circuit is not using very much power or the batteries did over charge. When I removed the panels from the sun yesterday, the batteries were a little warm, but not close to hot to the touch. I don't think they got hot enough to cause any damage. I have read that around 104 degrees F is the max temp before they can be damaged. By touch, they did not feel anywhere close to that.
I am happy to hear that you got through a night with so little discharge, and after a successful solar charge (Am I wrong?). The whole idea of the Shut off circuit was to use a diode that turns off the regulator below the set output. That appeared to be needed when one included current limiting, but you don't need current limiting as the solar panels providing just enough current when the sun is good.
The 12 volt 1 watt zener is just the wrong zener diode. By using a 12 volt diode with the LM317 set at 11.3 volts; the cutoff circuit is nonsense as the cutoff voltage is somewhere around 12.0 volts or 12.00 plus a diode drop - say 12.7 volts. There will never be a condition where the cutoff will operate. The cutoff scheme requires the cutoff voltage to be lower than the set regulator voltage.
I do understand your blocking diodes have a higher drop of something like 1.1 volts. That just brings does the 15.3 volts further to 15.3 - 2.2 or about 13.1 volts. You still have enough headroom to get a good charge at 11.3 volts with proper regulation function.
You need to have about 7 days reserve as cloudy or bad weather would further discharge the battery before the sun could do its magic. Don't be optimistic about the availability of solar radiation, cloudy days are a significant reduction. And of course, over time the batteries will slowly charge less and less. All that extra capacity is important for a successful solar charger.
@ Kwinn
I tend to think your approach with switching regulators is more flexible. They can bring a lower voltage up to a charge level and they tend to be less wasteful than linear regulators. This would mean fuller charging on cloudy days. But we had the LM317 to work with. Polulu seems to offer nice small switching regulators ready for solar, and maybe Sparkfun has some too.
But one really has to match the solar panels to the battery configuration or waste a lot of money and charging capacity.
@ Zoot
I have been continuing to read about the Sleep and the Wakeup function in the SX20AC/SX28AC document, Al Williams' Beginning Assembly Language for the SX Microcontrollers, and in Gunther Daubach's Programming the SX Microcontroller - A Complete Guide.
Both Al Williams and Gunther Daubach do not fully explain the process. It takes quite a bit of reading and thinking to really grasp what the three Wakeup registers are doing, what the program counter is doing, and what the Status register is doing. I think I finally understand and have been reading for about 3 weeks this time around.
I think you presume that one always has to go into an interrupt mode and deal with a ISR. I just don't think that is true. A wakeup from Port_B pins will always do a RESET and jump to the highest memory address where a Reset vector will jump to the usual Reset entry point, not to $000 where the ISR routine is (unless you make that your main entry address).
You usually get to $000 only if an interrupt from any source is evoked while the processor is awake. When the processor is awake, the Port_B pins can act as interrupt pins. The silcon is set up to allow interrupts when awake and resets when asleep - nothing else.
From reading and re-reading the SX20-28 document in Sections 7 and 8, it becomes apparent that once a Wakeup pin is enabled and properly configured, the pin can force an interrupt unless immediately followedby a SLEEP instruction. So the position in the program of the Port_B MIWU/Interrupt configuration is very important to defining the pin behavior.
Once in SLEEP mode, the same pin with Wakeup properly enabled will only perform a reset to the highest program address that provides a jump vector for the Reset mode - no interrupt from a power down state. The Port B pins will only preform an interupt and jump to $000 if the device is awake and enabled to do so. I repeat, Much depends on where you place your Wakeup pin code and if you have triggers available while awake.
Pg 30 of the SX20-28 shows the status of the WKEN_B, WKED_B, and WKPND_B after the Wakeup reset. The pins are effectively shut down and no interrupt is going to occur. YES, if you immediately set up the pins after waking up, they will cause an interrupt whenever a Port B pin again triggers. BUT, if you wait to just before your SLEEP command to do the enabling, you have locked out the ability of Port B to do an interrupt, it only does a wake up.
And, there appears to be NO WAY to get to a command that follows a SLEEP, except to jump or skip over the SLEEP command.
I hope this helps. Please don't take offense, I wanted to get to the bottom of this as I have NOT understood it for years and it has been bugging me.
Comments
If this refers to my prior post then I have to apologize. I thought you had decided to run everything directly from the 12V battery. If you are pulling more power from some of the cells you need to provide them with more charging current or time to charge them fully. What I posted will not work in this case.
I have the charging circuit redone according to the changes you suggested except I did not have a 240ohm resistor and subbed it for a 220ohm....maybe a 270ohm, can't remember which one I used. I have the circuit charging the batteries right now in full sun light. The voltage going out of the regulator is set at 11.98V since I could not get it to 12V or higher. I wound up having to put a larger heatsink on the LM317 since it got warmer than it was before with just 2 solar panels. Output current to the batteries is around 200 to 220mA. What should the no-load output be of the LM317 in full sun light to properly make the charging circuit complete? And...how would I check which zener diode to use since you say there is a +/- 0.2V difference in some.
I like to learn fast pace since taking it slow for me is hard since I don't have much patience since I don't have a lot of time to work on all the projects I start This one I want to stick with till the end :P
I had to think about the 12 volt 5 watt zener diode proposal - No LM317, just one blocking diode - like a 1n4007. This is much simpler than what I proposed.
But since we are using 3 panels at 1.5 watts in series, that 5 watt zener should do fine. 3 x 1.5 watts = 4.5 watts total max output. It doesn't really matter what the exact voltage and amps are.
If there is a discharge every night, I am not very concerned about trickle charge creating a problem either. The NiMH can take c/10 charging for 10 hours at a time as solar may actually provide less. There seems to be a natural yo-yo cycle involved in the actual use.
Maybe a 7805 on the SX would actually be a good thing if the load isn't too much as it would contribute to the yo-yo effect and eliminate heat build up from the cells being topped off for many long hours.
The bottom-line is that it is nearly impossible to build a perfect battery charger as nobody wants to wait the extra time just to attempt to add a bit to battery life. I even suspect that most battery chargers are intended to shorten battery life by over cooking. This should work just fine if either the 5 watt zener approach is used or if the LM317 is used at an adjusted output of 11.3 volt with two blocking diodes (the voltage regulator needs an extra one). No need for the cut off circuit as it seems unnecessary.
RE: "Kwinn likes LDO regulators, but they have seriously odd behavior in the Low Dropout region that I and others have recommended you stay away from them for regulation of the solar panel output. The additional power draw could waste quite a bit of battery power unnecessarily or make solar charging unpredictible."
This is true when powering a circuit from batteries but it does not really apply in this case. The regulator is powered from the solar cell so cannot discharge the batteries, the circuit is such that any current the regulator draws has to pass through the batteries thus charging them, and the regulator would only be operating in the LDO region when the batteries are close to fully charged or the incident light level is low.
Update on the solar charging :
As of right now, the circuit is still running and charging the batteries. I have a meter connected to ground and to the diode on the output of the regulator. Current voltage is at 11.04. It has been hanging around there for about 3 to 5 minutes.
If I have 3 solar panels rated at 1.5W tied in series, the wattage should not multiply correct? I should still only have "1.5 watts" output correct? The voltage is the only thing that "multiplies".
EDIT : Not sure if the question was missed above, but I also need to know what the optimum output voltage should be of the LM317 under no load and in full sunlight.
Just get it to output 11.3 volts and forget the zener and the cut off circuit. You should be able to follow a standard circuit in the LM317 PDF for an adjustible power supply 1.2 to 30 volts. But you still need a blocking diode on each side of the regulator, and you need to get the 11.3 on the output after the blocking diode where you connect to the battery + terminal.
I have a lot of problems with getting exact parts in Taiwan, so I am used to redesigning as I discover what is available. Let's see what happens. I really hope that this is near working.
When I started electronics many years ago I thought it was all about Ohms Law. But now I see clearly that good design is all about Watts = volts x amps. You can't get any work done without the right amount of power. And too much power just burns up hardware.
Not sure how much of a difference it would make, but what about putting the zener before the blocking diode on the Vout of the LM317? The zener should see 0.7V more than the other side of the blocking diode and would shut the circuit off at 11.3V if the output is set to 12V. Is this correct?
Zener diodes have a different number for each voltage range and a different series of numbers for each wattage rating. You may be confusing regular diodes with zeners. Try using Google to verify what kind of diodes you actually have.
A zener diode will not have a 0.7 voltage drop if used properly. A 12 volt zener turns on at 12 volts and does not conduct below that (unless you install it backwards).
Since you have only the 12 volt zener (which I really think is too high), the cut off will just sit there and never operate. Why bother with it.
Use a conventional LM317 set up for an adjustable power supply, but add the two blocking diodes. It is really that simple. Capacitiors are optional and next to the regulator.
Currently, the batteries are at 11.12V and holding. I am using 2 rectifier diodes and 1 zener diode. The rectifier diodes are rated at 1.5A 1000V. They have a voltage drop of 1.1V at 1.5A forward voltage. The reverse leakage current is 5.0uA which is better than the others they had at RadioShack.
Keep it simple and understandable. You are trying to learn electronics, so have a good reason for what you do.
When charging the regulator cannot reach the 11.3 volts until the batteries are fully charged.
Talk to me tomorrow. In the meantime, try not to destroy anything.
Over the years I have used a variety of methods for charging batteries using solar cells. With the propeller chip, the advent of inexpensive switching regulators, and a variety of solar cells I have settled on a simple straight forward approach.
Select a battery that provides the highest voltage (usually 6, 12, or 24V) and capacity required.
Select solar cell(s) that provide the appropriate voltage and maximum allowable charging current (typically C/10) in full sunlight.
Place a blocking diode between the solar cell and battery.
Use a voltage divider and one propeller pin to sense when the battery is fully charged, and a second pin and a transistor to switch the solar cell in/out of the circuit.
Use switching regulators to provide the rest of the voltages.
This makes for a very simple and reliable system.
No, the RETI would effectively return to the instruction following the SLEEP command. But the RETI *is* part of the ISR, which is why you need an ISR at $000 -- even if there is no actual useful code in the ISR, you still need the ISR in place at $000 with an RETI/RETIW (the latter only if the ISR is in use for other purposes than the interrupt-on-pin-change).
As of right now at 9:50pm the voltage is at 10.65V. The voltage when I removed the solar panels from the sun was about 11.22V which was about 6:30. So this means the battery voltage has dropped 0.57V in about 3 hours. This averages to 0.19V per hour. So for a time of 12 hours with no sun (7pm to 7am), the batteries should be at 8.94V which is decent except for cloudy days or rainy days. According to my math, running on batteries alone will last around 28 hours. (11.3V - 6V (minimum 7805 voltage)) / 0.19 = 27.89 Hours. Does my math seem correct? If so, I will need to find a way to double this. I will check the voltage in the morning to see if it is close to 8.94V.
One thing I still don't understand is how a series of 8 each 1.2V batteries equal out to 11.3V fully charged. That would make each cell at 1.4125V each. They seem to be draining slowly from 11.22V which I though was supposed to drop quickly down to around 9.6V according to another post on this topic. (Don't remember which one). Did I overcharge the batteries since they don't seem to be dropping down to 9.6V quickly?
I am sure that that time is probably a little high since at night the AC does not kick on and off as much as it does during the day as it does at night. If the batteries are supposed to drop quickly to 9.6V then either the circuit is not using very much power or the batteries did over charge. When I removed the panels from the sun yesterday, the batteries were a little warm, but not close to hot to the touch. I don't think they got hot enough to cause any damage. I have read that around 104 degrees F is the max temp before they can be damaged. By touch, they did not feel anywhere close to that.
The 12 volt 1 watt zener is just the wrong zener diode. By using a 12 volt diode with the LM317 set at 11.3 volts; the cutoff circuit is nonsense as the cutoff voltage is somewhere around 12.0 volts or 12.00 plus a diode drop - say 12.7 volts. There will never be a condition where the cutoff will operate. The cutoff scheme requires the cutoff voltage to be lower than the set regulator voltage.
I do understand your blocking diodes have a higher drop of something like 1.1 volts. That just brings does the 15.3 volts further to 15.3 - 2.2 or about 13.1 volts. You still have enough headroom to get a good charge at 11.3 volts with proper regulation function.
You need to have about 7 days reserve as cloudy or bad weather would further discharge the battery before the sun could do its magic. Don't be optimistic about the availability of solar radiation, cloudy days are a significant reduction. And of course, over time the batteries will slowly charge less and less. All that extra capacity is important for a successful solar charger.
@ Kwinn
I tend to think your approach with switching regulators is more flexible. They can bring a lower voltage up to a charge level and they tend to be less wasteful than linear regulators. This would mean fuller charging on cloudy days. But we had the LM317 to work with. Polulu seems to offer nice small switching regulators ready for solar, and maybe Sparkfun has some too.
But one really has to match the solar panels to the battery configuration or waste a lot of money and charging capacity.
@ Zoot
I have been continuing to read about the Sleep and the Wakeup function in the SX20AC/SX28AC document, Al Williams' Beginning Assembly Language for the SX Microcontrollers, and in Gunther Daubach's Programming the SX Microcontroller - A Complete Guide.
Both Al Williams and Gunther Daubach do not fully explain the process. It takes quite a bit of reading and thinking to really grasp what the three Wakeup registers are doing, what the program counter is doing, and what the Status register is doing. I think I finally understand and have been reading for about 3 weeks this time around.
I think you presume that one always has to go into an interrupt mode and deal with a ISR. I just don't think that is true. A wakeup from Port_B pins will always do a RESET and jump to the highest memory address where a Reset vector will jump to the usual Reset entry point, not to $000 where the ISR routine is (unless you make that your main entry address).
You usually get to $000 only if an interrupt from any source is evoked while the processor is awake. When the processor is awake, the Port_B pins can act as interrupt pins. The silcon is set up to allow interrupts when awake and resets when asleep - nothing else.
From reading and re-reading the SX20-28 document in Sections 7 and 8, it becomes apparent that once a Wakeup pin is enabled and properly configured, the pin can force an interrupt unless immediately followed by a SLEEP instruction. So the position in the program of the Port_B MIWU/Interrupt configuration is very important to defining the pin behavior.
Once in SLEEP mode, the same pin with Wakeup properly enabled will only perform a reset to the highest program address that provides a jump vector for the Reset mode - no interrupt from a power down state. The Port B pins will only preform an interupt and jump to $000 if the device is awake and enabled to do so. I repeat, Much depends on where you place your Wakeup pin code and if you have triggers available while awake.
Pg 30 of the SX20-28 shows the status of the WKEN_B, WKED_B, and WKPND_B after the Wakeup reset. The pins are effectively shut down and no interrupt is going to occur. YES, if you immediately set up the pins after waking up, they will cause an interrupt whenever a Port B pin again triggers. BUT, if you wait to just before your SLEEP command to do the enabling, you have locked out the ability of Port B to do an interrupt, it only does a wake up.
And, there appears to be NO WAY to get to a command that follows a SLEEP, except to jump or skip over the SLEEP command.
I hope this helps. Please don't take offense, I wanted to get to the bottom of this as I have NOT understood it for years and it has been bugging me.