using AND as an IF statement


Closed Thread
Results 1 to 28 of 28

Hybrid View

  1. #1
    dw_pic's Avatar
    dw_pic Guest

    Default using AND as an IF statement

    With the picbasic IF statement being limited to a simple GOTO function, it seems to me that I remember ever being creative with in an AND statement to manipulate variables.


    i.e.

    B0 = 5 AND B1 = 10

    In english, this translates to: If B1 = 10 then load B0 with a 5

    has anyone done this or anything similar??

    Tnx,
    dw

  2. #2
    Join Date
    Jul 2005
    Posts
    78


    Did you find this post helpful? Yes | No

    Default

    B0 = 5 AND B1 = 10
    Well, that's not how myself or any compiler would read that statement, so you don't want to use AND. Try this:


    Code:
        IF B0 <> 5 THEN  NoSet
        B1 = 10
    NoSet:
      ' rest of program here
    What we're doing here is to establish a jump if our condition is not true. When the condition is true, we make the assigement (B1 = 10). If it is not true, we jump around the assignment to the next instruction.

    (If this seems convoluted, it is. The Pro version does not have this limit)

  3. #3
    mramos's Avatar
    mramos Guest


    Did you find this post helpful? Yes | No

    Default

    I think MEL basic should have a proper IF ENDIF.. So people can use good programming practices.. That better.
    Last edited by mramos; - 31st May 2006 at 11:38.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    I'm pretty sure many user will learn a big deal of the previous... but we really don't need that kind of post, neither that kind of user.

    If AVR is the best one for you... use it

    If other forum have much traffic and your pleased with them... go ahead.

    Usually when i buy something, i read the specs. It all white on black in the Melabs website. There's also comparison between their PBC and PBP.

    If you'd never spend time to read it before... too bad. Buying an PBC to PBP upgrade will give you what you don't have in PBC.

    BTW, compiler battle is a common and endless story. Same in C language, in Pascal, in Basic, in.., in... in their respective forums.

    Seems kids need it... seems testosterone need to get out sometimes.

    Good luck!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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


    Did you find this post helpful? Yes | No

    Default

    No mramos, your post won't be removed - because everyone is entitled to their opinions and yours are as respected here as everyone elses provided correct decorum is observed.

    It is naive to say that company X has better chips than company Y. Atmel has a better price/performance point over Microchip is some areas, in others Microchip is the winner. It is dependant on your application.

    Forums with 'lots of traffic' could also indicate problems with the product. The biggest issue with PICBasic is folks don't read manuals or Datasheets or know electronic basics. Remove those kind of posts and there really would be no need for this forum at all!

    Likewise PICBasic is aimed at a price point. You saw (or should have) what it's specification was before you bought it. MeLabs make no secret of PBC's capabilities and it should not be a surprise when it dropped through your letterbox. The manual is freely downloadable and you should have noticed it doesn't have features like LCDOUT, although it doesn't stop you from interfacing an LCD - it's just more troublesome. If you are a professional where time is money, then you should have bought the PRO, because you will have recouped your additional outlay with the very first project.

    On the other hand, if you have a bottom-end product that is 'complete', there's really no incentive to buy the PRO version is there? So you effectively kill the sales of a product that pays the Mortgage in exchange for a product that barely keeps you fed. Selling microcontroller compilers isn't exactly a mass-market "every home must have one" product.

    I also have a product which is designed in a BASIC and a PRO version. The BASIC is exactly the same as the PRO but has all the good bits removed. Salesmen come back every day moaning that they want the features of the $3,000 product in the $900 product - and the answer is NO. If the customers want those features, then they have to buy the $3,000 product - it's what puts the jam on the bread and butter.

  6. #6
    mramos's Avatar
    mramos Guest


    Did you find this post helpful? Yes | No

    Default

    Melanie,

    I EDITED the previous post, at least someone that runs the board saw it.

    And it was accurate, but that post will probably not change the issue just get flames from a few that probably own PNP. If MEL sold more compilers, there would be a lot more people here, and not all with the same problem.

    I would think, BASIC standard would be the basic compiler to learn to program ming properly with basic, and pro would allow one to expand into commercial products (added peripheral support). Which people that learned the standard would surely move into PBP once they learn. $250 is a big drop for a college student or someone looking for a hobby, so they would try the $99 program first. As a programmer, I was sortta like, how will people learn, have to invert logic to GOTO a routing. In a manual that says avoid using GOTOs, OK use THEN (that is a goto)

    It is hard to know what it does until you get it and try it. I was disappointed.
    I will use it for very small projects.

    Atmel is a better chip (speed and price wise), and coming from a $45 RVKBASIC to PBASIC, well, what can I say... I left Atmel as they did not support the Tiny11 and I had a bunch of them (it required high voltage serial programming). But now I have a bunch of 12F509s I can not use as well as PBASIC does not do them. My logic, if does the 628A, surly it was the 508/509. I should have read more. But MPLAB and PIC assembler is not all that hard, so I will use the chips.

    I will give PBASIC more time, but I think MEL is missing a big market.

Members who have read this thread : 2

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