ADC help!
ADC help!
Hi folks
Could anyone give me any pointers on how to use the ADC in Flowcode V4?
Ive got 2 LED's flashing flip flop style but would now like to use the ADC facility to control the flash rate.
I aint got a clue where to start!
cheers
Gaz
Could anyone give me any pointers on how to use the ADC in Flowcode V4?
Ive got 2 LED's flashing flip flop style but would now like to use the ADC facility to control the flash rate.
I aint got a clue where to start!
cheers
Gaz
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: ADC help!
have a look here:
http://www.matrixmultimedia.com/mmforum ... 12&p=14003
It was created when V4 was new to me, so its not the most advanced in the word, but it works well to alter led brightness, hence flash rate.
Also to learn more about flowcode 4 you can find a link to V4 examples here:
http://www.matrixmultimedia.com/Flowcode3a-X.php
Scroll down to flowcode extras, then you will see 'Flowcode V4 Examples'
What I do to learn is just load a flowcode example, then press F8, to run single step, then in variable windows, right click and select 'Add variable...'
If you want to add all variables then highlight top one, hold shift key, then left click on lowest variable, then click 'use variable'
You could either run simulation by holding down F8, or you can go to View, project options and change simulation speed from 'As fat as possible' to 1000. If left on 'As fast as possible' variables will not be displayed in variables window.
You could just read adc value, convert to a delay period. then a continuous loop of: led on, read ADC Calculate delay led on,delay, led off, delay
Also included a couple of very basic programs to get you started.
First one (LED Delay1) using reading 8 bit ADC
Second one (LED Delay2) using 10bit ADC and delay variable from 0 to 1023 ms . You don't have to stick with max 1023 ms Delay, using a formula you can go up to something like 32767 ms. Or Change delay form ms to Seconds.
Hope it helps.
http://www.matrixmultimedia.com/mmforum ... 12&p=14003
It was created when V4 was new to me, so its not the most advanced in the word, but it works well to alter led brightness, hence flash rate.
Also to learn more about flowcode 4 you can find a link to V4 examples here:
http://www.matrixmultimedia.com/Flowcode3a-X.php
Scroll down to flowcode extras, then you will see 'Flowcode V4 Examples'
What I do to learn is just load a flowcode example, then press F8, to run single step, then in variable windows, right click and select 'Add variable...'
If you want to add all variables then highlight top one, hold shift key, then left click on lowest variable, then click 'use variable'
You could either run simulation by holding down F8, or you can go to View, project options and change simulation speed from 'As fat as possible' to 1000. If left on 'As fast as possible' variables will not be displayed in variables window.
You could just read adc value, convert to a delay period. then a continuous loop of: led on, read ADC Calculate delay led on,delay, led off, delay
Also included a couple of very basic programs to get you started.
First one (LED Delay1) using reading 8 bit ADC
Second one (LED Delay2) using 10bit ADC and delay variable from 0 to 1023 ms . You don't have to stick with max 1023 ms Delay, using a formula you can go up to something like 32767 ms. Or Change delay form ms to Seconds.
Hope it helps.
- Attachments
-
- LED Delay2.fcf
- (6.5 KiB) Downloaded 424 times
-
- LED Delay1.fcf
- (6 KiB) Downloaded 402 times
Martin
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: ADC help!
Your welcome.
Since there is quiet a bit to digest, If I were you I would just save and run the two attached files, and just see how they work. There probably won’t be a need to read the rest.
Since there is quiet a bit to digest, If I were you I would just save and run the two attached files, and just see how they work. There probably won’t be a need to read the rest.
Martin
Re: ADC help!
I downloaded the first file and V4 says its an unexpected format? are V3 files not compatable with V4?
Seems a bit odd?
Seems a bit odd?
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: ADC help!
Yes that’s odd!
Files were created with V4. Just downloaded file and opened it. Opens fine with my V4.
Files were created with V4. Just downloaded file and opened it. Opens fine with my V4.
Martin
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: ADC help!
Within flowcode, go to help, and check for updates. Are you using latest .. V4.2?
Martin
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: ADC help!
Glad you have got V4 working now
Sorry mate, I slightly misread .
You wanted to flash two LEDS like flip flop style.
Here you go. You will like this one much better.
Connect pot to RA1.
LED1 to B0 and LED2 to B1
f you want specific times in which they change rate e.g. from 100ms to 1 second, then let me know and I will work out correct formula for you.
This was tested on 16F872. You will need to change target, configuration and perhaps port settings to suit.
Sorry mate, I slightly misread .
You wanted to flash two LEDS like flip flop style.
Here you go. You will like this one much better.
Connect pot to RA1.
LED1 to B0 and LED2 to B1
f you want specific times in which they change rate e.g. from 100ms to 1 second, then let me know and I will work out correct formula for you.
This was tested on 16F872. You will need to change target, configuration and perhaps port settings to suit.
- Attachments
-
- LED Flip Flop1.fcf
- (8 KiB) Downloaded 645 times
Martin
Re: ADC help!
Thats exactly what I wanted mate, top stuff
I have a play around with that now and try and understand how various parts work.
Thanks again fella
Gaz
I have a play around with that now and try and understand how various parts work.
Thanks again fella
Gaz