Shop OBEX P1 Docs P2 Docs Learn Events
Chapter 3 Pg 94 Issue — Parallax Forums

Chapter 3 Pg 94 Issue

TheTech69TheTech69 Posts: 51
edited 2014-05-18 22:10 in BASIC Stamp
Is there a problem with the BASIC Stamp software running on Windows Vista platform? I am re-doing the "What's a Microcontroller?" book v2.2. I try to implement the solution "timeCounter = timeCounter * 2". The result in the terminal window is 0ms even when I hold for 30 seconds. However, when I do the solution "timeCounter = timeCounter + 1" I get the correct value for ms. I have also tried the */ operator with the result being 0ms. I verified the code is the same in v3.0 of "What's a Microcontroller?" on page 85. Anyone ideas why this happens on Windows 7 and Windows Vista platform but not Windows XP?

Thank you for your assistance with this.

Comments

  • ercoerco Posts: 20,256
    edited 2014-05-17 16:33
    The Pbasic editor works fine and identically on XP and Vista, Win7 and Win8, I have used them all. Remember, your computer is an editor and debug terminal only, the Stamp is calculating and sending all the data. I suspect that if you are getting different outputs, then your programs are not identical. Any chance your program files got corrupted when you switched machines?

    Also, are you using the same Pbasic 2.5 directive in both cases?
  • TheTech69TheTech69 Posts: 51
    edited 2014-05-17 17:41
    erco,

    I verified that PBasic 2.5 was used in both instances. I also retyped the entire code from scratch in a new window just to ensure a clean slate. I still have the same issue.

    Thank you for your quick response! It is greatly appreciated! :smile:
  • Mike GreenMike Green Posts: 23,101
    edited 2014-05-17 18:12
    As erco mentioned, the PBasic editor works identically on all Windows versions from XP to Windows 8.1. There may be something else going on with what you're doing. Please attach your actual source code along with descriptions of what you're entering and what you observe so we can help you.
  • ercoerco Posts: 20,256
    edited 2014-05-17 19:16
    To verify your issue, the program works fine until you modify it and add the "timeCounter=timeCounter*2" statement?

    It's such a short program that there isn't much to go wrong, except a typo. Sometimes you go snowblind looking at your same code over and over. Please attach your misbehaving code here when you can so we can see if we can spot something.

    Any chance you bumped your circuit and moved a switch or wire out of place? Can you go back to your XP computer and verify that everything still works? While you're there, copy your working program onto a flashdrive and port that into your new OS and retry it.
  • ercoerco Posts: 20,256
    edited 2014-05-17 20:17
    Shot in the dark: Maybe you just replaced counter=counter+1 with counter=counter*2

    That would explain your problem where the counter is always zero: zero times anything is always zero. You still need counter=counter+1. Per the text, you add counter=counter*2 to the existing program later in the program, outside the increment do loop, before the final debug statement.
  • TheTech69TheTech69 Posts: 51
    edited 2014-05-18 07:16
    I was under the impression the "timeCounter = timeCounter *2" was to take the place of the code "timeCounter = timeCounter + 1". When I re=read the text I did not see any instructions to comment out the "timeCounter = timeCounter + 1" when adding the "timeCounter = timeCounter *2" My mistake for assuming to do such. The ReactionTimer.bs2 now works correctly. Unfortunately I do not see where I can change the "Unsolved" to "Solved". Thank you all for your guidance and assistance with my inability to read correctly. :lol:
  • PublisonPublison Posts: 12,366
    edited 2014-05-18 07:43
    TheTech69 wrote: »
    I was under the impression the "timeCounter = timeCounter *2" was to take the place of the code "timeCounter = timeCounter + 1". When I re=read the text I did not see any instructions to comment out the "timeCounter = timeCounter + 1" when adding the "timeCounter = timeCounter *2" My mistake for assuming to do such. The ReactionTimer.bs2 now works correctly. Unfortunately I do not see where I can change the "Unsolved" to "Solved". Thank you all for your guidance and assistance with my inability to read correctly. :lol:

    You can go back to your first post and edit the dropdown to "Solved". You have to be in "advanced" mode.

    I have changed it for you.
  • ercoerco Posts: 20,256
    edited 2014-05-18 22:10
    @TheTech69: Glad to hear you got it all sorted out. Keep moving ahead and come back with any questions.
Sign In or Register to comment.