Why is my BS2PX Hot?
AvMan
Posts: 7
I am trying to run a simple keypad scanning program and I believe that the way I am doing it is causing the surface-mount microchip on my BS2PX to get hot. The purpose of the program is to scan an external keypad with 5 columns and 5 rows (10 pins) and DEBUG the output. After a few seconds the microchip gets hot to the touch even when no keys are being pressed. This is why I believe that it is a programming problem and not the fact that a connection is being made between two pins on the chip via the keypad.
One possible problem could be the ‘GOTO main’ command at the end of the program. This causes a loop to scan the keypad over and over again, but looping in a program is a very common practice and does not normally cause a chip to overheat. Below is my program. I wouldn’t recommend loading it on your BS2. I don’t want to be the cause of any catastrophic chip failures. I know they are expensive.
I have had trouble in the past trying to find a very basic keypad scanning program, pseudocode or even a flow chart. The Paralax “Nuts and Volts” keypad scanning lesson led me in the right direction but provided a program example that did not scan a keypad.
Below is the program I am currently running:
' {$STAMP BS2px}
' {$PBASIC 2.5}
'
' =========================================================================
'
[noparse][[/noparse] Program Description ]
'TO test keypad
'
[noparse][[/noparse] I/O Definitions ]
' Rows
OUTPUT 5 ' pad pin 1
OUTPUT 6 ' pad pin 2
OUTPUT 7 ' pad pin 3
OUTPUT 8 ' pad pin 4
OUTPUT 9 ' pad pin 5
' Couloumns
INPUT 11 ' pad pin 6
INPUT 12 ' pad pin 7
INPUT 13 ' pad pin 8
INPUT 14 ' pad pin 9
INPUT 15 ' pad pin 10
' Pull up inputs
CONFIGPIN PULLUP, %1111100000000000
CONFIGPIN SCHMITT, %0111111111100000
'
[noparse][[/noparse] Constants ]
MoveTo CON 2 ' DEBUG positioning command
ClrRt CON 11 ' clear line right of cursor
FieldLen CON 22 ' length of debug text
'
[noparse][[/noparse] Variables ]
'
[noparse][[/noparse] Initialization ]
Initialize:
PAUSE 250 ' let DEBUG open
DEBUG CLS ' clear the screen
PAUSE 250
DEBUG " Keypad", CR,
"
"
'
[noparse][[/noparse] Program Code ]
DEBUG MoveTo, 0, 3, "Enter Value: "
PAUSE 500
Main:
' Scan Row 1
OUT5 = 0
OUT6 = 1
OUT7 = 1
OUT8 = 1
OUT9 = 1
IF OUT5 = 0 AND IN11 = 0 THEN
DEBUG "F3 "
ELSEIF OUT5 = 0 AND IN12 = 0 THEN
DEBUG "F2 "
ELSEIF OUT5 = 0 AND IN13 = 0 THEN
DEBUG "F1 "
ELSEIF OUT5 = 0 AND IN14 = 0 THEN
DEBUG "F0 "
ELSEIF OUT5 = 0 AND IN15 = 0 THEN
DEBUG "Space "
ENDIF
' Scan Row 2
OUT5 = 1
OUT6 = 0
OUT7 = 1
OUT8 = 1
OUT9 = 1
IF OUT6 = 0 AND IN11 = 0 THEN
DEBUG "F "
ELSEIF OUT6 = 0 AND IN12 = 0 THEN
DEBUG "E "
ELSEIF OUT6 = 0 AND IN13 = 0 THEN
DEBUG "D "
ELSEIF OUT6 = 0 AND IN14 = 0 THEN
DEBUG "C "
ELSEIF OUT6 = 0 AND IN15 = 0 THEN
DEBUG "Enter "
ENDIF
' Scan Row 3
OUT5 = 1
OUT6 = 1
OUT7 = 0
OUT8 = 1
OUT9 = 1
IF OUT7 = 0 AND IN11 = 0 THEN
DEBUG "B "
ELSEIF OUT7 = 0 AND IN12 = 0 THEN
DEBUG "A "
ELSEIF OUT7 = 0 AND IN13 = 0 THEN
DEBUG "9 "
ELSEIF OUT7 = 0 AND IN14 = 0 THEN
DEBUG "8 "
ELSEIF OUT7 = 0 AND IN15 = 0 THEN
DEBUG "____> "
ENDIF
' Scan Row 4
OUT5 = 1
OUT6 = 1
OUT7 = 1
OUT8 = 0
OUT9 = 1
IF OUT8 = 0 AND IN11 = 0 THEN
DEBUG "7 "
ELSEIF OUT8 = 0 AND IN12 = 0 THEN
DEBUG "6 "
ELSEIF OUT8 = 0 AND IN13 = 0 THEN
DEBUG "5 "
ELSEIF OUT8 = 0 AND IN14 = 0 THEN
DEBUG "4 "
ELSEIF OUT8 = 0 AND IN15 = 0 THEN
DEBUG "DEL "
ENDIF
' Scan Row 5
OUT5 = 1
OUT6 = 1
OUT7 = 1
OUT8 = 1
OUT9 = 0
IF OUT9 = 0 AND IN11 = 0 THEN
DEBUG "3 "
ELSEIF OUT9 = 0 AND IN12 = 0 THEN
DEBUG "2 "
ELSEIF OUT9 = 0 AND IN13 = 0 THEN
DEBUG "1 "
ELSEIF OUT9 = 0 AND IN14 = 0 THEN
DEBUG "0 "
ELSEIF OUT9 = 0 AND IN15 = 0 THEN
DEBUG "<____ "
ENDIF
PAUSE 500
GOTO main
One possible problem could be the ‘GOTO main’ command at the end of the program. This causes a loop to scan the keypad over and over again, but looping in a program is a very common practice and does not normally cause a chip to overheat. Below is my program. I wouldn’t recommend loading it on your BS2. I don’t want to be the cause of any catastrophic chip failures. I know they are expensive.
I have had trouble in the past trying to find a very basic keypad scanning program, pseudocode or even a flow chart. The Paralax “Nuts and Volts” keypad scanning lesson led me in the right direction but provided a program example that did not scan a keypad.
Below is the program I am currently running:
' {$STAMP BS2px}
' {$PBASIC 2.5}
'
' =========================================================================
'
[noparse][[/noparse] Program Description ]
'TO test keypad
'
[noparse][[/noparse] I/O Definitions ]
' Rows
OUTPUT 5 ' pad pin 1
OUTPUT 6 ' pad pin 2
OUTPUT 7 ' pad pin 3
OUTPUT 8 ' pad pin 4
OUTPUT 9 ' pad pin 5
' Couloumns
INPUT 11 ' pad pin 6
INPUT 12 ' pad pin 7
INPUT 13 ' pad pin 8
INPUT 14 ' pad pin 9
INPUT 15 ' pad pin 10
' Pull up inputs
CONFIGPIN PULLUP, %1111100000000000
CONFIGPIN SCHMITT, %0111111111100000
'
[noparse][[/noparse] Constants ]
MoveTo CON 2 ' DEBUG positioning command
ClrRt CON 11 ' clear line right of cursor
FieldLen CON 22 ' length of debug text
'
[noparse][[/noparse] Variables ]
'
[noparse][[/noparse] Initialization ]
Initialize:
PAUSE 250 ' let DEBUG open
DEBUG CLS ' clear the screen
PAUSE 250
DEBUG " Keypad", CR,
"
"
'
[noparse][[/noparse] Program Code ]
DEBUG MoveTo, 0, 3, "Enter Value: "
PAUSE 500
Main:
' Scan Row 1
OUT5 = 0
OUT6 = 1
OUT7 = 1
OUT8 = 1
OUT9 = 1
IF OUT5 = 0 AND IN11 = 0 THEN
DEBUG "F3 "
ELSEIF OUT5 = 0 AND IN12 = 0 THEN
DEBUG "F2 "
ELSEIF OUT5 = 0 AND IN13 = 0 THEN
DEBUG "F1 "
ELSEIF OUT5 = 0 AND IN14 = 0 THEN
DEBUG "F0 "
ELSEIF OUT5 = 0 AND IN15 = 0 THEN
DEBUG "Space "
ENDIF
' Scan Row 2
OUT5 = 1
OUT6 = 0
OUT7 = 1
OUT8 = 1
OUT9 = 1
IF OUT6 = 0 AND IN11 = 0 THEN
DEBUG "F "
ELSEIF OUT6 = 0 AND IN12 = 0 THEN
DEBUG "E "
ELSEIF OUT6 = 0 AND IN13 = 0 THEN
DEBUG "D "
ELSEIF OUT6 = 0 AND IN14 = 0 THEN
DEBUG "C "
ELSEIF OUT6 = 0 AND IN15 = 0 THEN
DEBUG "Enter "
ENDIF
' Scan Row 3
OUT5 = 1
OUT6 = 1
OUT7 = 0
OUT8 = 1
OUT9 = 1
IF OUT7 = 0 AND IN11 = 0 THEN
DEBUG "B "
ELSEIF OUT7 = 0 AND IN12 = 0 THEN
DEBUG "A "
ELSEIF OUT7 = 0 AND IN13 = 0 THEN
DEBUG "9 "
ELSEIF OUT7 = 0 AND IN14 = 0 THEN
DEBUG "8 "
ELSEIF OUT7 = 0 AND IN15 = 0 THEN
DEBUG "____> "
ENDIF
' Scan Row 4
OUT5 = 1
OUT6 = 1
OUT7 = 1
OUT8 = 0
OUT9 = 1
IF OUT8 = 0 AND IN11 = 0 THEN
DEBUG "7 "
ELSEIF OUT8 = 0 AND IN12 = 0 THEN
DEBUG "6 "
ELSEIF OUT8 = 0 AND IN13 = 0 THEN
DEBUG "5 "
ELSEIF OUT8 = 0 AND IN14 = 0 THEN
DEBUG "4 "
ELSEIF OUT8 = 0 AND IN15 = 0 THEN
DEBUG "DEL "
ENDIF
' Scan Row 5
OUT5 = 1
OUT6 = 1
OUT7 = 1
OUT8 = 1
OUT9 = 0
IF OUT9 = 0 AND IN11 = 0 THEN
DEBUG "3 "
ELSEIF OUT9 = 0 AND IN12 = 0 THEN
DEBUG "2 "
ELSEIF OUT9 = 0 AND IN13 = 0 THEN
DEBUG "1 "
ELSEIF OUT9 = 0 AND IN14 = 0 THEN
DEBUG "0 "
ELSEIF OUT9 = 0 AND IN15 = 0 THEN
DEBUG "<____ "
ENDIF
PAUSE 500
GOTO main
Comments
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave Andreae
Parallax Tech Support·
I believe Mike is correct... I don't see anything wrong with your code, other than from a safety precaution aspect. What happens if someone presses multiple keys that aren't on the same row?
A couple of suggestions...
1) you could remove this section of code below, because the default settings (LOW and INPUT) will work to your advantage.
2) Modify your row checks so that they read like this... (Note: only one section shown)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
(you set one pin to '0', and read out which corresponding pin also drops to '0')
If so, I'd suggest sticking a resistor on the lines from the 'row' Pins, to limit the current that can flow.
You know, just to be safe...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't visit my new website...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Scroll down to “Experimenter's Keypad: Part No.: ACS1048”
http://www.oopic.com/objapp1.htm
http://www.douglasstreetfineart.com/pdf/acs1048.pdf
I appreciate everyones help. The chip still runs hot but I guess I will monitor the condition and let you know if there are any major problems.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Above all first consider this.
Upon detecting heat, immediately shut down all power until you determine the source. Many times I've haven't been looking for a heat problem, but I've just been holding the BasicStamp as I turn it on.
So now, I have one finger on the Stamp when I power up a new circuit. That prevents serious damage.
You should check the polarity of your supply. The little voltage regulator can get so hot that it desolders and slides right off the Stamp.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Everything in the world is purchased by labour; and our passions are the only causes of labor." -- David·Hume (1711-76)········
Really, if the BS2PX was getting hot while I was pressing down the keys, I would know what the problem was. But, the chip gets hot even when the keypad is not even hooked up. That’s why I thought it might be the program.
<img src="http://i156.photobucket.com/albums/t2/jagman_photo/2007_0930Misc0001.jpg">
http://i156.photobucket.com/albums/t2/jagman_photo/2007_0930Misc0001.jpg
[noparse][[/noparse]Edit: Disregard...I see (looking again at your code) you're using the internal pull-ups instead, but inline resistors on the outputs are still a good idea.]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Since that has +5volts regulated, V unregulated, ·and ground supply in somewhat odd places as well as I/O, you may have gotten mixed up on your wiring. It looks like the Vin might be involved.
It is much safer to used the clearly labled pins along side the BasicStamp's tiny breadboard and you can use shorter wires.· They are separated from the power pins along the top edge.
Listen to Chris...
·47 ohms is TOO low for the BasicStamp, you need a recommended·total of 220 ohms minimum to reduce the load on an pin to a safe margin.·
At roughly a 20 -25 ma·current limit per pin to avoid damage, you may already be in the weeds.·
5volt/.025amps [noparse][[/noparse]25 millamps]·= 200 ohms·
VERSUS 5volt/47 ohms·= 106 sizzling ma per pin.
It would be even better to use 1k· or 2k ohms as the Stamp really doesn't need to drive all that much current to get information.· Why run down your battery for nothing extra?
Pullups and pulldowns are not really important to these estimates.· You are looping +5 out of one pin and into another.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Everything in the world is purchased by labour; and our passions are the only causes of labor." -- David·Hume (1711-76)········
Post Edited (Kramer) : 10/1/2007 4:13:07 PM GMT