PDA

View Full Version : New to this, Need some starter help



power_speed
- 11th June 2007, 03:18
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

skimask
- 11th June 2007, 03:34
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!!!

power_speed
- 11th June 2007, 03:44
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.

skimask
- 11th June 2007, 03:47
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...

power_speed
- 11th June 2007, 03:56
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?

skimask
- 11th June 2007, 04:05
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.

power_speed
- 11th June 2007, 04:34
Yep your right about that. Manual is my new best friend as I proceed onward.

skimask
- 11th June 2007, 05:25
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?

power_speed
- 12th June 2007, 00:28
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.

skimask
- 12th June 2007, 00:30
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

power_speed
- 14th June 2007, 02:24
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.

skimask
- 14th June 2007, 04:44
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?

skimask
- 15th June 2007, 02:41
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.

power_speed
- 16th June 2007, 04:26
PIC Basic Pro compiler manual. It was page 89 section 5.36.

skimask
- 16th June 2007, 04:47
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.