Page 1 of 1

EEPROM Question

Posted: Wed Jul 04, 2012 11:35 pm
by George_B
Hi, that's my first post here so excuse me for any mistake and for my poor English as well.

I am working on a project using a MCU PIC 16f628A to control two dosing pumps.

Using the Flowcode 4 software i have programmed the PIC micro controller.

The problem i am facing is regarding the EEPROM as i mentioned on the title of the topic.

I write a variable to the EEPROM , then i turn the power off and then again on but the variable i get in the same adress is not the same with the saved variable. I guess that the EEPROM doesn't save the variable properly and that is the reason that i ask your help.

Is there anything that i should do to face that issue ?

Thanks in advance !
George

Re: EEPROM Question

Posted: Thu Jul 05, 2012 12:01 am
by petesmart
Hi George,

I seem to recall have an issue with location zero on the EEprom... try using another location..... location one or two for example

see how you go

all the best

Pete

Re: EEPROM Question

Posted: Thu Jul 05, 2012 12:26 am
by George_B
Hi Pete, you gave me an answer that i am looking for three days now.

Thank you very much for your answer!!!!!

PROBLEM SOLVED: ADDRESS 0 of EEPROM is not recommended for use.

Regards
George

Re: EEPROM Question

Posted: Thu Jul 05, 2012 2:16 pm
by Enamul
Hi,
I seem to recall have an issue with location zero on the EEprom... try using another location.....
Are you saying that in some PIC we might have problem in using 0th address of EEPROM? Because in my one project I have used 16f876 I have seen this kind of problem not with all PIC but with some PIC (may be hardware problem I thought)..

I was using 0th location as an indicator for writing some data in EEPROM but if we turn off-on power and try to read the location which we have already written...we don't get that bcz it seems to me now 0 th address goes wrong which tells PIC nothing written.

Is that a PIC IC issue or FC issue?

Enamul

Re: EEPROM Question

Posted: Thu Jul 05, 2012 2:24 pm
by petesmart
Hi,

I believe its a pic issue... Benj from MM put me onto it some time ago, and i did follow up on the Microchip website, which confirmed it.

It does not impact all PIC variants, just a few I believe...as a rule now I dont use location zero, just in case.

all the best

Pete

Re: EEPROM Question

Posted: Thu Jul 05, 2012 2:36 pm
by Enamul
Hi Pete,

Thanks for the info :)

Enamul

Re: EEPROM Question

Posted: Thu Jul 05, 2012 2:49 pm
by petesmart
No problem, glad i could help.

this link maybe useful... follow the thread down to the middle of the posts.... BenJ provides some explaination

http://www.matrixmultimedia.com/mmforum ... n+0#p30258

cheers

Pete

Re: EEPROM Question

Posted: Thu Jul 05, 2012 3:42 pm
by Enamul
Hi,

I wish I would have noticed this in the early Jan '12. We had a tough time with 100 s of 16f876 ICs...Work fine couple times..then don't work..re-write works few times..then same problem...

Few ICs don't work at all..

Thanks goes to you and Ben the Boss :)

Enamul

Re: EEPROM Question

Posted: Fri Aug 31, 2012 9:45 am
by George_B
Hi, another issue that i have is about the stepper motor speed in flowcode.

How is it possible to program to have variable speeds during the motor's operation ?

Re: EEPROM Question

Posted: Fri Aug 31, 2012 10:04 am
by Benj
Hi George,

You vary the stepper motor speed by varying the time period between calling the step functions.

Using a delay you can simply edit the length of the delay.

Using a timer interrupt you can vary the timer period register.

Re: EEPROM Question

Posted: Fri Aug 31, 2012 10:26 am
by George_B
Thanks very much for your reply!

To be honest i didn't get the way that i have to develop the flowchart to achieve that you just explained. Is there any example of this kind of program in flowcode?

Basically, i am trying to control a stepper motor driver (using pulse and direction signals). I can control the motor properly but i don't know how to adjust the speed of the pulses in order to have the motor running faster.

Re: EEPROM Question

Posted: Fri Aug 31, 2012 10:49 am
by Benj
Hello,

Here is quick demo using delays.
3. Stepper Speed Control.fcf
(6 KiB) Downloaded 397 times

Re: EEPROM Question

Posted: Fri Aug 31, 2012 4:28 pm
by George_B
Hi Ben and thanks again!

I did something similar to your design.. the only "problem" is that the pulses are not very fast as i want to be and therefore the speed of the motor is still low..

In your example above, what is the frequency of the pulses if we suppose that the ADC is 0 ?

Re: EEPROM Question

Posted: Fri Aug 31, 2012 4:41 pm
by Benj
Hello,

In my example I added a delay of 50 to the ADC sample so the maximum speed would be 1/50ms or 20hz.

You could change this delay to say 1 to give you a max speed of 1000hz or even change the delay to us instead of ms which would give you much higher frequency ranges.

Re: EEPROM Question

Posted: Fri Aug 31, 2012 4:49 pm
by George_B
Thank you very much i appreciate your help !

Re: EEPROM Question

Posted: Mon Sep 10, 2012 7:14 pm
by George_B
Hi again!! I managed to run and control the stepper motor properly after i tried several examples of coding..

Another think that i want to ask, is it possible to interface the DS1307 to PIC 16F877A using Flowcode? Do i have to use any component from Comms Menu in flowcode?

I am trying to make a digital clock ( actually i did it ) but i want to restore the data (hour,minutes,day) after the power goes off.
Regards
George

Re: EEPROM Question

Posted: Tue Sep 11, 2012 9:32 am
by Benj
Hello George,

The DS1307 device needs a I2C interface connection so you should be able to use the I2C component in Flowcode to communicate with the device.

Here is an article on the device.
http://www.matrixmultimedia.com/mmforum ... 307#p35668

Re: EEPROM Question

Posted: Tue Sep 11, 2012 9:54 am
by Enamul
Hi,
Here is a clock program using ECIO-40 but you can change that to any PIC with enough memory. To have clock running in the absence of power, you need to connect a 3.3V battery in Vbat pin of DS1307 IC. In the example program, you need to put time and date in the FIRST_TIME macro which keep record in EEPROM and next time when powers up..you don't need to think about time it will keep maintain real time.

Edit: For ECIO-40P
RB0/SDA
RB1/SCK

Hope this will help :)

Re: EEPROM Question

Posted: Mon Jul 22, 2013 10:47 pm
by George_B
Hi all!

I am facing an issue regarding a Timer program that i am currently working on.

I am using an interrupt (TMR0) in order to count seconds and so on..

The problem with my timer is that it is not quite accurate as it should be. The timer runs faster that the internet clock.

Is there anything that i have to look at in order to solve this problem?

Attachment = (F low C ode V ersion 5)
Clock_Using_Interrupt.fcf
(10.5 KiB) Downloaded 266 times
Thanks in advance
George

Re: EEPROM Question

Posted: Sat Aug 10, 2013 6:52 pm
by George_B
Any idea please?

Re: EEPROM Question

Posted: Sat Aug 10, 2013 8:45 pm
by dazz
Hi george
First off can you follow the link in my sig to enable access to the v5 forums as it make it easier to find questions if they are in the correct forums

If you do a forum search for timer theres a spread sheet somewhere that martin posted, which will help you get the correct times, also add an led and make a 1 second flasher as once thats right you know your clock settings are on the correct track

Regards
Dazz