FlowCode run on simulation but cannot run on chip program

A collection of posts and articles on getting started in Flowcode v6

Moderator: Benj

Post Reply
skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

FlowCode run on simulation but cannot run on chip program

Post by skquah »

Hi, Martin and Qmesar ... " A Happy New Year to you ... 2015 "
1) I am back on this forum again after I am able to download the hex code into the chip of 16F628A using
the PicKit-2 v2.61and the Cytron usb programmer. Thanks for your past guidance and help.
2) Now, I face another problem which I cannot get the 16F628A chip program running in my project circuitry ,
after loading the hex code successfully into the chip . The flow code runs well during simulation in the v6.
3) My project circuitry is not using the external oscillator connection , so I am using the internal oscillator .
Is it ok to use internal oscillator ? Is there any other Build configuration setting required for internal oscillator ?
4) I have tried to change the BUILD configuration setting to (i) INTOSC CLKOUT and (ii) INTOSC I/O , and compiled
to chip again but the program did not work also . I do not know what to do next ? I need help .
My 30 days trial period will be expired in another 7 days . I need help to solve this issue before I could
decide to buy the v6 license software .
5) I am attaching my flowcode file for your verification .
6) My flowcode file is a complete project on the AirCon and fan control using PIR . If you need me to
try out a basic / simple test program on 16F628A with LEDS , pls recommend me a prototype build circuitry ,
with flowcode and hex file so that I could quickly built one and download the hex to the chip .
7) Thanks in advanced .... skquah.
Attachments
3) PIR AirCon Rev 3.fcfx
(57.46 KiB) Downloaded 456 times

medelec35
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: FlowCode run on simulation but cannot run on chip progra

Post by medelec35 »

Hi skquah,
skquah wrote:A Happy New Year to you ... 2015
Thank you.
Happy new year to you & every one else who reads this post :)

I have altered your configuration settings as the default settings will certainly won't allow hardware to run.
I have covered some configuration settings in this post (currently link within my signature).
Also the clock speed has be channged to math the internal osc frequency of 4MHz

Martin
Attachments
3%29 PIR AirCon Rev 3a.fcfx
(58.05 KiB) Downloaded 433 times
Martin

skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Re: FlowCode run on simulation but cannot run on chip progra

Post by skquah »

Hi, Martin
1) Thanks so much for your help to rectify this problem by setting the configure word to 0x3f58.
It has solved the problem of cannot run on chip 16F628A issue after connecting to hardware circuitry .
As to a begin get started student to understand and apply v6 flow code , it really means a great lesson
for me as it has never in the flow code tutorial learning . I hope this will help those who want to get
started on v6 flow code .... A big thank you again .
2) I have another problem while testing this project is that :- In simulation I could run the interrupt on
RB0 (pin 6) to stop or interrupt the timer , then reset it . But in this chip circuitry connection ,
it cannot function . I do not know whether my INTERRUPT setting is correct or not . My setting is
set at " INT0 pin " . I need help on this problem .
3) I am attaching this updated flow code file for your attention , if you could help ....... skquah
Attachments
3) PIR AirCon Rev 3.fcfx
(58.69 KiB) Downloaded 410 times

User avatar
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: FlowCode run on simulation but cannot run on chip progra

Post by Benj »

Hello,

How do you have the INT pin wired up?

This Wiki page shows some arrangements that work well.

http://www.matrixtsl.com/wiki/index.php ... 2979cfc92e

If you don't have the pull up or pull down resistor (marked 10K on the images linked above) then the input will "float" and not work properly.

skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Re: FlowCode run on simulation but cannot run on chip progra

Post by skquah »

Hi, Benj ..... ( Nice to meet you )
In the Wiki page connection , there are 2 resistors R1(1K) and R2 (10K).
I did not used R1 (1K) but maintain R2 of value 2.2K with the push on switch , which also gives a
active high of approx. +5v once switch was pressed . Can this be a problem to RB0 ? .... skquah

medelec35
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: FlowCode run on simulation but cannot run on chip progra

Post by medelec35 »

Hi skquah,
Glad hardware is now working except for your interrupt.
The issue could be when you have a macro call e.g

Code: Select all

six_hrs
then interrupt is placed within six_hrs macro to call six_hrs macro when RB0 goes from low to high.

I don't think its a good idea to do that.

If it was me I would place just one INT interrupt at the start of main.
Use a timer interrupt for the timing.
Two variables can be assigned for seconds & hours that will count down.
When seconds and hours = 0 time up routine is called.If while counting down INT is enabled, the the INT macro can just set Hours = 0 & Seconds to 0
So the time up macro or routine is started.

That would make your flowchart much smaller and more efficient as it eliminates all the macro with _hrs inc, seconds delay and loops.

Hope this makes sense?

Martin
Martin

skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Re: FlowCode run on simulation but cannot run on chip progra

Post by skquah »

Hi, Martin
Thanks for your time to look thru my flow code on interrupt cannot function after chip connection .
I understand what you have point out on this interrupt assign after the macro call is not a good
idea in this timer flow code implementation .
I certainly agreed to what you have advise me , but one thing I have to admit to you and myself
is that I am a new novice trying to learn flow code and make implementation to a project .
Last 2 weeks ago , I have tried to look for V6 flow code examples on interrupt and timer 0 in Matrix
learning page . I could not get much info. from the v6 tutorial but I could manage to get it from V4
tutorial and then I make some try out on timer 0 in running from second , minutes to hours .
I have succeeded in simulation but when I want to implement it into the main interrupt to run the
whole simulation , I could not get it working . That's why I have to try some other program to make
it work . I am not sure you could help me and provide some sample code to your said main interrupt
and timer 0 in hours and minutes .... I am sorry to made this humble request , if you could help .
Many thanks ...... skquah .

medelec35
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: FlowCode run on simulation but cannot run on chip progra

Post by medelec35 »

Hi skquah,
I will put something together for you to have a play with.

Martin
Martin

medelec35
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: FlowCode run on simulation but cannot run on chip progra

Post by medelec35 »

Hi Hi skquah,
Have a play and see what you think.
If you're stuck on how something works, then let me know.
Attachments
PIR AirCon Rev 4.fcfx
(45.76 KiB) Downloaded 393 times
Martin

skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Re: FlowCode run on simulation but cannot run on chip progra

Post by skquah »

Hi, Martin
Thank you very much for your time to develop this sample interrupt and timer 0 flow code for my
application . I have run the simulation then compiled it into the 16F628A chip .
I ran the chip together with the hardware circuitry and the result show that the interrupt switch
connected to RB0, pin 6 is able to function as a interrupt on this program . So I could said from the
way you wrote the interrupt at the main program , it is working .
But the actual program and timer function , I have not fully test it yet . This I will play with it later
and get it to suit my program .
My 30 days trial period will be expired in next 2 days . So I will have to buy the V6 flow code license
probably in next 1 or 2 weeks time before I could continue to finished this project . I will update and
get in touch with you using this forum once I have bought the license .
Anyway , thank you to you again , Martin and also Benj for your time and your forum .
Bye ..... skquah

skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Re: FlowCode run on simulation but cannot run on chip progra

Post by skquah »

Hi, Martin
1) I manage to run thru' your flow code interrupt program and timer selection function test
of 2.0 to 6.0 hours thoroughly . During flow code simulation run , all function is ok , but when run
at actual circuit hardware test ( with chip 16F628A ) and selector timer switch selected from 2.0 hrs ,
3.0 hrs and so on , the timer can be 'on' ( led light up at the aircon output port RA1, pin 18 ) but it cannot
be cut off after timer end. This timer can 'on' and cannot cut-off when timer end happened to 2.0 to
6.0 hrs when tested .
2) Also , the 2.0 hrs flow code calculation setting at 2*60*60 for 2.0 hrs timer is actually 4.0 minutes when time
by stop watch . How to make it into actual 2.0 hrs in the calculation icon ?
3) Sorry to trouble you again ....... skquah.

medelec35
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: FlowCode run on simulation but cannot run on chip progra

Post by medelec35 »

Hi skquah,
I can set up hardware to test as well.
Before I do, can you post a full circuit diagram of your hardware please (every single component that's used, must be included).
Initial tests on a third party simulator that runs in real time or can be sped up or slowed down was set at 4MHz Real speed 64MHz simulation.
After A4= high, B3 = high then B1= high
A1 stayed high for 450 seconds which is correct 7200/ (64E6/4E6 ) = 450
Then A1 went low and A0 stayed high until B2 was changed from Low to high.
So external simulator shows 2 hours as correct timing when selected.

Martin
Martin

skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Re: FlowCode run on simulation but cannot run on chip progra

Post by skquah »

Hi, Martin
1) I could not upload the schematic file for your verification because it has the extention . 123 error
which is not allowed in this posting . Pls advise how to send the file .
2) The software used is Sunstone PCB123 , v5 . This is a free England software download
from the website .
3) The MCLR or RA5 , pin 4 is pull up high to +5V .
4) Thanks, If you do the hardware test .

medelec35
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: FlowCode run on simulation but cannot run on chip progra

Post by medelec35 »

skquah wrote:1) I could not upload the schematic file for your verification because it has the extention . 123 error
Have you tired compressing to a zip file?

Or
You could take a screen shot and post as jpeg?
Or
Maybe the schematic will allow export to pdf or graphics file
Or
You could install CutePDF writer which is freeware.
It acts as printer so when you select it as a printer, instead of printing on paper, it just creates a pdf file.

I will do a hardware test only when seen your full circuit diagram.

Martin
Martin

skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Re: FlowCode run on simulation but cannot run on chip progra

Post by skquah »

Hello, Martin
1) It is already 1 year over before I am back again in this posting.. Sorry for that because I am working on some other things..
2) Actually today I just want to say thank you to you for on your experiment flow-code program that you have wrote for my
exercise testing.. I learnt a lot from there to start-off with flow-code and I am able to understand and make alteration
to your FC program..
3) I have done this exercise and able to complete this project and with a product called " PIR AirConFan Timer "..
4) To complement this learning, I would like to attached the (i) Revise flow-code file and (ii) Product image ..
5) So, this is to closed this learning topic.. skquah2007@yahoo.com
Attachments
Pir AirConFan Timer.fcfx
Revise flow code file
(35.78 KiB) Downloaded 234 times

skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Re: FlowCode run on simulation but cannot run on chip progra

Post by skquah »

Hi, Here is the product image photo "PIR AirConFan Timer "
Attachments
Pir AirConFan Timer (side view).PNG
Image photo
(514.54 KiB) Downloaded 8469 times

Post Reply