Search found 49 matches

Return

by Spanish_dude
Mon May 02, 2011 3:45 pm
Jump to forum
Jump to topic

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 )
by Steve
Thu Apr 24, 2008 10:22 am
Jump to forum
Jump to topic

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.
by Benj
Tue Apr 22, 2008 10:04 am
Jump to forum
Jump to topic

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...
by medelec35
Wed Jun 15, 2011 1:48 pm
Jump to forum
Jump to topic

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.
by Benj
Wed Jun 15, 2011 3:25 pm
Jump to forum
Jump to topic

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...
by JonnyW
Thu Jun 16, 2011 9:47 am
Jump to forum
Jump to topic

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...
by medelec35
Thu Jun 16, 2011 6:11 am
Jump to forum
Jump to topic

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...
by Benj
Thu Jun 16, 2011 5:11 pm
Jump to forum
Jump to topic

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.
by Steve
Thu Jul 07, 2011 11:39 am
Jump to forum
Jump to topic

Re: Formulae wth bytes and intergers

Does this work any better:

Code: Select all

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

I don't think this will add much time onto the processing.
by Steve
Mon Jul 11, 2011 8:40 am
Jump to forum
Jump to topic

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 ...
by Benj
Mon Jul 11, 2011 11:11 am
Jump to forum
Jump to topic

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...
by Steve
Tue Jul 12, 2011 11:30 am
Jump to forum
Jump to topic

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...
by Steve
Tue Jul 12, 2011 3:45 pm
Jump to forum
Jump to topic

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.
by Benj
Tue Jul 12, 2011 6:00 pm
Jump to forum
Jump to topic

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...
by Steve
Thu Jul 21, 2011 2:52 pm
Jump to forum
Jump to topic

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...
by Benj
Thu Jul 14, 2011 11:59 am
Jump to forum
Jump to topic

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.
by medelec35
Sat Nov 26, 2011 9:04 pm
Jump to forum
Jump to topic

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...
by medelec35
Tue Jan 24, 2012 5:31 pm
Jump to forum
Jump to topic

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...
by Benj
Tue Jan 24, 2012 4:05 pm
Jump to forum
Jump to topic

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.
by Steve
Tue Jan 24, 2012 3:04 pm
Jump to forum
Jump to topic

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...
by Benj
Tue Mar 27, 2012 12:21 pm
Jump to forum
Jump to topic

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...
by Benj
Thu Mar 29, 2012 4:32 pm
Jump to forum
Jump to topic

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.
by Benj
Thu May 03, 2012 5:25 pm
Jump to forum
Jump to topic

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 # ######################...
by Benj
Mon May 21, 2012 11:08 am
Jump to forum
Jump to topic

Re: LCD speed

Hello, A simple fix might be to call the LCD start macro in your program loop instead of the LCD clear command. The start macro will take slightly longer to execute but should allow the display to re-sync and ensure there is no lasting corruption. Otherwise you could maybe disable interrupts just wh...
by medelec35
Tue May 22, 2012 7:13 am
Jump to forum
Jump to topic

Re: Clock will not start

Hi echase, The only thing I can see that can cause an issue is Low voltage programming is enabled. You can try disabling it. Ben posted a good point: For my two pence worth if LVP is enabled and you do not have a pull down resistor connected to that pin then there is a chance of the pin floating hig...