MPLAB and Flowcode 2

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

User avatar
miguelmauricior
Flowcode V4 User
Posts: 42
Joined: Tue May 05, 2009 12:13 pm
Location: COLOMBIA
Contact:

MPLAB and Flowcode 2

Postby miguelmauricior » Wed Jun 10, 2009 6:27 pm

Hello Ben,

The program I am running right now is very similar in the behavior (FC simulation respect MPLAB compilation) the only thing which is very significant is the times delays because in FC a time of 20S represents a time of 8 seconds in real program after its compilation by MPLAB.
As you saw I used the internal clock which is not very stable but the error is -/+ 2 seconds which is right in this case.
Ben in the last message I asked you something about the FC V4 but you never told me anything. And I requested you for another option to develop a count routine different from I sent you in the program.

Let know any comment.

Thanks.
MMRZ

User avatar
Benj
Matrix Staff
Posts: 14471
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4536 times
Been thanked: 4204 times
Contact:

Re: MPLAB AND FLOW CODE 2

Postby Benj » Thu Jun 11, 2009 9:08 am

Hello

Your RC clock speed will probably be around 4MHz or below. If you adjust the clock speed setting in Flowcode then your delays will become more accurate to what they are intended.

+/- 2 seconds is a lot of fluctuation though I doubt this is due to the RC oscillator (unless it is really unstable) are you sure that there are no further delays or while loops etc that could be causing the unpredictable results.

User avatar
miguelmauricior
Flowcode V4 User
Posts: 42
Joined: Tue May 05, 2009 12:13 pm
Location: COLOMBIA
Contact:

Re: MPLAB AND FLOW CODE 2

Postby miguelmauricior » Thu Jun 11, 2009 3:03 pm

Hello Ben,

I made new adjustments in the program and the tolerance is now about less than a second or more which is good but in all these practices I have clear that the time simulated in FC differs with the time in MPLAB and the differences are like I told you before.
I asked you about the FCV4 before but still I have no reply about that topic yet. I was reading the FC4 data sheet sent it to my mail and I saw very significant improvements.
Can you tell me if there is an special offer for costumers who recently got the previous version like me?

A final question I have is how I must use the EEPROM option. I develop a routine which requires that once an out is activated the out MUST remains like that(ON) despite I remove the power from the chip.

Thanks
MMRZ

User avatar
miguelmauricior
Flowcode V4 User
Posts: 42
Joined: Tue May 05, 2009 12:13 pm
Location: COLOMBIA
Contact:

Re: MPLAB AND FLOW CODE 2

Postby miguelmauricior » Mon Jun 15, 2009 7:14 pm

miguelmauricior wrote:Hello Ben,

I made new adjustments in the program and the tolerance is now about less than a second or more which is good but in all these practices I have clear that the time simulated in FC differs with the time in MPLAB and the differences are like I told you before.
I asked you about the FCV4 before but still I have no reply about that topic yet. I was reading the FC4 data sheet sent it to my mail and I saw very significant improvements.
Can you tell me if there is an special offer for costumers who recently got the previous version like me?

A final question I have is how I must use the EEPROM option. I develop a routine which requires that once an out is activated the out MUST remains like that(ON) despite I remove the power from the chip.

Thanks
MMRZ

User avatar
Benj
Matrix Staff
Posts: 14471
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4536 times
Been thanked: 4204 times
Contact:

Re: MPLAB AND FLOW CODE 2

Postby Benj » Tue Jun 16, 2009 8:48 am

Hello

I have clear that the time simulated in FC differs with the time in MPLAB and the differences are like I told you before.


Are you saying that the Flowcode simulation runs at a different speed from when your running on the target chip. This is to be expected the Flowcode simulatio is by no means perfect. However it is a great tool to let you see potential downfalls in your program. When the Matrix ICD tool is released then this simulation functionality will be even better.

Can you tell me if there is an special offer for costumers who recently got the previous version like me?


There is a V3 to V4 upgrade available in the Flowcode section of our website, Alternativly you can contact sales<at>matrixmultimedia.co.uk

how I must use the EEPROM option


You use the EEPROM by reading and or writing bytes. Once a byte is written it will be retained even if the device is powered down.

I develop a routine which requires that once an out is activated the out MUST remains like that(ON) despite I remove the power from the chip.


Does this mean you need the output to be on even if power is removed? You will need a normal on relay or something to acheive this. If you just need the output to go high on power up if a certain prior condition has been met then simply read an EEPROM address at startup. If the data in the address is set the activate your output. Then later on in your program you will need to write values to the EEPROM address dependant on your required conditions.

User avatar
miguelmauricior
Flowcode V4 User
Posts: 42
Joined: Tue May 05, 2009 12:13 pm
Location: COLOMBIA
Contact:

Re: MPLAB AND FLOW CODE EEPROM DIRECTIONS

Postby miguelmauricior » Tue Jun 16, 2009 5:29 pm

Hello Ben,

Thanks for your reply. Let me tell you something more detailed about the code I am developing. One input of the micro is connected to a sensor. When this sensor is activated the input receives this signal and one output goes on. This output must remains on even if the power is removed (is a kind of fuse). Actually the program is working fine but I have no clear Idea where to put the ON data in the EEPROM to achieve it. The input is GP3 and output is GP2.
Can you give some directions to get it.

Thanks.
MMRZ

User avatar
Benj
Matrix Staff
Posts: 14471
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4536 times
Been thanked: 4204 times
Contact:

Re: MPLAB AND FLOW CODE 2

Postby Benj » Wed Jun 17, 2009 9:28 am

Hello

EEPROM memory is memory that retains its value during and after a power down. As opposed to RAM which looses its memory during a power down.

You simply cannot drive an output with the power removed from the microcontroller. Or am I getting the wrong end of the stick?

User avatar
miguelmauricior
Flowcode V4 User
Posts: 42
Joined: Tue May 05, 2009 12:13 pm
Location: COLOMBIA
Contact:

Re: MPLAB AND FLOW CODE 2

Postby miguelmauricior » Wed Jun 17, 2009 6:50 pm

Hello Ben,

I think I was not clear enough in my explanation. Once the output is ON (by the action of the software trough the micro) this ON action must be storage in the EEPROM then if I remove the power and I energize the micro again the output is still ON.The only way is using a combination of pulses that power off the OUTPUT again. We did this by assembler commands but we want to do this using FC .

I think now is more clear but let know if does not.

Thanks for your cooperation.
MMRZ

User avatar
Benj
Matrix Staff
Posts: 14471
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4536 times
Been thanked: 4204 times
Contact:

Re: MPLAB AND FLOW CODE 2

Postby Benj » Thu Jun 18, 2009 8:48 am

Hello

To do this you should be able to read an EEPROM address at the start of your program. If the EEPROM data at that address is say 1 then you know you have to turn on your output straight away. Then when you get to monitoring your input you can set the EEPROM data to 1 if the event occurs that requires you to switch on your output. If you do the EEPROM read in your main program loop then you will only have to set the EEPROM location to 1 when you detect the input condition and the EEPROM read part will take care of the output.

I've attached an example that should help.
Attachments
EEPROM.fcf
(5 KiB) Downloaded 173 times

User avatar
miguelmauricior
Flowcode V4 User
Posts: 42
Joined: Tue May 05, 2009 12:13 pm
Location: COLOMBIA
Contact:

Re: MPLAB AND FLOW CODE 2

Postby miguelmauricior » Fri Jun 19, 2009 2:04 pm

Hello Ben,

Have a nice day. Thanks for the sample code you sent me it was very useful, it really helps. I will do new tests and then I will let you know.
MMRZ

Bgraham
Posts: 14
Joined: Fri Dec 07, 2007 10:50 pm
Location: Springdale Arkansas USA
Contact:

Re: MPLAB AND FLOW CODE 3

Postby Bgraham » Wed Jan 04, 2012 9:06 pm

I have a programmer that is compatible with MPLAB, an Olimex PIC-MCP-USB. How do I make it work with flow code? I also have MPLAB on the computer I am using.

User avatar
Steve
Matrix Staff
Posts: 3084
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 89 times
Been thanked: 391 times
Contact:

Re: MPLAB and Flowcode 2

Postby Steve » Thu Jan 05, 2012 1:09 pm

If the board has a stand-alone utility for sending a HEX program to the board, then you can use the HEX file generated by Flowcode and send it using this tool. You may even be able to set this programmer within the "compiler options" of Flowcode so that Flowcode itself can reprogram the board.

If for whatever reason the programmer only works from within MPLAB, then it's more tricky. You will need to take either the generated C code or the ASM code and create a new project within MPLAB.