PDA

View Full Version : IF..THEN syntax



scaenix
- 15th February 2007, 06:33
Good day! I am a new user of PIC Basic and my version is PicBasic Pro 2.3 compiler. I am starting this thread because there is something that I cannot quite understand. There is a code in a book about robotics that I copied word for word into my editor, by the way I'm using MicroCode Studio 2003 for my editor, and somehow, when I tried to compile the program, there is an error message that says that the syntax is wrong. I'm including the code in here:

"if s1 > 225 then s1 = 225"

could anyone please help me or give me any idea why the compiler gives me an error message that the syntax is wrong? Thanks in advance!

scaenix
- 15th February 2007, 06:35
Please PM me if possible.. thanks!

Archangel
- 15th February 2007, 06:44
What does S1 represent?
you have a variable declared to represent s1?
examples:
s1 var byte
or
s1 var portB.1
or
symbol s1 = portb.1

sayzer
- 15th February 2007, 07:29
...

"if s1 > 225 then s1 = 225"...

There must be some other IF statements with missing THEN or ENDIF in the code.
One of those may be the cause of the error you get.

------------------

Melanie
- 15th February 2007, 09:44
PBP Version 2.3 is probably well over six years old (it's time MeLabs put a Date against the version releases on their website) and has many issues that have been fixed and improvements made over the subsequent years. You should seriously consider upgrading. Forum members here would be hard pressed to try to second-guess problems when you're using a product that old and you could spend many hours chasing a problem that has been long fixed and forgotten in the mists of time.

scaenix
- 15th February 2007, 23:11
I agree that the version I'm using is old but the program I tried to compile was also more or less 6 years old. :) anyway im pasting the whole program here for you to inspect. Thanks!


'Read Cds cell #1 on port b line 1
'Read Cds cell #2 on port b line 7
v1 var byte 'Variable v1 holds Cds #1 information
v2 var byte 'Variable v2 holds Cds #2 information
v3 var byte 'Variable for calculation
s1 var byte 'Variable s1 holds servomotor #1 pulse width info
s2 VAR word 'variable for random function
rv var byte 'variable rv holds the range value
s1 = 150 'initialize steering servomotor facing forward
rv = 10 'Adjust as needed for operation
ct var byte 'counter


start:
pot portb.2,255,v1
pot portb.3,255,v2

'Check bumper switch "Did I hit something?"
if porta.0 = 0 then avoid 'Hit obstacle go into avoid mode
'Is it sleepy time?
if v1 <= 230 then skp 'Is it dark enough to sleep?
if v2 > 230 then slp 'Yes

'Is it too bright to see?
skp:
if v1 >= 12 then skip2
if v2 < 12 then avoid

'Which way do I go?
skip2:
if v1 = v2 then straight
if v1 > v2 then greater
if v1 < v2 then lesser

straight:
pulsout portb.6, s1
pulsout portb.7, 157
goto start

greater:
v3 = v1 - v2
if v3 > rv then right
goto straight

lesser:
v3 = v2 - v1
if v3 > rv then left
goto straight

right:
s1 = s1 + 1
if s1 > 225 then s1 = 225
pulsout portb.6, s1
pulsout portb.7, 165
goto start
left:
s1 = s1 - 1
if s1 < 65 then s1 = 65
pulsout portb.6, s1
pulsout portb.7, 165
goto start

slp:
pulsout portb.6, s1
pulsout portb.7, 167
goto start

avoid:
random s2
s1 = s2 / 256
if s1 < 65 then s1 = 65
if s1 > 225 then s1 = 225
for ct = 1 to 125
pulsout portb.6, s1
pulsout portb.7, 177
pause 18
next ct

s1 = 150

goto start

Darrel Taylor
- 15th February 2007, 23:21
I just compiled it here for a 16F877. PBP 2.46

No errors.
<br>

scaenix
- 15th February 2007, 23:42
I just compiled it here for a 16F877. PBP 2.46

No errors.
<br>


I'm compiling it for a 16F84 with PBP 2.3

That's the only version I have because I can't afford to buy or upgrade.. I hope you understand :-)

Darrel Taylor
- 15th February 2007, 23:49
Compiled it for 16F84, still no errors.

You might consider
http://www.compilespot.com

It's a low monthly subscription that will allow you to use the latest compiler version. If you're fast enough, you may only need to pay for 1 month.

regards,

scaenix
- 16th February 2007, 00:34
[QUOTE=Darrel Taylor;32729]Compiled it for 16F84, still no errors.

QUOTE]


in that case, could you please send me the .HEX file so that I could load it to my PIC micro if that is ok with you?

P.S. I sent you a PM

:-D

Darrel Taylor
- 16th February 2007, 00:51
It sounds like an easy thing. It's already compiled, just send you the .HEX file.

But, being Asst_Admin on this forum, if I started compiling things for someone, I'd have 100 people a day that didn't want to buy the compiler, sending me their files.

That wouldn't be fair to the people that had to pay for their compiler.

scaenix
- 16th February 2007, 01:23
well, ok then. then pls suggest any other options if its ok with you. :-)

Darrel Taylor
- 16th February 2007, 01:40
Well, maybe you could ask William Gray Walter

Who's book you got the program from.

Or was it, John Iovine's "Pic Robotics".
<br>

Darrel Taylor
- 16th February 2007, 01:59
Tell ya what.

Send me the .LST file from your project.
darrel at pbpgroup.com

Maybe I can find the problem and suggest an alternative that might work with 2.30

No guarantees.
<br>

scaenix
- 16th February 2007, 02:04
Wow! Have you read John Iovine's book? Well, I got the program from his book "Pic Robotics". Correct me if I'm wrong but I think the <bold>William Gray Walter</bold> whom you're referring to passed away in 1977?

Darrel Taylor
- 16th February 2007, 02:35
Correct me if I'm wrong but I think the <bold>William Gray Walter</bold> whom you're referring to passed away in 1977?

Right, which would have made it hard to have written something in PBP. :o
But he did make the original "Turtle" robot that supposedly John based it on.

Got the .LST file, and it's worse than I thought. You have PBP version 2.03. (extremely old)

If you look at the version history
http://www.melabs.com/support/upgrade.htm#History

version 2.04 corrected a problem in 2.03 ...
IF..THEN..ELSE..ENDIF didn't always generate GOTO macro.

And as I look through the .LST file ... Every IF statement has an error.
Can't imagine how PBP even got off the ground with those kinds of errors.

Sorry, I don't see any way to make it work with 2.03
<br>

skimask
- 16th February 2007, 02:43
Right, which would have made it hard to have written something in PBP. :o
But he did make the original "Turtle" robot that supposedly John based it on.

Got the .LST file, and it's worse than I thought. You have PBP version 2.03. (extremely old)

If you look at the version history
http://www.melabs.com/support/upgrade.htm#History

version 2.04 corrected a problem in 2.03 ...
IF..THEN..ELSE..ENDIF didn't always generate GOTO macro.

And as I look through the .LST file ... Every IF statement has an error.
Can't imagine how PBP even got off the ground with those kinds of errors.

Sorry, I don't see any way to make it work with 2.03
<br>

The IF...THEN... might not generate a goto macro like he has it in the program:
if x>255 then skp

but how about
if x > 255 then goto skp

It sounds logical anyways...and I don't see the word 'goto' in any of the if/then statements

scaenix
- 16th February 2007, 02:51
Well, thanks anyway..our time in replying to the posts really helped. I already got the code compiled using PBP 2.46. Please don't ask me how I did it, just let me tell me that it really took my ingenuity to work..hehe. And with regards to the unfairness of the HEX file, I understand your situation and because of that, I became more resourceful in finding ways to compile my program without using any illegal credit cards or spending a dime. hehehe.. I hope we talk again on programming topics man! More power to you!

Darrel Taylor
- 16th February 2007, 02:51
Logical Indeed!

Good thought skimask.
<br>

Darrel Taylor
- 16th February 2007, 03:08
... I already got the code compiled using PBP 2.46. Please don't ask me how I did it, just let me tell me that it really took my ingenuity to work..hehe... I became more resourceful in finding ways to compile my program without using any illegal credit cards or spending a dime. hehehe..


I hope we talk again on programming topics man!

I don't think so!

Hackers.... pffft.
<br>

skimask
- 16th February 2007, 03:14
Well, thanks anyway..our time in replying to the posts really helped. I already got the code compiled using PBP 2.46. Please don't ask me how I did it, just let me tell me that it really took my ingenuity to work..hehe. And with regards to the unfairness of the HEX file, I understand your situation and because of that, I became more resourceful in finding ways to compile my program without using any illegal credit cards or spending a dime. hehehe.. I hope we talk again on programming topics man! More power to you!


I don't think so!

Hackers.... pffft.
<br>

Yep, and while he's at it, maybe he can run downtown and grab a whole bag of 'no help' from me either...I mean, really, a $25 upgrade, and yet buying parts to make stuff...Jeeze...

scaenix
- 16th February 2007, 03:17
I don't think so!

Hackers.... pffft.
<br>


hacker?

no man, im not what you think I am. Anyone caught hacking in my country would be fined for $2000 and as I have said, I don't have money to set up a credit card account, so how much more pay for $2000!

scaenix
- 16th February 2007, 03:46
Yep, and while he's at it, maybe he can run downtown and grab a whole bag of 'no help' from me either...I mean, really, a $25 upgrade, and yet buying parts to make stuff...Jeeze...



Well man, pls read my reply to the post. I didn't know people in this forum could be so judgmental. Judging me by my words without asking me what they mean...now what could you call that?

Darrel Taylor
- 16th February 2007, 03:54
Well man, pls read my reply to the post. I didn't know people in this forum could be so judgmental. Judging me by my words without asking me what they mean...now what could you call that?

You told us ... "Please don't ask me how I did it,"

I don't know how you could have done it legaly, so I have no other choice but to assume it wasn't.
<br>

skimask
- 16th February 2007, 04:09
Well, thanks anyway..our time in replying to the posts really helped. I already got the code compiled using PBP 2.46. Please don't ask me how I did it, just let me tell me that it really took my ingenuity to work..hehe. And with regards to the unfairness of the HEX file, I understand your situation and because of that, I became more resourceful in finding ways to compile my program without using any illegal credit cards or spending a dime. hehehe.. I hope we talk again on programming topics man! More power to you!


Well man, pls read my reply to the post. I didn't know people in this forum could be so judgmental. Judging me by my words without asking me what they mean...now what could you call that?

Well, I double-dawg dare you to give me or others a feasible, reasonable, logical, and legal explanation as to how you 'got the code compiled using PBP 2.46' and 'became more resourceful in finding ways to compile my program (hehehe)' when you stated and provided proof that you had PBP 2.03 (legally or not) and didn't have the means or funds to acquire a more recent version, or at least (with validating receipt or other suitable proof-of-purchase paperwork) the much cheaper upgrade.

scaenix
- 16th February 2007, 04:27
Hacking is not the only avaliable resource in this planet. Friends are too. It was evident for me that my problem would degrade down to hopelessness if I wouldn't do something else other than what you suggested. so what I did was call up a classmate and asked for help and then he said he'd call back and then he did call back. He said that he knew somebody, a Computer Engineering graduate who has the compiler who would gladly compile the code for me because they were also friends. I could call that human resource and tapping human resource anywhere available is being resourceful. That dude who did the compiling for me is not an Assistant Admin so he did not worry about 100 requests a day. I am sorry for having been misunderstood. This explanation is already very long that is why I told you guys not to ask me how I did it because I do not want to bother anyone to read such a long statement which I feel is already out of the original topic of the thread I started. Thank You.

Darrel Taylor
- 16th February 2007, 07:08
Oooo, nice save!

Moving from a pirated copy of PBP, to .Hex files compiled by legal owners is definately a step up up in the world.
<br>

scaenix
- 16th February 2007, 12:02
Did I satisfy the inquisitive? I hope so because I'd like to move on. I would really like to learn and I am driven. I would like to know how to connect a microphone to 16F84(A)... I want to build a robot who could hear though speech recognition is still out of the topic for the moment. If I could still be guaranteed of any help, then I would gladly start another thread regrading this matter. Thanks you. :)

therian
- 16th February 2007, 12:25
oh don be so cold to someone who decide to learn such scary topic as electronics and PICs. As i see electronics noway is really rare hobby so we should help as we can, or there is no much future without science. And $300 for PBP + programmer 75$ + books $100 and some tools + $50 is really not cheap especially for student. Im not saying that piracy is right but it may be understandable. And PBP is really great so I believe most who try it and stick with it will pay for it to show their thanks to developers who create such great thing.

keithdoxey
- 16th February 2007, 12:26
I would like to know how to connect a microphone to 16F84(A)... I want to build a robot who could hear though speech recognition

WOW !!!!

I thought Sir Clive Sinclair was being a bit optimistic when he said a ZX81 could control a Nuclear Power Station. LOL:)

scaenix
- 16th February 2007, 12:35
hehe.. i don't really mean that the robot I want to build could hear THROUGH speech recognition though it is already possible through an IC called HM2007 speech recognition IC. I want to build a robot that could hear though not cognitively.. i hope i made myself clear. :)

therian
- 16th February 2007, 13:32
I can imagine little bot crowing to anyone who make noise :)

skimask
- 16th February 2007, 13:52
Oooo, nice save!

Moving from a pirated copy of PBP, to .Hex files compiled by legal owners is definately a step up up in the world.
<br>

He (she?) wants to build a robot but doesn't have the means for the PBP upgrade.
What's wrong with this picture? I see priorities that are all sorts of wrong.
People like this are the reason I (and many others) paid $250 for my PBP insteadf of $100 or whatever...WTF...

Bruce
- 16th February 2007, 16:53
oh don be so cold to someone who decide to learn such scary topic as electronics and PICs. As i see electronics noway is really rare hobby so we should help as we can, or there is no much future without science. And $300 for PBP + programmer 75$ + books $100 and some tools + $50 is really not cheap especially for student. Im not saying that piracy is right but it may be understandable. And PBP is really great so I believe most who try it and stick with it will pay for it to show their thanks to developers who create such great thing.

This isn't directed at anyone in this thread. It is directed at the rather vaque attempt to justify theft.

Sorry, but I totally dissagree with that logic. A thief is still a thief. No matter whether he/she breaks into someones home to steal their belongings, steals software, steals a persons car, pet, or anything else for that matter.

A thief steals from real people. Most often, these people are hard-working folks such as MeLabs, and countless others, that have great regard for hard work, honesty, and integrity. People that have often started out with little or no money, and worked very hard to get to where they are in life by honest means.

Honest - hard-working people, end up paying for everything thieves steal. In one way or another. And, to me, there is no form of justification whatsoever that makes that an easy pill to swallow.

If you want something in life, and you want it badly enough, then work, save, do without little things from time-to-time, until you can afford to get it. If you steal everything along the way, then, sadly, you're still just a thief when you arrive. And honest 9/5 hard-working people will have paid your way there.

Is it OK for someone from a poor country to steal? Is it OK for someone with no money or a job to steal?

Answer that for yourself when they break into your house some day and steal everything you own. If you're the theif, then justify your own actions when someone in turn ripps YOU off. Food for thought isn't it?

How excited will you be that he/she are now getting their education with the PC & tools that they stole from your home?

Honest, hard working individuals, such as many on this forum that have scrimped & saved, done without, set goals, and worked very hard to get the tools & education they want/need, will forever be paying for things, in one form or another that others steal.

I totally agree with your statement
there is no much future without science But, we can only hope, that our future scientists, technicians, and all others involved in our success in the future, aren't common thieves. Will you trust them with your life? Best wishes if you do.!

No matter what they put forth as justification for their actions, I don't want them in my court. I'll stick with the hard working honest folks that have worked for what they have. Folks I can trust to watch my back.

Science alone will not get us there. We need a mixture of honesty, integrity, and morals to go with our new tallent, if we're going to make soup worth serving...;o}

Melanie
- 16th February 2007, 21:46
Well said Bruce.

There's no excuses - even for those 'poor' students. Most of us who went to College or University during the day pulled long hours late into the night working for slave wages to pay for our education, our textbooks and other teaching materials.

As for...

>> I want to build a robot who could hear though speech recognition

... didn't Heathkit do that with it's Hero1 kit more than twenty years ago? And no PICs back then! Wonder what happened to them all... perhaps they got reworked into R2D2's by George Lucas...

scaenix
- 16th February 2007, 23:35
This isn't directed at anyone in this thread. It is directed at the rather vaque attempt to justify theft.

Sorry, but I totally dissagree with that logic. A thief is still a thief. No matter whether he/she breaks into someones home to steal their belongings, steals software, steals a persons car, pet, or anything else for that matter.

A thief steals from real people. Most often, these people are hard-working folks such as MeLabs, and countless others, that have great regard for hard work, honesty, and integrity. People that have often started out with little or no money, and worked very hard to get to where they are in life by honest means.

Honest - hard-working people, end up paying for everything thieves steal. In one way or another. And, to me, there is no form of justification whatsoever that makes that an easy pill to swallow.

If you want something in life, and you want it badly enough, then work, save, do without little things from time-to-time, until you can afford to get it. If you steal everything along the way, then, sadly, you're still just a thief when you arrive. And honest 9/5 hard-working people will have paid your way there.

Is it OK for someone from a poor country to steal? Is it OK for someone with no money or a job to steal?

Answer that for yourself when they break into your house some day and steal everything you own. If you're the theif, then justify your own actions when someone in turn ripps YOU off. Food for thought isn't it?

How excited will you be that he/she are now getting their education with the PC & tools that they stole from your home?

Honest, hard working individuals, such as many on this forum that have scrimped & saved, done without, set goals, and worked very hard to get the tools & education they want/need, will forever be paying for things, in one form or another that others steal.

I totally agree with your statement But, we can only hope, that our future scientists, technicians, and all others involved in our success in the future, aren't common thieves. Will you trust them with your life? Best wishes if you do.!

No matter what they put forth as justification for their actions, I don't want them in my court. I'll stick with the hard working honest folks that have worked for what they have. Folks I can trust to watch my back.

Science alone will not get us there. We need a mixture of honesty, integrity, and morals to go with our new tallent, if we're going to make soup worth serving...;o}


I agree with you Bruce. Someone from whatever country, whether rich or poor, a student or someone else, who steals is still considered a theif. Stealing is not justifiable and I agree with everything you said. As for me, I've said that I cannot afford to pay for the compiler, but after having the code compiled from PBP 2.46 without any error codes, I have greatly considered saving even for an upgrade because as I have said, I want to learn and am driven. I don't know why some people got pissed with even before I got the chance to explain. I am not a well-off person but even if I am not that financially blessed, I still believe in integrity, honesty, morals and karma. What I have right now is only what I've got and it would surely be devastating if someone else would steal it because the effects of karma has come full circle on me. What would I have then? Nothing.

With regards with the bot, I only would like to know if it is possible to connect a mic directly to a pic16f84 and what would be the corresponding codes. I searched last night and I came upon this site:

http://www.restena.lu/convict/Jeunes/PhaseSound.htm

skimask
- 16th February 2007, 23:43
Well said Bruce.

There's no excuses - even for those 'poor' students. Most of us who went to College or University during the day pulled long hours late into the night working for slave wages to pay for our education, our textbooks and other teaching materials.

As for...

>> I want to build a robot who could hear though speech recognition

... didn't Heathkit do that with it's Hero1 kit more than twenty years ago? And no PICs back then! Wonder what happened to them all... perhaps they got reworked into R2D2's by George Lucas...

If you really want one...
http://cgi.ebay.com/Heathkit-Hero-2000-ROBOT-With-Manuals-and-accessories_W0QQitemZ130080127027QQihZ003QQcategor yZ19198QQssPageNameZWDVWQQrdZ1QQcmdZViewItem

Disregard....that's for the HERO 2000, not the Hero1...something back then so overly complicated...so comparatively simple by today's standards....

scaenix
- 17th February 2007, 00:22
Wow! starting bid is already US $2,100.00!!! That could take me years to save! I guess I'll have to continue rummaging through google in this case.. I also better start another thread about microphone to pic16f84...the IF..THEN SYNTAX is becoming inappropriate. :)

therian
- 17th February 2007, 03:50
This isn't directed at anyone in this thread. It is directed at the rather vaque attempt to justify theft.

Sorry, but I totally dissagree with that logic. A thief is still a thief. No matter whether he/she breaks into someones home to steal their belongings, steals software, steals a persons car, pet, or anything else for that matter.

A thief steals from real people. Most often, these people are hard-working folks such as MeLabs, and countless others, that have great regard for hard work, honesty, and integrity. People that have often started out with little or no money, and worked very hard to get to where they are in life by honest means.

Honest - hard-working people, end up paying for everything thieves steal. In one way or another. And, to me, there is no form of justification whatsoever that makes that an easy pill to swallow.

If you want something in life, and you want it badly enough, then work, save, do without little things from time-to-time, until you can afford to get it. If you steal everything along the way, then, sadly, you're still just a thief when you arrive. And honest 9/5 hard-working people will have paid your way there.

Is it OK for someone from a poor country to steal? Is it OK for someone with no money or a job to steal?

Answer that for yourself when they break into your house some day and steal everything you own. If you're the theif, then justify your own actions when someone in turn ripps YOU off. Food for thought isn't it?

How excited will you be that he/she are now getting their education with the PC & tools that they stole from your home?

Honest, hard working individuals, such as many on this forum that have scrimped & saved, done without, set goals, and worked very hard to get the tools & education they want/need, will forever be paying for things, in one form or another that others steal.

I totally agree with your statement But, we can only hope, that our future scientists, technicians, and all others involved in our success in the future, aren't common thieves. Will you trust them with your life? Best wishes if you do.!

No matter what they put forth as justification for their actions, I don't want them in my court. I'll stick with the hard working honest folks that have worked for what they have. Folks I can trust to watch my back.

Science alone will not get us there. We need a mixture of honesty, integrity, and morals to go with our new tallent, if we're going to make soup worth serving...;o}

There is one big difference between house buggery and using unregistered copy. When House thief happen it affect someone directly but when someone decide in example to read himself a copy of a book from friend instead of buying it no one really affected. if you thinking that company lose money from every illegal copy than think about this - do you really think that those who have pirate copy would buy program in case there was no such pirated copy ? in 95 % those people will juts forget about and look for something else, so we cant say that each pirate copy hurt a company. in many cases the pirated copy work as really good commercial because if you not a pig , you will finally buy the program to show respect to developers, when you will have enough money and Im sure you will recommend the program to you friends if they ask where to start from. I just believe based on my own experience that if Software is really pice of art , nothing can hurt it. I will be honest and admit that I bought PBP not because something was wrong with pirated version which i had and it did not work appropriately, I just see all great work which was done by developers, so i wanted to thank them.
I think there is no more need to discuses it because you newer can be 100% right about piracy because it really tricky by it nature to tell if it bad or not, and it will exist as long as humans exist no matter what you think about.

scaenix
- 17th February 2007, 05:20
PBP is great and easy to get along with. I'm saving to purchase an upgrade. Talking about what we've just discussed in the previous posts would certainly be worth another topic, say about piracy and intellectual rights? But then again, that is a very broad topic.
Huhum..let's move on..if anyone wants to start that topic somewhere then I suggest you request that in the forum. As for me, I've created another thread about inputting a mic into the 16f84. :)

malc-c
- 17th February 2007, 10:03
The issue of pirate copies will never go away. In an ideal world there would be no murders, break-ins, car jacking, robberies, hacking or bootlegging etc... but we don't live in an ideal world.

Someone mentioned cost... I've seen $10 applications pirated and placed up on the net for download, so its not the fact that a genuine copy cost so much. It seems that the low life that pirate these applictions do it just for fun or kudos.

In the example of reading a book rather than buying it, thats a bad example as you are still causing finacial hardship to both the author, publisher and retailer as its a lost sale. I mean you would hardly go out and buy the book for yourself if you had read your friends copy from cover to cover.

Melanie
- 17th February 2007, 12:18
I agree with most that you say with the exception of the book example.

If I buy a book (or CD or DVD or whatever), I'll probably read it and like with most people it is then destined to spend the rest of it's life abandoned on the shelf. You can come along and borrow the book, read it and return it to me. I can sell that book or give it away to someone else. But at any instance in time, only ONE COPY exists, but more than one person can enjoy the book, certainly not just the person who originally bought it. After all, all your school textbooks have probably been read many times before you and long after you have finished with them. Libraries would not exist where a single copy can be borrowed for the enjoyment of many. The objection is where someone COPIES the original work without recompensing the author/publisher.

sayzer
- 17th February 2007, 20:10
Another point of view is from me.

For US$10, I buy a pirate copy of a US$900 software.
I do the job and earn US$2,500.
Then I go to the shop and buy the original version at US$900.
Me = happy, software maker=happy, customer=happy

This is the way for me to buy the original version.

Who can call me a pirate software user?


----------------------

keithdoxey
- 17th February 2007, 20:54
Another point of view is from me.

For US$10, I buy a pirate copy of a US$900 software.
I do the job and earn US$2,500.
Then I go to the shop and buy the original version at US$900.
Me = happy, software maker=happy, customer=happy

This is the way for me to buy the original version.

Who can call me a pirate software user?

----------------------

At the point of doing the actual job you were a pirate user but having bought the software I suppose that legitimises it.

I have done similar with a disney film. Saw it at the movies, got a downloaded copy for the kids to watch (VCD) and then when the DVD came out I bought it so I dont feel that I have cheated Disney out of anything.

Having said that, we went to the Cinema a couple of weeks ago to see Night at the Museum. Good family film, current release. Last week I was talking to someone who said they hadnt seen it yet because they lent THEIR DVD to someone THREE WEEKS AGO before it was even on cinema release here.

I very much doubt that they have any intention of getting a genuine DVD once it is released and that is true of many users of Pirate Software :(

therian
- 18th February 2007, 06:04
I dont want to upset someone but think about this . Try to imagine word if there was no piracy. First look on internet : where all those web sites what people create ? Where all those drawing ? where flash cartons and games where all DJ ? where...? are we back in 70?

malc-c
- 18th February 2007, 11:21
Melanie,

Good point with the book anology...

As a side issue (and now way off topic for this thread) I wonder if having a fully working, but resticted version of PBP would affect the sales of PBP dramatically. Something like Mikrobasic, which offers the chance to write full programs with a limit of 2K compiled HEX. I wonder if it would also reduce the amount of pirated copies that find their way into the home / hobby user..? But then again, I would susspect that some low life would come up with a means of getting past the restriction and removing the limit.... just can't win !

scaenix
- 18th February 2007, 12:43
As a side issue (and now way off topic for this thread)

Hmmm... I believe that the issue is really way off topc for this thread. I hope someone moderates this. Hehehe.. :D I kinda get excited everytime I got a notice in my email that someone replied in this thread. I'm always thinking that another golden advice regarding the topic I started would be given. Though I didn't get any related advice, the excitement that I felt when I was thinking of a solicited advice was replaced with the excitement about issues that in one way or another affect our lives as users or producers. I suggest we start another forum topic regarding the issue. More power! :)

scaenix
- 19th February 2007, 08:05
'Read Cds cell #1 on port b line 1
'Read Cds cell #2 on port b line 7
v1 var byte 'Variable v1 holds Cds #1 information
v2 var byte 'Variable v2 holds Cds #2 information
v3 var byte 'Variable for calculation
s1 var byte 'Variable s1 holds servomotor #1 pulse width info
s2 VAR word 'variable for random function
rv var byte 'variable rv holds the range value
s1 = 150 'initialize steering servomotor facing forward
rv = 10 'Adjust as needed for operation
ct var byte 'counter


start:
pot portb.2,255,v1
pot portb.3,255,v2

'Check bumper switch "Did I hit something?"
if porta.0 = 0 then avoid 'Hit obstacle go into avoid mode
'Is it sleepy time?
if v1 <= 230 then skp 'Is it dark enough to sleep?
if v2 > 230 then slp 'Yes

'Is it too bright to see?
skp:
if v1 >= 12 then skip2
if v2 < 12 then avoid

'Which way do I go?
skip2:
if v1 = v2 then straight
if v1 > v2 then greater
if v1 < v2 then lesser

straight:
pulsout portb.6, s1
pulsout portb.7, 157
goto start

greater:
v3 = v1 - v2
if v3 > rv then right
goto straight

lesser:
v3 = v2 - v1
if v3 > rv then left
goto straight

right:
s1 = s1 + 1
if s1 > 225 then s1 = 225
pulsout portb.6, s1
pulsout portb.7, 165
goto start
left:
s1 = s1 - 1
if s1 < 65 then s1 = 65
pulsout portb.6, s1
pulsout portb.7, 165
goto start

slp:
pulsout portb.6, s1
pulsout portb.7, 167
goto start

avoid:
random s2
s1 = s2 / 256
if s1 < 65 then s1 = 65
if s1 > 225 then s1 = 225
for ct = 1 to 125
pulsout portb.6, s1
pulsout portb.7, 177
pause 18
next ct

s1 = 150

goto start


I've quoted the code I've posted in one of the previous replies. the program is supposed to make the servomotor #1, which is connected to RB7 stop when in total darkness. I'm confused why the motor still continues on turning even if it is supposed to stop. Please anyone enlighten me on this. Thanks very much! :)

mister_e
- 19th February 2007, 13:03
I didn't read the whole thing but here's one fast suggestion for you.

Pulsout have to return the pin to it's previous state right? but nowhere the initial state have been set. When you turn on a PIC, the state of all pin is hard to predict. add those lines at the top of your code.



PORTB=0 ' Clear all PORTB pin
TRISB=0 ' Set all PORTB pins to output


if it doesn't work, you could still place a LOW PORTB.7 after each PULSOUT.

rhino
- 19th February 2007, 14:35
'Read Cds cell #1 on port b line 1
'Read Cds cell #2 on port b line 7
v1 var byte 'Variable v1 holds Cds #1 information
v2 var byte 'Variable v2 holds Cds #2 information
.................................................. ..........
start:
pot portb.2,255,v1
pot portb.3,255,v2
My guess is the values in v1 and v2 are are not as expected. Pot command can be a pain at times. Do you have anyway of sending these values to an LCD to debug?

scaenix
- 20th February 2007, 02:37
With the current program, clearing the all PORTB pins and setting them all for output couldn't seem to work since portb.2 and portb.3 are used for storing the Cds values which serve as input. I've tried adding LOW PORTB.7 after each pulsout but it still doesn't work. About the LCD thing, I'll try it when I get to school since that is the only place where the LCD is available. I'll update you when I get the results. :)

scaenix
- 20th February 2007, 02:54
hmm..can anyone please tell me what command to send to a servo motor -- a modified one for continuous rotation-- in order for it to stop? Thanks! :)

scaenix
- 20th February 2007, 12:10
Oh well! Howdy! I've finally figured it out. I've figured out how to stop the servo motor and adding a reverse functionality to it. Thanks for the help guys! Thanks very much for all the helpful post. More power to all! :D