MEL PICBASIC Forum - MicroCode Studio Plus 5.0

• Recent Forum Posts

Re: Help with Using the Catalex MP3 Player

Hi

Program is doing what I want for now.... putting the clear in before the goto has cleared a lot of the issues.

I know it is still not elegant and will have issues still... I am "not" a...

andybarrett1 Yesterday, 09:13

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 Yesterday, 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 - 21st July 2019, 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 - 21st July 2019, 18:46

Re: Doing something at predefined amount of steps?

towlerg - 21st July 2019, 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 - 21st July 2019, 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 - 21st July 2019, 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 - 21st July 2019, 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 - 21st July 2019, 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 - 21st July 2019, 15:01
• MicroCode Studio Plus 5.0

MicroCode Studio Plus 5.0 (compatible with PBP 3.0 or later)
The main editor provides full syntax highliMicroCode Studio Plus is a powerful, visual Integrated Development Environment (IDE) with In Circuit Debugging (ICD) capability designed specifically for PICBASIC PRO™ Compilerghting of your code with context sensitive keyword help and syntax hints. The code explorer allows you to automatically jump to include files, defines, constants, variables, aliases and modifiers, symbols and labels, that are contained within your source code. Full cut, copy, paste and undo is provided, together with search and replace features.

 Full syntax highlighting of your source code Quickly jump to include files, symbols, defines, variables and labels using the code explorer window Identify and correct compilation and assembler errors View serial output from your microcontroller Keyword based context sensitive help Support for MPASM
It's easy to set up your compiler, assembler and programmer options or you can let MicroCode Studio do it for you with its built in autosearch feature. Compilation and assembler errors can easily be identified and corrected using the error results window. Just click on a compilation error and MicroCode Studio will automatically take you to the error line. MicroCode Studio even comes with a serial communications window, allowing you to debug and view serial output from your microcontroller.
 In Circuit Debugger (ICD)
Each line of source code is animated in the main editor window, showing you which program line is currently being executed by the host microcontroller. You can even toggle multiple breakpoints and step through your PICBASIC PRO™ code line by line.

 Using the MicroCode Studio ICD can really help accelerate program development. It's also a lot of fun and a great tool for learning more about programming PIC microcontrollers.