New to this, Need some starter help


Closed Thread
Results 1 to 15 of 15
  1. #1

    Default New to this, Need some starter help

    Hey everybody,
    Thanks for reading this.

    I have in the past used microcontrollers to control pumps on and off at different time intervals.

    For my next project I would like to build an security system for my truck. I have got the hardware all worked out. However, I cannot seem to find the right set of keywords.

    I need these keywords to be able to scan pins set to input. I looked at the peek command. It seems promising, I am not sure how to make it read input pins though. I've looked all through the help files, but every time I compile it gives me errors.

    I am using PIC Basic PRO for this one.

    Please help me get this one going.

    Thankyou

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by power_speed View Post
    I have in the past used microcontrollers to control pumps on and off at different time intervals.
    At least you have some sort of a base to work with...

    For my next project I would like to build an security system for my truck. I have got the hardware all worked out. However, I cannot seem to find the right set of keywords. I need these keywords to be able to scan pins set to input. I looked at the peek command. It seems promising, I am not sure how to make it read input pins though. I've looked all through the help files, but every time I compile it gives me errors.
    And yet again, we don't see any code that you've written so far, so we can't tell you why you have errors, what those errors are, why your code doesn't work..etc...etc... My crystal ball doesn't work that well...

    Post some code!!!

  3. #3


    Did you find this post helpful? Yes | No

    Default Here is the code I have currently

    W0 var word
    highin var PORTB 'for input of the inputs pins

    PEEK PORTB, W0 'to take a look at port b and see if
    'if any inputs are high.


    Here are some of the errors I am getting.

    ERROR Line 12: ':' or '=' Expected (Token 'var') (Security.pbc)
    ERROR Line 13: ':' or '=' Expected (Token 'var') (Security.pbc)
    ERROR Line 15: Variable or Constant Expected (Token 'PORTB') (Security.pbc)
    ERROR Line 15: End of Line or ':' Expected (Token ',') (Security.pbc)


    So far this is as far as I have gotten. I am confident that If I can solve these errors I will be better off than I was before.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by power_speed View Post
    W0 var word
    highin var PORTB 'for input of the inputs pins
    PEEK PORTB, W0 'to take a look at port b and see if
    'if any inputs are high.

    Here are some of the errors I am getting.

    ERROR Line 12: ':' or '=' Expected (Token 'var') (Security.pbc)
    ERROR Line 13: ':' or '=' Expected (Token 'var') (Security.pbc)
    ERROR Line 15: Variable or Constant Expected (Token 'PORTB') (Security.pbc)
    ERROR Line 15: End of Line or ':' Expected (Token ',') (Security.pbc)

    So far this is as far as I have gotten. I am confident that If I can solve these errors I will be better off than I was before.
    Are you using PicBasicPro or PicBasic? Where did you buy it from?

    And I suggest you start off with the standard Blinky LED project if you're just getting into PBP. Get that done and you'll be a lot better off...

  5. #5


    Did you find this post helpful? Yes | No

    Default Problem solved!!!!

    I now know what was up. The microcode studio software found the old picbasic that was still installed. I was trying to use picbasic pro commands and it was trying to compile using the picbasic only. I changed that AND no more errors.

    Thank you for your assistance.

    I would still like to know though will the peek command read pins and ports?

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by power_speed View Post
    I now know what was up. The microcode studio software found the old picbasic that was still installed. I was trying to use picbasic pro commands and it was trying to compile using the picbasic only. I changed that AND no more errors.

    Thank you for your assistance.

    I would still like to know though will the peek command read pins and ports?
    The answer awaits you in the manual.

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Yep your right about that. Manual is my new best friend as I proceed onward.

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by power_speed View Post
    Yep your right about that. Manual is my new best friend as I proceed onward.
    I take it that you found the answer to all your questions...at least until next time, yes?

  9. #9


    Did you find this post helpful? Yes | No

    Default

    Yep all is going well now, except for the if then else things. IT keeps telling me that i have a 'then' not preceeded by an if. Also 'else' not proceeded by an if or a then.

    I suppose A little more study will be required to figure this one out.

  10. #10
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by power_speed View Post
    Yep all is going well now, except for the if then else things. IT keeps telling me that i have a 'then' not preceeded by an if. Also 'else' not proceeded by an if or a then.

    I suppose A little more study will be required to figure this one out.
    Well then, try this:

    IF you post your code THEN
    somebody around here might be able to help you
    ELSE
    nobody will be able to figure out what you're trying to do
    ENDIF

  11. #11


    Did you find this post helpful? Yes | No

    Default

    I figured out the if then else thing. The manual listed the else on the same line as the if. That is how I put it. Moved the then to the next line and all is well.

  12. #12
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by power_speed View Post
    I figured out the if then else thing. The manual listed the else on the same line as the if. That is how I put it. Moved the then to the next line and all is well.
    What page? What section listed it that way?

  13. #13
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    What page? What section listed it that way?
    Disregard that... You were probably looking at pages that weren't DESCRIBING the IF/THEN/ELSE/ENDIF structure, but were only mentioning it in passing.

  14. #14


    Did you find this post helpful? Yes | No

    Default

    PIC Basic Pro compiler manual. It was page 89 section 5.36.

  15. #15
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by power_speed View Post
    PIC Basic Pro compiler manual. It was page 89 section 5.36.
    That's what I was talking about...
    On that page, in the examples, ELSE is always on the line following the THEN.
    I figured you might have been looking at page 1 or page 39.

Similar Threads

  1. PBP and Lassen SQ GPS
    By Ron Marcus in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 2nd July 2012, 16:00
  2. Replies: 4
    Last Post: - 3rd February 2010, 01:47
  3. Replies: 11
    Last Post: - 19th August 2009, 15:23
  4. Remote Car Starter Safety
    By CocaColaKid in forum General
    Replies: 8
    Last Post: - 22nd November 2005, 09:10

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts