EEPROM Question

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

George_B
Posts: 88
Joined: Wed Jul 04, 2012 11:21 pm
Has thanked: 37 times
Been thanked: 12 times
Contact:

EEPROM Question

Postby George_B » Wed Jul 04, 2012 11:35 pm

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

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 190 times
Been thanked: 140 times
Contact:

Re: EEPROM Question

Postby petesmart » Thu Jul 05, 2012 12:01 am

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
These users thanked the author petesmart for the post:
George_B (Thu Jul 05, 2012 12:20 am)
Rating: 5.26%
 
sorry about that Chief!

George_B
Posts: 88
Joined: Wed Jul 04, 2012 11:21 pm
Has thanked: 37 times
Been thanked: 12 times
Contact:

Re: EEPROM Question

Postby George_B » Thu Jul 05, 2012 12:26 am

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

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: EEPROM Question

Postby Enamul » Thu Jul 05, 2012 2:16 pm

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
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 190 times
Been thanked: 140 times
Contact:

Re: EEPROM Question

Postby petesmart » Thu Jul 05, 2012 2:24 pm

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
These users thanked the author petesmart for the post:
Enamul (Thu Jul 05, 2012 2:35 pm)
Rating: 5.26%
 
sorry about that Chief!

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: EEPROM Question

Postby Enamul » Thu Jul 05, 2012 2:36 pm

Hi Pete,

Thanks for the info :)

Enamul
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 190 times
Been thanked: 140 times
Contact:

Re: EEPROM Question

Postby petesmart » Thu Jul 05, 2012 2:49 pm

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/mmforums/viewtopic.php?f=29&t=8671&p=30258&hilit=eeprom+location+0#p30258

cheers

Pete
These users thanked the author petesmart for the post:
Benj (Thu Jul 05, 2012 4:13 pm)
Rating: 5.26%
 
sorry about that Chief!

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: EEPROM Question

Postby Enamul » Thu Jul 05, 2012 3:42 pm

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
These users thanked the author Enamul for the post:
Benj (Thu Jul 05, 2012 4:13 pm)
Rating: 5.26%
 
Enamul
University of Nottingham
enamul4mm@gmail.com

George_B
Posts: 88
Joined: Wed Jul 04, 2012 11:21 pm
Has thanked: 37 times
Been thanked: 12 times
Contact:

Re: EEPROM Question

Postby George_B » Fri Aug 31, 2012 9:45 am

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 ?

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

Re: EEPROM Question

Postby Benj » Fri Aug 31, 2012 10:04 am

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.

George_B
Posts: 88
Joined: Wed Jul 04, 2012 11:21 pm
Has thanked: 37 times
Been thanked: 12 times
Contact:

Re: EEPROM Question

Postby George_B » Fri Aug 31, 2012 10:26 am

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.

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

Re: EEPROM Question

Postby Benj » Fri Aug 31, 2012 10:49 am

Hello,

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

George_B
Posts: 88
Joined: Wed Jul 04, 2012 11:21 pm
Has thanked: 37 times
Been thanked: 12 times
Contact:

Re: EEPROM Question

Postby George_B » Fri Aug 31, 2012 4:28 pm

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 ?

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

Re: EEPROM Question

Postby Benj » Fri Aug 31, 2012 4:41 pm

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.

George_B
Posts: 88
Joined: Wed Jul 04, 2012 11:21 pm
Has thanked: 37 times
Been thanked: 12 times
Contact:

Re: EEPROM Question

Postby George_B » Fri Aug 31, 2012 4:49 pm

Thank you very much i appreciate your help !

George_B
Posts: 88
Joined: Wed Jul 04, 2012 11:21 pm
Has thanked: 37 times
Been thanked: 12 times
Contact:

Re: EEPROM Question

Postby George_B » Mon Sep 10, 2012 7:14 pm

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

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

Re: EEPROM Question

Postby Benj » Tue Sep 11, 2012 9:32 am

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.
viewtopic.php?f=29&t=8607&p=35668&hilit=DS1307#p35668
These users thanked the author Benj for the post:
George_B (Tue Sep 11, 2012 12:27 pm)
Rating: 5.26%
 

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: EEPROM Question

Postby Enamul » Tue Sep 11, 2012 9:54 am

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 :)
Attachments
ECIO_CLOCK_v1.fcf
(42.91 KiB) Downloaded 183 times
These users thanked the author Enamul for the post:
George_B (Tue Sep 11, 2012 11:53 am)
Rating: 5.26%
 
Enamul
University of Nottingham
enamul4mm@gmail.com

George_B
Posts: 88
Joined: Wed Jul 04, 2012 11:21 pm
Has thanked: 37 times
Been thanked: 12 times
Contact:

Re: EEPROM Question

Postby George_B » Mon Jul 22, 2013 10:47 pm

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 154 times

Thanks in advance
George

George_B
Posts: 88
Joined: Wed Jul 04, 2012 11:21 pm
Has thanked: 37 times
Been thanked: 12 times
Contact:

Re: EEPROM Question

Postby George_B » Sat Aug 10, 2013 6:52 pm

Any idea please?

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 514 times
Been thanked: 467 times
Contact:

Re: EEPROM Question

Postby dazz » Sat Aug 10, 2013 8:45 pm

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
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php