Search found 759 matches

by JonnyW
Wed Nov 16, 2011 4:08 pm
Forum: C and ASM Programming
Topic: Register defintion
Replies: 1
Views: 3513

Re: Register defintion

Hi Jan. You would typically use the pre-processor for this: #ifdef MY_CHIP char REGISTER_NAME; #else char YOUR_REGISTER_NAME; #endif This means that the C compiler would never see the inappropriate definition. For portability it may be an idea to define a 'generic' register name that you can use any...
by JonnyW
Thu Nov 10, 2011 3:02 pm
Forum: Flowcode V4
Topic: AD averaging
Replies: 12
Views: 11116

Re: AD averaging

Yes, it is nice - I have a method I use at home using arrays, it might well get updated to use this system!
by JonnyW
Thu Nov 10, 2011 1:28 pm
Forum: Flowcode V4
Topic: AD averaging
Replies: 12
Views: 11116

Re: AD averaging

Nice method Jan. I've always used arrays for this. One word of warning - the moving average will produce inaccurate results for the first N elements added (where N is the array size). For example: * MA initialised to 0 (no samples) * Sample 96 is added * MA = MA - (MA/8) + (96/8) = 12 But the averag...
by JonnyW
Wed Nov 09, 2011 7:58 pm
Forum: Flowcode V2 & V3
Topic: .Bmp to LCD ??
Replies: 52
Views: 36612

Re: .Bmp to LCD ??

A bitshift is done using the 'logical shift-left' operator: r = r << shift This is equivalent of multiplying by 2 to the power 'shift', but is much faster and easier for the chip to handle. If the bitmap doesnt look right, then its likely the bits-per-pixel are wrong in some way (some LCDs use 6 bit...
by JonnyW
Wed Nov 09, 2011 6:04 pm
Forum: Flowcode V2 & V3
Topic: .Bmp to LCD ??
Replies: 52
Views: 36612

Re: .Bmp to LCD ??

Hi there. The 'load a pixel' is calling the load_word() macro - the first of the images. This loads 2 bytes from the FAT16 component and 'bolts' them together, forming your 16-bit word that will be the pixel. This is then stored in variable 'pixel' which is 'dissected' into its red, green and blue c...
by JonnyW
Wed Nov 09, 2011 3:12 pm
Forum: Flowcode V2 & V3
Topic: .Bmp to LCD ??
Replies: 52
Views: 36612

Re: .Bmp to LCD ??

Hello. First and most importantly, I hope you liked the article! I have upgraded that now so it varies the temperature based on day length. Anyway, no probs - these things seem complicated but once you get into them it becomes much easier. I dont have Flowcode v3 installed on my machine so couldn't ...
by JonnyW
Wed Nov 09, 2011 10:48 am
Forum: Flowcode V2 & V3
Topic: .Bmp to LCD ??
Replies: 52
Views: 36612

Re: .Bmp to LCD ??

Hello. I doublt there is much you will need to convert to an array here, not unless you want to hold the pixels in memory instead of just displaying them. A .bmp file can be read as a stream of bytes, and you can load the pixels one at a time without having to 'remember' them in an array. I'm assumi...
by JonnyW
Tue Nov 08, 2011 9:24 pm
Forum: Flowcode V4
Topic: Is there any way to....
Replies: 7
Views: 3883

Re: Is there any way to....

Hi. Yes - if you just want to invert all bits then 'not' is better than 'xor' - you would tend to use xor to invert a selection of bits, like 0xF, and leave the other bits as they were.

Jonny
by JonnyW
Mon Nov 07, 2011 3:06 pm
Forum: Flowcode V4
Topic: Is there any way to....
Replies: 7
Views: 3883

Re: Is there any way to....

Hello. You want to use exclusive OR:

Code: Select all

Read input
input = input ^ 0xF
This should invert all the bits on your input.

Cheers,

Jonny
by JonnyW
Mon Nov 07, 2011 2:50 pm
Forum: Flowcode V4
Topic: Anybody have ideas how to fix this
Replies: 4
Views: 3152

Re: Anybody have ideas how to fix this

Hi Jordy. I'm not an embedded engineer so cant help with your oscilloscope problem, but I'll ask someone here (probably Ben or Sean) to take a look. One point, you mentioned your arrows sometimes display twice - I cant simulate or test your program as you are using a custom component for the LCD but...
by JonnyW
Fri Nov 04, 2011 10:27 pm
Forum: Flowcode V4
Topic: Anybody have ideas how to fix this
Replies: 4
Views: 3152

Re: Anybody have ideas how to fix this

Hi Jordy. The number you describe, 32.76 looks like the upper limit to an 'int' - 32768 is hex 8000, which is the signed lowest value available. Im afraid I dont have access to Flowcode v4 at the moment but if you ammend your code from: temp_calculated = (onewire_temp_lowbyte << 8) + onewire_temp_hi...
by JonnyW
Thu Nov 03, 2011 5:58 pm
Forum: Flowcode 4 Suggestions
Topic: sizable Pinout window
Replies: 1
Views: 6491

Re: sizable Pinout window

Hi Rob. In v5 the chip window can be scaled to double its original size.

Cheers,

Jonny
by JonnyW
Thu Nov 03, 2011 9:58 am
Forum: Flowcode V4
Topic: V5
Replies: 21
Views: 10127

Re: V5

Hi Jorgen. In answer to your questions: Is it not possible to download a demo version? so you can just see the difference. Unfortunately not at the moment. We are currently in the final stages of development and testing on v5 and I would imagine the demo would come out some time around the release o...
by JonnyW
Fri Oct 28, 2011 9:40 pm
Forum: Flowcode V2 & V3
Topic: Using the random number function on C to make delays random
Replies: 3
Views: 5134

Re: Using the random number function on C to make delays ran

Hi Ziggy. In your flowchart, create a variable and call it, say, 'rnd_seconds' - if you are only worried about an accuracy to the nearest second you can create this as a byte or int, it doesnt matter. Now create a calculation icon containing the code: rnd_seconds = random() % delay_time Where delay_...
by JonnyW
Sun Oct 16, 2011 10:03 pm
Forum: Flowcode V4
Topic: If statement not working with OR?
Replies: 11
Views: 7325

Re: If statement not working with OR?

Hi Martin. I am not famillar with the book, but I assume either this is a book based around C or BASIC, or the example is pseudo-code and not specific to a language. Either way, 'OR' isnt a C keyword or operator, and I assume this book would be generalising in this case as to correct use of brackets...
by JonnyW
Wed Oct 12, 2011 12:22 pm
Forum: Flowcode V4
Topic: If statement not working with OR?
Replies: 11
Views: 7325

Re: If statement not working with OR?

Hi. Yeah, that may well be the case, depends on the compiler and the context its used in. I added a C code icon that did the following and the lines produced very different ASM (though my PIC8 assembly eye is pretty untrained itself): int A, B; A = (A | B); A = (A || B); However, the generated C/ASM...
by JonnyW
Wed Oct 12, 2011 10:45 am
Forum: Flowcode V4
Topic: output calculation?
Replies: 2
Views: 2216

Re: output calculation?

Hello. Out of sheer morbid curiosity could you post the code that this is done in please? Im interested to know if this is pure code or this is 'a couple of lines of C code that actually call a large and complex function'. If its pure code, its possible for any C-type compiler that supports that har...
by JonnyW
Wed Oct 12, 2011 10:25 am
Forum: Flowcode V4
Topic: If statement not working with OR?
Replies: 11
Views: 7325

Re: If statement not working with OR?

Morning. Both operators can be used on any integer values, regardless of the bit size of that value. The reason why OR works as expected in the conditional is C (and Flowcode) treat 'true' as 'not false', therefore any non-zero value is true. For conditionals it is not usually as efficient, however,...
by JonnyW
Tue Oct 04, 2011 1:10 pm
Forum: Flowcode V4
Topic: calling a macro from assembler
Replies: 5
Views: 4464

Re: calling a macro from assembler

I'm not sure what you meant by "I am not familiar with PIC assembly but Im assuming you will have to push each argument you need first. You can view the C code and cut-paste the exact definition from there" Dont worry about it - I meant if you were calling a macro with multiple arguments, or using ...
by JonnyW
Mon Oct 03, 2011 10:27 pm
Forum: Flowcode V4
Topic: calling a macro from assembler
Replies: 5
Views: 4464

Re: calling a macro from assembler

Yeah - different C compilers have slightly different ASM syntax. It may have been that the help file documented a way to do it with one compiler which differed from another, or that the compiler documented used to behave like that but doesnt any more. We will hopefully try to make things like this c...
by JonnyW
Mon Oct 03, 2011 9:43 pm
Forum: Flowcode V4
Topic: calling a macro from assembler
Replies: 5
Views: 4464

Re: calling a macro from assembler

Hi Dave. After a bit of experimentation the syntax seems to be: asm { call FCM_macro } This is case sensitive (the macro was created lower case) and does not have closing brackets. I am not familiar with PIC assembly but Im assuming you will have to push each argument you need first. You can view th...
by JonnyW
Mon Sep 12, 2011 3:09 pm
Forum: Programming Tips & Tricks
Topic: Problem with c compiler
Replies: 13
Views: 9817

Re: Problem with c compiler

Hi Mile. Please correct this if I am wrong, but this means thet the events, in order, were: Compiled with v3 - No problems Nothing changed Compiled with v3 - Locked up Installed v4 Kept default settings Compiled with v4 - Locked up Uninstalled v3 and v4 Reinstalled v3 and v4 Kept default settings Co...
by JonnyW
Fri Sep 09, 2011 8:56 pm
Forum: Programming Tips & Tricks
Topic: Problem with c compiler
Replies: 13
Views: 9817

Re: Problem with c compiler

Hello milea. We wont be able to take a look at this properly before Monday, Im afraid, but can you post details of anything that has changed on your system between the time that this worked and stopped working? Upgrades to Flowcode, change of OS, changes to filename or file location, edits to the fi...
by JonnyW
Thu Sep 01, 2011 8:46 am
Forum: Flowcode 4 Suggestions
Topic: Comments and Strings
Replies: 7
Views: 11903

Re: Comments and Strings

Hi Nicolas. Yeah, thats the idea. The final version would hopefully work similar to the screenshot. This shows the menu item and some disabled icons too.
Disabled icons
Disabled icons
disabled.jpg (30.28 KiB) Viewed 11854 times
Jonny
by JonnyW
Wed Aug 31, 2011 9:43 am
Forum: Flowcode 4 Suggestions
Topic: Comments and Strings
Replies: 7
Views: 11903

Re: Comments and Strings

Hi there. We have been toying with a couple of possibilities since this was suggested and it works quite well! I doubt you will need to use a goto icon in FC5. Thanks for the suggestion.

Jonny