MEL PICBASIC Forum - Beginners

• ### Recent Forum Posts

#### Re: Doing something at predefined amount of steps?

for the sign, so long as a & b are the same variable type:

if (a - b) > a then
sign = 1 ' result will be negative
else
sign = 0 ' result will be positive or zero
endif

Art Today, 05:24

#### Re: Doing something at predefined amount of steps?

No, 200-300=65436.
65435 is -101 in two's complement because 65435+101 = 65536 which, when being truncated to 16 bits is 0.

If what you want is the difference between the two numbers while not...

HenrikOlsson Yesterday, 23:01

#### Re: Doing something at predefined amount of steps?

Thanks Henrik, so Say A=200 B=300, C in this case will be 65535-100=65435, right? So if I take 65535 and minus it result, I should receive correct difference between A and B, right?

CuriousOne Yesterday, 18:46

#### Re: Doing something at predefined amount of steps?

towlerg Yesterday, 18:13

#### Re: Doing something at predefined amount of steps?

It will wrap around, 0-1=65535 provided the variable where the result is stored is a WORD.

HenrikOlsson Yesterday, 17:23

#### Re: Doing something at predefined amount of steps?

Oh and by the way, currently I don't have access to machine with PBP, what will happen if C=A-B and B is > A ? all variables are word length. I need to determine difference between A and B, but...

CuriousOne Yesterday, 16:56

#### Re: Doing something at predefined amount of steps?

Yes, I meant exactly that one.

In my case, there will be 16F886 running at 8mhz and maximum frequency will be around 2khz, so I guess, modulo variant will also work. Will assemble test circuit...

CuriousOne Yesterday, 16:54

#### Re: Doing something at predefined amount of steps?

Wasn’t it just something like this?
not even timing of course because every fifth iteration takes slightly longer to execute, but could be balanced up if it mattered.

variable var word...

Art Yesterday, 15:30

#### Re: Doing something at predefined amount of steps?

I don't know for sure but since it involves division my guess is that this is slower. Speed isn't always everything though.

Tell you what, why don't you try both ways and measure the difference,...

HenrikOlsson Yesterday, 15:01

#### Re: Doing something at predefined amount of steps?

Thanks! this is way better and simpler. Speaking speed-wise, will this be faster in execution than my code with additional variable?

CuriousOne Yesterday, 14:42
• # Beginners

### [Beginner Tutorial] How to get started with PICBASIC PRO Demo, MicroCode Studio & PICKIT 2

by Published on - 26th June 2011 16:15  Number of Views: 4546

So you're new to PBP and want a simple step-by-step guide? This one will show how how to get started with
• PicBasic
...

### [Beginner Tutorial] How to get started with PICBASIC PRO Demo, MPLAB & PICKIT 2

by Published on - 23rd June 2011 21:52  Number of Views: 4681

So you're new to PBP and want a simple step-by-step guide? This one will show how how to get started with
• PICBASIC
...

### Belorussian translation

by Published on - 31st May 2011 12:18

Original Article is here: http://www.fatcow.com/edu/melabs-picbasic-be/

Translated by: Bohdan Zograf
...

### Forum Latest Posts

Number of Views: 1937

Some users like to be able to view the most recent posts on the forum. They wish to visit the forum and view the latest posts in all category's in cronological order, without having the forum hide posts that they have all ready seen.
...

### Today's Post Search or the Missing Link

by Published on - 1st May 2010 04:59  Number of Views: 2304

With all of the added benefits or the new forum, a useful feature has been lost. This is the "Today's Post" link that was found in the "Quick Links" drop down. Due to compatibility issues with future updates from vBulletin this link can not be brought back.

But there is a couple of ways to do the same thing using the same amount of mouse clicks once it is set up.
...

### Use of Microchip Trademarks and Brands – Guidelines

Published on - 23rd April 2010 19:52  Number of Views: 6026

Microchip brand identity is a valuable asset protected by trademark law. Microchip aims to protect this asset by ensuring that its trademarks are used properly by Microchip, its customers, licensees, distributors, vendors, consultants, developers and others. You may use Microchip trademarks and product names to refer to Microchip products and services as long as you follow these Guidelines.
...

### How to enter "®" , "©" and "™" symbols

Published on - 23rd April 2010 19:48  Number of Views: 2519