using AND as an IF statement


Closed Thread
Results 1 to 28 of 28

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    No, you should have left your post as it was. Your opinion and point of view is as valid as mine or anyone elses.

    I don't run the board... I'm nothing to do with MeLabs, or Crownhill (the nice folks who own the board), or Microchip, I'm just like you... but for my sins (which are many) and sarcasm (available in abundance) I have been awarded the God-like power of Administrator...

    Criticism is always good - as long as it is just. And I agree with your previolus comments on the limitations of PBC. I don't agree that you or others were tricked in any way into buying a $99 product because it clearly does everything that it is advertised that it can do. You can't go and buy a bottom-end Mercedes A10 and then complain it hasn't got the features and performance of a Mercedes 300SLK Turbo - yet both carry the same badge on the front.

  2. #2
    Join Date
    Nov 2004
    Location
    Saskatchewan Canada
    Posts
    189


    Did you find this post helpful? Yes | No

    Default

    FWIW,

    The lack of IF...THEN...ELSE...ENDIF in PBC is the most frustrating of all to be missing. I knew they weren't there when I bought and I knew for what I was doing at the time I could live without them, but the project would have came together easier with them.

    This is the only set of commands I really missed from PBC and because they are so useful I couldn't help but feel the package was a bit crippled without them. I think they should be there IMO to move PBC from "usable" to "useful".

    I've since switched to PBP so I could avoid having to work around what was missing. PBP is probably overkill for my use and PBC is underpowered, but there is no middle ground with their product. I don't care to make a switch to another product now that I am where I am, but I do understand the frustration level with PBC missing some key commands.

    Bart

  3. #3
    mramos's Avatar
    mramos Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie
    You can't go and buy a bottom-end Mercedes A10 and then complain it hasn't got the features and performance of a Mercedes 300SLK Turbo - yet both carry the same badge on the front.
    BASIC has had "if endif" in all that I have used since 1981 (excluding GWBASIC/BASIC) , on many platforms and OSs (uC to PC, Unix, MAC, etc).

    Far as the car (if a car was basic), I agree, but I need four tires, motor, steering wheel, transmission. "IF ENDIF" to me is part of basic (and be part of a writing basic code) and good programming practice. My thought is give up the i2C for ENDIF for the beginners. If they are buying devices like 12c and LCDs they should then spend some money on the PRO version.

    My plan was to port all my Atmel RVKBASIC programs to PBASIC. Without the proper conditional form of IF ENDIF, it would take some time. I have cancelled that plan for now.

    I would rather see clean (readable) code. I did not think I was tricked, the more I read, the more I think they are after the Parallax people. That is fine, but it woud make the standard basic more like a standard basic IMHO.

    I will pop in, I love to help people, I have good status (like yours) on some of the EE forums. Sadly, I feel I am now forced now spend even more for something that I think should be in there and out the cash for the standard.

    I can make an include a 16628.inc with the ports defined and others defines for the values I need to drop in the registers, that will not be an issues, I hope it has an include function in the standard... And I will make it work for future projects. And MEL did tell me a trick to solve the lack of support for certain older pics. So I am good. Just not porting all my stuff to PICS, too much work.

    Oh yea, in that post I edited, I did remove what I think the fellow meant in his original post. Sorry. He had a typo.

    Anyway, thanks for your input.

  4. #4
    mramos's Avatar
    mramos Guest


    Did you find this post helpful? Yes | No

    Default

    Bartman, thanks for understanding my point.. I feel the same way, that a basic command is "crippled" that should not be. The rest of it, I will work around.

    To have clean code (easy to understand, is that not why we like BASIC). It is needed.

    If I want to GOTO (jump all over) ASM has GOTO. hehehe.. The manual even
    starts walking about GOTOs all over.

    And the help files in the IDE should be broke up for better understanding.

    Again, my thoughts.

  5. #5
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by mramos
    ...that a basic command is "crippled" that should not be. ...
    It's not actually crippled, it is just not developed. MELabs put less work into it, they charge less for it. As you noted, it is much closer to ASM than it is to BASIC.

    Much like ErnieM's #2 and I am sure others, here is what I did in the past. It is not quite as clean as the PBP version but is quite readable nonetheless (one extra goto per if-then)

    ;in PBP

    If X = 5 then
    x = 5
    y = 6
    z = 7
    Else
    x = 7
    y = 0
    z = 6
    Endif

    ;in PBC

    If X<>5 then Else1
    x=5
    y=6
    z=7
    goto EndIf1
    Else1:
    x=7
    y=0
    z=6
    EndIf1:


    for the next If-Then, use Else2, Endif2, etc.


    Paul Borgmeier
    Salt Lake City, Utah
    USA
    Last edited by paul borgmeier; - 1st June 2006 at 07:40.

  6. #6
    mramos's Avatar
    mramos Guest


    Did you find this post helpful? Yes | No

    Default

    That will work if you have 3-5 IF ELSE ENDIF. Also, you might want to indent the code between the IF ELSE ENDIF.

    But it will make extra work.

  7. #7
    Join Date
    Nov 2004
    Location
    Saskatchewan Canada
    Posts
    189


    Did you find this post helpful? Yes | No

    Default

    I don't quite agree with you Paul.

    It is called "BASIC" and Basic commands are missing. I was using proper IF...THEN...ELSE...ENDIF 20 years ago when I learned Basic so to me it is rather incomplete without them. Yes, you can work around them. You shouldn't have to.

    As mentioned, there are other commands which aren't so "Basic" that could have been saved for PBP that are included with PBC. The trade off isn't the most useful I don't think.

    Bart

  8. #8
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by bartman
    Yes, you can work around them. You shouldn't have to.
    You do not have to - upgrade to PBP and problem solved! (That is what I did half a decade ago. Upgrading to PBP costs you no more than starting with PBP.)

    Quote Originally Posted by mramos
    That will work if you have 3-5 IF ELSE ENDIF. Also, you might want to indent the code between the IF ELSE ENDIF.

    But it will make extra work.
    I do not see why you are limited to 3-5 IF's - you should only be code space limited. Just increase the number for each Else EndIf and all will be well. Yes, it is a little extra work - I was just providing a work around that worked for me. As noted above, I solved my problem by upgrading and could not be happier.

    Paul Borgmeier
    Salt Lake City, Utah
    USA

  9. #9
    dw_pic's Avatar
    dw_pic Guest


    Did you find this post helpful? Yes | No

    Default continued: Using AND as an IF statement

    Hi Paul,
    And thanks for your post.
    I am the originator of the post, and yours has been the closest to responding to its original meaning. Although, I have been entertained by the various responses. Thats part the fun.

    Its fun to watch a topic start and monitor its wild swings.
    I got the original PBC years ago when it first came out, and yes, I was extremely happy with it. I knew, from many programming languages previous, that the IF test statement was missing, and without it, have created many real fun projects. My latest (last winter) was an automated antenna tuner run by just one pic. It constantly monitors the frequency band of my transmitter, and pre-sets up the tuner which is located about 30 feet outside, for a low SWR on 9 different bands.

    Part of the fun for me, is being able to create something for under $50 which would haved cost me close to $400 off the shelf.

    I pondered whether to simply purchase PBP for this latest project.

    The weird thing is, I could sware that I figured out a way to make a semi- IF statement work using the AND in PBC on one of my very first projects.
    I have scratched through all of my old projects paperwork finding nothing.

    I figured, with all of the top notch programmers on this BB, that someone would have been doing something similar. Perhaps even a pre-built assembly subroutine that would simulate an IF statement.

    I guess not.
    But let the fun continue!!
    Thanks dude,
    dw_pic


    Quote Originally Posted by paul borgmeier
    It's not actually crippled, it is just not developed. MELabs put less work into it, they charge less for it. As you noted, it is much closer to ASM than it is to BASIC.

    Much like ErnieM's #2 and I am sure others, here is what I did in the past. It is not quite as clean as the PBP version but is quite readable nonetheless (one extra goto per if-then)

    ;in PBP

    If X = 5 then
    x = 5
    y = 6
    z = 7
    Else
    x = 7
    y = 0
    z = 6
    Endif

    ;in PBC

    If X<>5 then Else1
    x=5
    y=6
    z=7
    goto EndIf1
    Else1:
    x=7
    y=0
    z=6
    EndIf1:


    for the next If-Then, use Else2, Endif2, etc.


    Paul Borgmeier
    Salt Lake City, Utah
    USA

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