Shop OBEX P1 Docs P2 Docs Learn Events
RCtime not working — Parallax Forums

RCtime not working

InanesInanes Posts: 14
edited 2006-09-11 09:28 in BASIC Stamp
Planet BS2. I·tried to run an RCtime command (to read photoresistors) on pin 4 but it returned zero and occasionaly some unstable values not related to the sensor. I tried also pin2 and pin6 and neither them could read RC. All other·pins worked ok. No wiring, and no grounding problems found, I just placed the sensor wire to different pins and programmed BS2 accordingly. I tested (LED) the pins output and worked ok for all pins. I attached the code I did the tests:

' {$STAMP BS2}
' {$PBASIC 2.5}
sensor_left CON 3 'I/O control for the light sensor
sensor_right CON 4 'I/O control for the light sensor
left VAR Word 'Here is stored the time constant of the left photoresistor/RC-circuit
right VAR Word 'Here is stored the time constant of the right photoresistor/RC-circuit
HIGH sensor_left
HIGH sensor_right
PAUSE 3
RCcommand:
RCTIME sensor_left,1,left 'measure the light intensity on the left sensor
HIGH sensor_left
PAUSE 20
RCTIME sensor_right,1,right 'measure the light intensity on the left sensor
HIGH sensor_right
PAUSE 20
DEBUG ? left, ? right, CR
PAUSE 1000
GOTO RCcommand
END


Ping))) did not work either with these pins. Is this a problem with the specific pins' internal pot??? What is the architecture of the BS2 chip to behave like that?


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
4th robot law: A robot may not substitute a human to satisfy another human, as long as such satisfaction does not conflict with the 1st, 2nd, and 3rd law.
Inanes Pastas


Post Edited (Inanes) : 8/22/2006 7:54:36 AM GMT

Comments

  • InanesInanes Posts: 14
    edited 2006-08-21 08:11
    I subtracted a value (100) from RCtime variables ('left' and 'right') and as I expected it returned values close to 65000. So, RCtime at pins 2, 4, and 6 stores values close to variable word's upper limit. Any ideas?

    Post Edited (Inanes) : 8/23/2006 11:21:17 AM GMT
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-21 12:49
    Upload your wiring diagram. I hope your not sharing the capacitor between the 2 photoresistors. What if you read the "sensor_left" first - then what happens? Have you tried applying Vdd to pin 4 and reading it with debug?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR

    Post Edited (TechnoRobbo) : 8/21/2006 1:03:21 PM GMT
  • InanesInanes Posts: 14
    edited 2006-08-22 07:43
    Thanks TechnoRobbo. As you can see in the diagram I use different capacitors for each photosensor. No matter which sensor I read first, results are same: normal values for other pins (light dependent) and values close to 65500 for pins 2,4,6.

    Haven't tried to apply Vdd to problematic pins and read it through debug. Shall I put a resistor (eg 220 Ohm) and INPUT 4 to try this?
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-08-22 16:11
    Those pins should work all the same. If you disconnect everything from the pins p3 and p4, that is, leave them floating, the following program should print out "310410". It tests the ability of the pin to output high and low and to be an input.

    idx VAR Nib
    FOR idx=3 to 4
      HIGH idx
      INPUT idx
      DEBUG DEC idx,BIN in0(idx)
      LOW idx
      INPUT idx
      DEBUG BIN in0(idx)
    NEXT
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-22 18:33
    Yes use a 220 Ohm resistor just in case - saves the processors from an unintentional short. As for you JPEG - don't know why you zipped it just post it as a jpeg - the zip is corrupted.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
  • Paul Sr.Paul Sr. Posts: 435
    edited 2006-08-22 18:48
    ZIP file is not corrupted - picture opened fine for me.
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-22 19:19
    XP reports that it's corrupt and has a 100% compression ratio

    pwssr could you post the jpg?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-22 20:01
    This will sometimes happen if you just click on a ZIP from online.· Right-click on the link (IE only) and choose "Save As..." and save it to your computer.· Then you should be able to open it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-22 23:31
    Thats how I saved it - I also tried download express -it's a jpeg so hopefully he'll repost

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-22 23:37
    TR,

    ·· I decided to try it myself, and it is, in fact, corrupted.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-08-22 23:51
    My system opened it okay. Mac powerbook, opened with Stuffit.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-23 01:33
    Tracy ifyou can repost as a jpeg perhaps we can all help Inanes. I'm suspecting a circuiting issue since the pin actually changed state otherwise RCTIME would have reverted to 0

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
  • InanesInanes Posts: 14
    edited 2006-08-23 05:23
    Well, guys, I reattach the wiring diag unzipped. It is not corrupted, it is zipped using ZipGenious 6, which seems to have incompatibility problems from OS to OS. For me, it works allright to my laptop PC with Win XP SP2, but fails to my desktop PC with Win XP SP1.


    Post Edited (Inanes) : 8/23/2006 5:47:30 AM GMT
    960 x 720 - 21K
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-08-23 05:45
    Inanaes -

    Since the evaluation version of WinZip is essentially free, why fool around with anything else?
    http://www.winzip.com/downwzeval.htm

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-23 06:15
    Inanes,

    First - sorry for starting this Winzip debate.

    Second - from studying your diagram I can't helpbut feel that the caps charging and discharging are interacting with each other by creating unexpected potential differences.

    Why don't you simplify the circuit like this:

    attachment.php?attachmentid=42970

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR

    Post Edited (TechnoRobbo) : 8/23/2006 6:21:53 AM GMT
    960 x 720 - 25K
  • InanesInanes Posts: 14
    edited 2006-08-23 13:18
    I tested the code that Tracy provided above after I changed it a bit for testing all pins (after disconnecting everything - left them floating).

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    idx VAR Nib
    FOR idx=0 TO 15
    · HIGH idx
    · INPUT idx
    · DEBUG DEC idx,BIN IN0(idx)
    · LOW idx
    · INPUT idx
    · DEBUG BIN IN0(idx),CR
    NEXT

    Here is what I got·from DEBUG :

    010
    110
    211
    310
    411
    510
    611
    710
    810
    910
    1010
    1110
    1210
    1310
    1410
    1510

    So, pins 2, 4, and 6 fail to become inputs when pins are low?

    Post Edited (Inanes) : 8/23/2006 1:28:04 PM GMT
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-23 14:36
    My BS2 gives this
    000
    100
    200
    310
    410
    510
    610
    710
    811
    911
    1011
    1111
    1210
    1310
    1410
    1511

    But that means I'm using those pins in a circuit thats pulling them to Vdd . Are you?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR

    Post Edited (TechnoRobbo) : 8/23/2006 5:22:19 PM GMT
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-08-23 18:06
    Inanes,
    If everything was disconnected from those pins, yes, the result means that there is something amiss with pins 2,4 and 6. Don't immediately blame it on the Stamp. It might be that the circuit board or wiring has a hidden leakage path to the +supply.

    On the circuit board itself, with the Stamp removed, measure the resistance from the offending pins over to the Vdd node. That resistance should be asymptotocally near infinite (after the supply capacitors charge).

    If it is the Stamp, the likely cause is that the low side driver transistors are blown, so that the Stamp can no longer pull low. Connect a voltmeter or 'scope to the output pin, and run a DO: TOGGLE 2 : LOOP program to see if the output toggles. If you don't have a voltmeter handy, use the known good stamp pins to test:

    DO   , with p2 jumpered to p3
      TOGGLE 2
      DEBUG BIN in3  ' should show 10101010...
    LOOP
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • InanesInanes Posts: 14
    edited 2006-08-24 06:36
    TR, I think the differences between our two stamps, apart from my pins 2,4 & 6, are because you have not disconnected all of your sensors and/or actuators and left them floating, as I did. The way I understand it is that we check if the stamp is able to read (input) if the pin has been driven low or high.

    Tracy, I detected no leakage from Vdd to any of the stamp's general purpose I/O. I also tried the toggle 2 (or 4, or 6) and the output was 1010101010...... as expected.

    Resume΄: My stamp is able to drive high or low all·of its pins. However, for pins 2, 4, and 6 it reads and reports that they are driven high, even if their are driven low. Am I correct? Do you think the problem is permanent?

    P.S. -·All output-based functions (shiftout,·pulsout, serout, e.t.c.) work allright at those pins, but when reading of the pin state is necessary (like RCtime), my stamp fails
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-24 15:44
    Inanes

    I misunderstood earlier what you should be using is a pulldown resistor to test - in otherwords take 3 - 10k resistor and connect it to the Vss and the pins 2,4 & 6. You are reading it high all the time, its reading low (or Vss) thats your problem. for get about driving the pin since thats not your problem either.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    DIRS=0
    DO
    DEBUG HOME,BIN16 INS, CR
    PAUSE 250 'give debug some time to talk
    LOOP

    'output on your BS2 will probbly look like this 0000000001010100
    ' if everythings fine it will look like this '0000000000000000

    Though I believe Tracy's right - might as well not give up till the (PC Alert) nutritionally-challenged lady sings.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-08-24 16:04
    It is clear that both the low and high drivers are working. Maybe they are weak. Try the same 101010.... program with a jumper from p2 to p3 and with a 1kohm resistor from there to Vss. Still 101010...?

    Also try it with p3 the output and p2 the input.

    DO   , with p2 jumpered to p3
      TOGGLE 3
      DEBUG BIN in2  ' should show 10101010...
    LOOP
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • InanesInanes Posts: 14
    edited 2006-08-26 09:29
    Dear all,
    Yesterday I started·to·get nuts, I tried all of your suggestions but results were contradictory, making not sense; the Stamp was able to drive high or low, but for my 3 problematic pins their input state was prevented to get known to the Stamp. What missed me?

    Finally, I have some good news, and some bad news. Good news are that the Stamp is not to blame for all this. Bad news is that the circuit board has a leakage. Tracy, bingo!
    Tracy Allen said...
    ...·Don't immediately blame it on the Stamp. It might be that the circuit board or wiring has a hidden leakage path to the +supply.

    On the circuit board itself, with the Stamp removed, measure the resistance from the offending pins over to the Vdd node. That resistance should be asymptotocally near infinite (after the supply capacitors charge).
    What I checked before was leakages from the BS2 pins to Vdd or Vss, assuming zero resistance, so, I set my multimeter to 200 Ohm, and everything looked ok.

    I have the Parallax BOE and after exhaustive testing, I found:

    R(Vdd to pins 2,4,6)=10kOhm

    R(Vdd to all other pins)=infinite

    R(Vss to pins 2,4,6)=19kOhm

    R(Vss to all other pins)=infinite

    Leakages between the cursed pins and 1,2,4,6,8,9,12,16,28 BS2 socket positions (chip PIC16C57C). Resistance between 10 and 19 kOhm

    Is there a way to save my BOE? What do we do in these situations?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    4th robot law: A robot may not substitute a human to satisfy another human, as long as such satisfaction does not conflict with the 1st, 2nd, and 3rd law.
    Inanes Pastas


    Post Edited (Inanes) : 8/26/2006 9:42:20 AM GMT
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-26 16:14
    Rule #1 to troubleshooting:··· Always isolate.
    • Did you test the pins on the breadboard with the PIC16C57C chip removed?
    • Pins 2,4,6 are adjacent at the AppMod header.
    • Are there any wire whiskers caught underneath? Over the the last 30 years wire whiskers have messed me up plenty of times. (curse you solid copper wires) Blow on it - don't spit.

    If theres no apparent damage to the board and the short occurs without the chip installed and you are beyond the 90 day warranty - perhaps you can have the breadboard repaired.

    Drastic options not recommended by Surgeon General: scratch out the tracers,clip pins· and/or solder a jumper in place. You must be darn sure where the cross-connect occurs to use this option.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
  • InanesInanes Posts: 14
    edited 2006-09-11 09:28
    Thank you TechnoRobbo for your tips!

    I was not able to find the source of the leakage. Neither could I isolate, I've found leakages from VSS all the way to the pins 2,4,6. Even on the BS2 socket. Is there a possibility to have a blown transistor on the board? I made some measurements and I found one that the base-emitter-collector gave same resistance. It was hard to check individual components, because they are tiny SMD. Not to mention to dismount-put a new one! I do not want to have my card repaired to anybody around, since I live in a smal town with no experienced electronic experts.

    Nevertheless, if nothing could be done, I will continue using my BS2 board, with this defect. If I do so, I would like your opinions on how safe that would be for BS2 chip.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    4th robot law: A robot may not substitute a human to satisfy another human, as long as such satisfaction does not conflict with the 1st, 2nd, and 3rd law.
    Inanes Pastas
Sign In or Register to comment.