## Search found 49 matches

Return

Mon May 02, 2011 3:45 pm

### Re: LCD will not release Port B lines

echase wrote: portb = portb & 0xF0; //Clears the high nibble of the port ensuring the E is not high when the outputs are enabled.

This doesn't clear the high nibble but the low nibble. ( X & 0 = 0 )
Thu Apr 24, 2008 10:22 am

### Re: LCD will not release Port B lines

Setting a bit in TRISx to 0 will set the pin to be an output. And the pin will then be outputting 1 or 0 depending on the value in the PORTx register.
Tue Apr 22, 2008 10:04 am

### Re: LCD will not release Port B lines

Hello Echase What I would do is the following. In your LCD component C file in the Flowcode V3/Components directory at the beginning of every function add the following line of code: trisb = trisb & 0x0F; //Sets the high nibble to an output Then at the end of every function (but before the final...
Wed Jun 15, 2011 1:48 pm

### Re: Multiplying or dividing large numbers

From experience using integers any intermediate or final results of calculations must never exceed 32767.
If it does then results will be wrong. The simulator does not take this fact into account.
Wed Jun 15, 2011 3:25 pm

### Re: Multiplying or dividing large numbers

Hello, It depends what you want to do with the variable. Flowcode can currently only deal with signed int variables so you could type cast the variable to unsigned but then say you wanted to print out the number on the LCD, the code to allow this assumes a signed variable. Therefore to do this you w...
Thu Jun 16, 2011 9:47 am

### Re: Multiplying or dividing large numbers

Hi there. In Flowcode v5 we have plans to support unsigned 16 and 32 bit values. It would also be nice to have abs() and sgn() functions and I'll put this on the suggestion list. Until then, the single line: result = value * (1 | -(value < 0)) Will do the job of abs() in a single calculation line. I...
Thu Jun 16, 2011 6:11 am

### Re: Multiplying or dividing large numbers

Attached is how I would convert signed numbers into unsigned numbers. Its very simple and does not use C Since it uses int, it will only convert numbers down to -32768 There maybe a simple method using C e.g using unsigned short, but that's not my area of expertise. :cry: Hope this is what your afte...
Thu Jun 16, 2011 5:11 pm

### Re: Multiplying or dividing large numbers

Hello,

The abs() function that Jonny was talking about does the following.

"Calculates the absolute value (magnitude) of a number. The absolute value of a number is always positive."

http://processing.org/reference/abs_.html

| is indeed a logic level OR operator.
Thu Jul 07, 2011 11:39 am

### Re: Formulae wth bytes and intergers

Does this work any better:

Code: Select all

`Integer2 = Byte1-127Integer2 = (((Integer1-511)/2 ) * Integer2)/20`

I don't think this will add much time onto the processing.
Mon Jul 11, 2011 8:40 am

### Re: Formulae wth bytes and intergers

You are correct - the ADC conversion will be the bottleneck in your code. To overcome this, you can make use of the ADC interrupt to tell you when the conversion is complete. Alternatively, you can set the ADC conversion going and then do some other processing (e.g. on a previously-stored ADC value ...
Mon Jul 11, 2011 11:11 am

### Re: A/D speed up

Hello, In answer to your questions. There is a charge time associated with sampling an ADC channel. If you are only ever sampling a single channel then the charge time can be negated, if however you are sampling multiple channels then the charge time must be present or the channels will appear to bl...
Tue Jul 12, 2011 11:30 am

### Re: Formulae wth bytes and intergers

There are two "bottlenecks" in the code. One is the delay for the acquisition time and the other is the loop which waits for the ADC conversion to complete. You can try reducing the acquisition time. If you are using only one ADC channel then this can probably be quite low. The loop to wai...
Tue Jul 12, 2011 3:45 pm

### Re: Formulae wth bytes and intergers

You will also need to ensure that the TRIS setting for your ADC bit is set as an input, and that the ANSEL register is set correctly.
Tue Jul 12, 2011 6:00 pm

### Re: Formulae wth bytes and intergers

Hello, The read As Integer function itself is not very long, however it calls the sample function so this is probably what is taking the time. You can read the ADC registers by using the following C code where you have an INT variable named ADCread in your program. FCV_ADCREAD = (adresh << 2); FCV_A...
Thu Jul 21, 2011 2:52 pm

### Re: Formula returning wrong answer

You might find that the complex calculation should only be done at the time you present the data onto the LCD. If this is the case, then performing the calculations only just before the LCD write would make sense. Your suggestion of dividing by multiples of 2 will certainly make the calculations sim...
Thu Jul 14, 2011 11:59 am

### Re: A/D speed up

Hello,

Yes I see that my calculation for the timing was well off. For the v5 ADC component I will make the transition to a time delay rather then the current number of cycles around the loop and hopefully this will make getting the charge time correct much easier.
Sat Nov 26, 2011 9:04 pm

### Re: Weak pull-ups

I was correct with what I have posted above, except it will not compile because of bugs in 16F690.TDF and PIC16F690.h files. I have updated them, so if you back up your current 16F690.TDF (located in \Matrix Multimedia\Flowcode V3\boostc\config) and PIC16F690.h ( located in \Matrix Multimedia\Flowco...
Tue Jan 24, 2012 5:31 pm

### Re: Flowcode 5 features

Hi echase, Re 2) I have posted an article here: http://www.matrixmultimedia.com/mmforums/viewtopic.php?f=26&t=10088 That uses a third part software to run a script and operate any key sequence in any order. You can key map a pot and alter script so pot goes in one direction then the other. Not s...
Tue Jan 24, 2012 4:05 pm

### Re: Flowcode 5 features

Hello,

There shouldn't be any issues with opening a v3 file into v5. Any issues such as component updates/changes should be flagged to you on opening the file.
Tue Jan 24, 2012 3:04 pm

### Re: Flowcode 5 features

I'm afraid the answer to most of your questions is "no". C code is not simulated, and we don't yet have stimulus on simulation inputs. The VNET feature has not changed between V4 and V5 and currently only works with CAN, RS232 and pin i/o inter-connections. We plan to expand this in a futu...
Tue Mar 27, 2012 12:21 pm

### Re: Changes in v5

Hello, Here are some answers to your questions. 1) As standard the v5 ADC component is the same as it always was. We have added extra features in the form of additional functions which allow you to setup the channel in A2D mode and then sample as fast as you can if you wish. 2) in v5 we have put a l...
Thu Mar 29, 2012 4:32 pm

### Re: Changes in v5

Hello,

No direct support for multiple ADC peripherals in v5 but it's be fairly simple to control the second channel device using a bit of C code. May even be able to use the v5 Code abstraction to take care of it all for you.
Thu May 03, 2012 5:25 pm

### Flowcode v5.2 for PIC Released

Hello, Flowcode v5.2 has now been officially released. Please use the Help -> Check for updates menu in Flowcode to update your version to the latest release. Here is the v5.2 changelog. ################################ # Flowcode for PICmicros V5.2 # # Release: 3rd May 2012 # ######################...
Mon May 21, 2012 11:08 am