Page 1 of 1

Flowcode 6 - Need Help

Posted: Thu Apr 28, 2016 8:18 pm
by Th0ma$
hello all, so the following programs were done in Flowcode so I want you to help me has explained. Finally say, has what is this line etc ...
Thank you for your help

Here is the program hand (variable = b)
http://www.noelshack.com/2016-17-146186 ... e-main.png

Here under the program of the one above:
http://www.noelshack.com/2016-17-1461861566-dmx.png

Voila, Please explain me please (briefly even if you have no time)

Re: Flowcode 6 - Need Help

Posted: Fri Apr 29, 2016 9:38 am
by kersing
Check this message, specifically the part about tutorial videos.

Re: Flowcode 6 - Need Help

Posted: Sat May 14, 2016 11:52 am
by JUZAR
Hi All.

Can any one help me in writing a flow code for below.

1) I am using PIC 16F1824 device.
2) I want to generate a delay of 20 seconds using TIMER of PIC.
3) A input pin is used to start the timer. Once input pin goes HIGH the 20 seconds delay timer is initialized and on completion of 20 seconds a LED is to be turned ON.

Requested to kindly advice which TIMER/s is to be used in above mentioned PIC and how to initialize the timer and read the lapsed timer count to check completion of 20 seconds to turn ON the LED

Regards

Juzar.

Re: Flowcode 6 - Need Help

Posted: Sat May 14, 2016 3:58 pm
by medelec35
Hi JUZAR,
All the setting to do what you require is dependent on your hardware.
E.g. Type and frequency of oscillator.
Can you post a flowchart that has osc and configuration setting correct, then I can help you further.

Martin

Re: Flowcode 6 - Need Help

Posted: Mon May 16, 2016 7:26 am
by JUZAR
Hi Martin.

Kindly see attached flowcode which is not complete because I don't know how to initialize timer. The logic is as under.

1) C code initialized to set up oscillator frequency.
2) Potentiometer is used as component macro.
3) Flow code checks whether potentiometer values is > 0X88. If it is greater than 0X88 it will call a macro to initialize the TIMER1 to start the 20 seconds timer. I have used a toggle function so that timer not initialized repeatedly if value is >0X88 and further timer is not reset again and again.
4) If value is < 0X88, than timer1 will be disabled and toggled to 0. Or if in the middle of count, say 10 seconds are finished and potentiometer value goes <0x88 than controller will reset the timer count to 0.
5) Once 20 seconds are finished the LED will turn ON to indicate that 20 seconds are over.
6) Now I don't know how to read timer status using flowcode to check whether 20 seconds is completed or not. So kindly help me how to access the timer and read the status.

Exact requirement is to read the potentiometer status if it is >0x88 the timer will start and once 20 seconds are finished than interrupt is generated to call the main routine so that LED can be turned ON.

Awaiting your reply at the earliest.

Regards.

Juzar.

Re: Flowcode 6 - Need Help

Posted: Mon May 16, 2016 8:00 am
by medelec35
Hi Juzar,
Just one bit of confusion.
You have an osccon command which suggests your using internal oscillator.
However, the clock is set to 19660800Hz which suggests you are using external osc e.g crystal.
Configuration settings are set to an external clock rather than an internal or external oscillator.
Reason I asked you to explain about osc type and frequency is because it will have an effect on the timings.
Are you using internal oscillator,external crystal or resonator?
What is the clock frequency?

Martin

Re: Flowcode 6 - Need Help

Posted: Mon May 16, 2016 10:01 am
by JUZAR
Hi Martin.

Sorry, I missed to set the project options. Its now done in below attachment. I have used internal oscillator with clock speed of 16 MHz. While rest should be now OK.

Regards.

Juzar.

Re: Flowcode 6 - Need Help

Posted: Mon May 16, 2016 3:04 pm
by medelec35
Hi Juzar,
Can you try the attached flowchart.
I have disabled watchdog timer, love voltage programming, PLL etc.
MCLR is still enabled as I don't know if pulling MCLR line up or not?


Martin

Edit. Attachment removed and added in a different post.

Re: Flowcode 6 - Need Help

Posted: Tue May 17, 2016 4:02 am
by JUZAR
Thanks Martin,

Will give you feedback soon

Regards.

Juzar

Re: Flowcode 6 - Need Help

Posted: Tue May 17, 2016 5:44 am
by JUZAR
Hi Martin.

Tested the flowcode on simulation and its working, also worked perfectly for all possible logic conditions.

I have one question on flowcode program and hardware of PIC, because I am new to this microcontroller programming I need your advise to clear this doubts, I would like to know whether the macro is repeatedly called by main routing on each over flow of timer or macro routine completes the 20 seconds and than returns to main routing for further processing. If main routing is intervened repeatedly by timer overflow than it there any way that main routine is called one 20 seconds are finished.

Awaiting your advise at the earliest.

Regards.

Juzar.

Re: Flowcode 6 - Need Help

Posted: Tue May 17, 2016 8:34 am
by medelec35
Hi Juzar,
Sorry I posted wrong flowchart, attached is correct one.
How it works is as follows:
Timer0 is using a 8bit timer.
It has a register called tmr0.
Since interrupt is set at 61.035Hz (make a mental note of 61) then every

Code: Select all

1/61.035/256 = 64uS 
tmr0 is incremented by 1.
When register reaches 255, on the next increment it rolls-over to 0.
Its at that point the timer0 interrupt macro (sec20delay) is accessed.
Since only

Code: Select all

64us * 256 = 0.016384 secs
has elapsed we need to count each time interrupt macro has been accessed since interrupt has now been triggered.
For that we use a Count variable.
When macro has been accessed 61 times we know a fraction under a second has elapsed.
Therefore Seconds variable is incremented.
That is how timing is done.
The sec20delay is not called repeatedly by main, its automatically called by the timer0 interrupt when internal tmr0 register rolls over from 255 back to 0.
Timer interrupt macro is also known as Interrupt service Routine or ISR which has to be serviced and allowed to exit.

Martin

Re: Flowcode 6 - Need Help

Posted: Tue May 17, 2016 10:02 am
by JUZAR
Hi Martin.

Thanks very much for detailed information. I could now understand how this ISR is working. In case if any more information is required I shall contact you.

Good day.

Regards.

Juzar.

Re: Flowcode 6 - Need Help

Posted: Tue May 17, 2016 10:42 am
by JUZAR
Hi Martin.

Though the flowchart is working properly, but its giving error message as per attached file. Kindly help how to resolve this issue.

Regards.

Juzar.

Re: Flowcode 6 - Need Help

Posted: Tue May 17, 2016 12:24 pm
by Benj
Hello Juzar,

The error is basically telling you that the variable toggle is read before it has been assigned a value.

Either give the variable an initial value via the variable manager or use a calculation icon to set the variable's value before you read the variable.

The simulation will always assume the value 0 for an uninitialised variable but the actual micro controller hardware will have a random value, hence the error/warning.

Re: Flowcode 6 - Need Help

Posted: Tue May 17, 2016 12:55 pm
by JUZAR
Thanks Benj.

After assigning initial value, its not giving any error. Flowcode6 is now becoming more and more interesting because of valuable advise from all experts.

Thanks again.

Regards.

Juzar.

Re: Flowcode 6 - Need Help

Posted: Tue May 17, 2016 6:30 pm
by medelec35
Hi Juzar,
I only preassigned new variables I added and did not check variables you added.
Sorry about that.

Glad you are nor more familiar with interrupts though.
Martin

Re: Flowcode 6 - Need Help

Posted: Fri May 20, 2016 1:56 pm
by JUZAR
Hi Experts,

Though with your help I have gained some knowledge on interrupt and timers, but I am again stuck up in writing a flowcode. Can any of the expert help me to make a flowchart for below.

1) There is a variable input frequency from 45 Hz to 50 Hz.
2) I want to turn ON an LED when frequency reaches 47 Hz.
3) PIC16F1824 running at 16 MHz clock frequency is to be used to detect 47 Hz
4) Kindly guide me how can we detect 47 Hz using interrupt / timer to measure 21.276 milli seconds ( 47 Hz ) and turn on LED.
5) If possible the software should run independently in background without intervening main routing and generate an interrupt when 21.276 milli seconds is measured to tick main routine to turn ON LED.

Awaiting your reply at the earliest.

Regards.

Juzar.

Re: Flowcode 6 - Need Help

Posted: Fri May 20, 2016 2:13 pm
by kersing
Juzar,

We don't mind helping, however it would be nice if you at least attempt to solve this yourself. Search the forum to check if there is anything that might help and create a flowchart that attempts to solve the problem. Or describe how you would like solve the problem and explain what issues you are facing when creating the flowchart.

Best regards,

Jac

Re: Flowcode 6 - Need Help

Posted: Fri May 20, 2016 5:09 pm
by JUZAR
Hi Jac

Ok, I will first try and apply efforts to solve it. By this way it will be possible learn many things and understand various experiences of forum members.

Regards

Juzar

Re: Flowcode 6 - Need Help

Posted: Wed Nov 04, 2020 12:55 pm
by JUZAR
Hi
I need an advise on lookup table.

I want to read an analog signal through A/D and get 8 bit equivalent, since the input is non linear, I wanted to make a LUT and compare the incoming analog signal with LUT and use that compared LUT data to display a seven segment LED display. Since I have never used this feature, need help how to use it. Couldn't find detailed information of LUT on net, it will helpful with an example on how its implemented in V6. This will help in better understanding.

Regards.

Re: Flowcode 6 - Need Help

Posted: Sat Jun 19, 2021 6:58 am
by JUZAR
Hi,

I need help in configuring internal frequency of PIC12F1822 using Flowcode6. I want to know what should be written in C code icon to configure internal frequency to 8 MHz.

Awaiting your reply at the earliest.

Thanks

Juzar

Re: Flowcode 6 - Need Help

Posted: Sat Jun 19, 2021 8:01 am
by AbhijitR
Hello! Juzar

May be you should try to insert as below in the "C" block in lowercase, as the first block in MAIN loop, V8 has got a very nice function (IntOscHelper1).

osccon=0x70;

Abhi

Re: Flowcode 6 - Need Help

Posted: Sat Jun 19, 2021 1:25 pm
by JUZAR
Thanks Abhi,

I shall implement and check it

Regards.

Juzar