hi all
when creating a program, for example you had 7 input/outputs on PORTA of your chosen pic and you wished to use the first 3 I/Os as analogue inputs and the second 3 as digital outputs, in assembler language at the beginning you would define this using the trisa and ansel registers I believe, but in flowcode i presume it does this automatically if say you put 3 ADC components and 3 LEDs to the mentioned I/Os above in the 3D system box,and if so is it good practice to define this as you would in assembler at the beginning of your flowchart in a C code box and any other I/Os not being used on any other ports define these as outputs so they are not floating ? or does flowcode do this or would you simply tie these unused I/Os to ground in hardware, I would appreciate your comment thanks in advance
regards bob
PROGRAM SETUP
-
- Posts: 392
- Joined: Wed Jan 05, 2011 11:24 am
- Has thanked: 101 times
- Been thanked: 24 times
- Contact:
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PROGRAM SETUP
Hi Bob,
When you call an input icon the pin is configured an an input and the value read. When you call an output icon the pin is configured as an output and the value written.
When you call an ADC routine the associated pin is configured as an analogue input and the value read, the pin is then re-configured back to it's previous digital state.
This allows for very easy multiplexing of input and outputs and analogue though it will add extra instructions to every I/O related icon.
Unused pins are left as defaults which are usually inputs.
We have recently added a way to speed up time critical components by adding a NoDDR option which allows for basic I/O without performing the data direction instructions.
When you call an input icon the pin is configured an an input and the value read. When you call an output icon the pin is configured as an output and the value written.
When you call an ADC routine the associated pin is configured as an analogue input and the value read, the pin is then re-configured back to it's previous digital state.
This allows for very easy multiplexing of input and outputs and analogue though it will add extra instructions to every I/O related icon.
Unused pins are left as defaults which are usually inputs.
We have recently added a way to speed up time critical components by adding a NoDDR option which allows for basic I/O without performing the data direction instructions.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 315
- Joined: Sun Jun 23, 2013 1:29 pm
- Has thanked: 28 times
- Been thanked: 61 times
- Contact:
Re: PROGRAM SETUP
Hi Bob,
Learnt something new about ADC and FC after Bens answer!!
I'm still struggling to try and learn FC so please take what I'm going to say with a pinch of salt!!
If I where going to read and write to the same Port in FC I would look into using the masking functions within the relevant dialogue box to separate the two. The simulation of this feature works well to see what's going on if you use a LEDs on the dash panel.
Regarding unused pins, as always the datasheet is your first point of call and see if there are any internal resistors etc and go from there. You could always set the pin right at the beginning and then not change it for the duration if you have a concern.
Lastly I would suggest as a rule of thumb to not worry too much about setting specific registers and the like within FC, UNLESS it is something not supported natively within eg internal RTC's or power mangement functions etc
Like I said I'm not proficient enough in FC to give you a definitive answer to you question.
Matt
Learnt something new about ADC and FC after Bens answer!!
I'm still struggling to try and learn FC so please take what I'm going to say with a pinch of salt!!
If I where going to read and write to the same Port in FC I would look into using the masking functions within the relevant dialogue box to separate the two. The simulation of this feature works well to see what's going on if you use a LEDs on the dash panel.
Regarding unused pins, as always the datasheet is your first point of call and see if there are any internal resistors etc and go from there. You could always set the pin right at the beginning and then not change it for the duration if you have a concern.
Lastly I would suggest as a rule of thumb to not worry too much about setting specific registers and the like within FC, UNLESS it is something not supported natively within eg internal RTC's or power mangement functions etc
Like I said I'm not proficient enough in FC to give you a definitive answer to you question.
Matt