Shop OBEX P1 Docs P2 Docs Learn Events
Error : IN0~IN15 always shows 1 — Parallax Forums

Error : IN0~IN15 always shows 1

hirakuhiraku Posts: 5
edited 2012-12-14 18:59 in BASIC Stamp
Hello,

I use BasicStamp2px to make my project in college since about 1yr ago, so I have some experience about Basic Stamp.
However, I got an error now and I cannot solve this.

The problem is, the INS of Basic Stamp always shows 1 for all PINS.

I tested for these situations:
1. Nothing connected in all pins
2. Connect pins with an LED
3. Connect pins with resisters
4. Change to another BasicStamp (I have 2 BasicStamps)

But when I use
DEBUG "IN1 is = ",BIN1 IN1
It shows IN1 is = 1

If I debug all pins
DEBUG "HEX is = ",HEX4 INS
it shows "HEX is = FFFF"

And I tried this test : http://forums.parallax.com/showthread.php?124744-Stamp-BS2-Testing&p=1074510&viewfull=1#post1074510

The result is:
test1= 1111111111111111

error @ 01010101010101

test2= 1111111111111111


error @ 10101010101010



How can I solve this problem ? Any suggestions are appreciated !

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2012-12-13 10:10
    Welcome to the forums! In what manner are the LEDs and resistors connected? To VDD or to VSS? Please describe the complete connection. When the pins aren't connected to anything they are floating and could read any state at any given moment. Unused inputs should be pulled low/high to keep from floating and generating noise. One thing you can try to is to connect the output registers and see what you get. For example, try the following piece of code and see what you get.
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    DIRS = $FFFF
    DEBUG BIN16 ins
    
  • hirakuhiraku Posts: 5
    edited 2012-12-13 10:37
    Hello Chris, thanks for your quick reply !

    For the code you proved, it shows :
    0001110000000000 or 0000000000000100 (I have 2 BasicStamp, they shows different result)

    In fact, I use photoresistor and LEDs in my project, they all connected to two 1.5V AAA battery as power supply,
    and the photoresistor connected to P0~P4 in BasicStamp.

    Before yesterday, when I use "DEBUG BIN1, IN0" in my code, it can shows the state of photoresistor, if LED is on, it shows 1, otherwise shows 0.
    But today I found they all shows 1 even when in the dark, so I started to find out the issue and I noticed that all INS shows 1 in all times. :(
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2012-12-13 13:30
    The code I supplied connects the output registers, causing you to see their state on the INS register. Since the default state of the I/O pins is 0 (low), this tells me at least 2 of your input buffers on the I/O pins are damaged. Most likely shorted high due to overvoltage on the input, though it could also be from a short of even static discharge. But when running the code I sent you should see all zeros if everything is good.

    Do you have access to another BASIC Stamp Module to verify these reults?
  • hirakuhiraku Posts: 5
    edited 2012-12-13 16:20
    Yep, I have 2, as I said above
    One is 0001110000000000 and another is 0000000000000100
    So, can I use the un-damaged pins of BasicStamp or should I need to get new one?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2012-12-13 16:54
    You can use them, but there's no way to ensure they will be reliable or that the module won't fail due to diress caused by the damaged I/O ports.
  • hirakuhiraku Posts: 5
    edited 2012-12-13 22:17
    You can use them, but there's no way to ensure they will be reliable or that the module won't fail due to diress caused by the damaged I/O ports.

    Hmm, I tried to use the "damaged" port to connect bluetooth,
    But I still can receive and send data from my computer to these "damaged" I/O.
    (But in "DEBUG BIN16 PINS" they still shows 1)

    It's strange, if the I/O is damaged, it cannot receive any data, right? However my bluetooth module can still get the characters from my PC
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2012-12-14 10:11
    As I said, the code I posted connects the ouptut drivers to the input registers, so the INS should see what the OUTS is set to. Perhaps the output driver is damaged and the input is fine?

    The following project shows a couple of ways you can test a BASIC Stamp Module (including the I/O pins) if you really want to be sure.

    http://www.savagecircuits.com/forums/content.php?338-BASIC-Stamp-Module-Tester
  • hirakuhiraku Posts: 5
    edited 2012-12-14 18:59
    OK, thanks for your support :)
Sign In or Register to comment.