View previous topic :: View next topic |
Author |
Message |
Master
Joined: 27 Aug 2010 Posts: 8
|
pic 16f876 |
Posted: Fri Aug 27, 2010 4:23 am |
|
|
Problem Resolved
Last edited by Master on Mon Sep 06, 2010 11:09 am; edited 2 times in total |
|
|
Master
Joined: 27 Aug 2010 Posts: 8
|
|
Posted: Fri Aug 27, 2010 4:10 pm |
|
|
Up ! |
|
|
Master
Joined: 27 Aug 2010 Posts: 8
|
|
Posted: Mon Aug 30, 2010 6:42 am |
|
|
Somebody Please ? |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon Aug 30, 2010 7:04 am |
|
|
Hi student, I don't want to do your work for you, but at a quick glance I see no errors. For the real answer you will have to test on your hardware.
Why did you add all the delay statements?
Your code will be easier to read if you move the function for copying to EEPROM outside of the mcr_read function. Now your mcr_read function is reading the MCR _and_ is copying to EEPROM. This causes your function to do more than the name suggests.
Code: | while ((tmpData = track2[i]) != 0) { | It is bad coding practice to have an assignment into an evalution statement. This makes your code more difficult to read and to debug. Best is to split it into two lines.
You start writing to address 1 in the EEPROM, not at address 0. Is this intentional?
You copy to the EEPROM without checking for the error on data reading. |
|
|
Master
Joined: 27 Aug 2010 Posts: 8
|
|
Posted: Wed Sep 01, 2010 10:12 am |
|
|
Problem Resolved
Last edited by Master on Mon Sep 06, 2010 11:07 am; edited 1 time in total |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Thu Sep 02, 2010 4:33 am |
|
|
Master wrote: | Code: | while ((tmpData = track2[i]) != 0) { |
What do you mean into two lines ? | You code is working, but it is better practice to write the code into two lines. For example: Code: | tmpData = track2[i];
while (tmpData != 0) { | This won't work, you have to make a few more changes, but you get the idea. |
|
|
Master
Joined: 27 Aug 2010 Posts: 8
|
|
Posted: Thu Sep 02, 2010 7:53 am |
|
|
Problem Resolved
Last edited by Master on Mon Sep 06, 2010 11:08 am; edited 1 time in total |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Thu Sep 02, 2010 9:47 am |
|
|
Quote: |
Also do you know a terminal for read data of Eeprom 24LC512 ?
|
The 24512.C is waiting for you in the Drivers Folder, you only need to write little code to call these functions. |
|
|
Master
Joined: 27 Aug 2010 Posts: 8
|
|
Posted: Thu Sep 02, 2010 4:16 pm |
|
|
Problem Resolved
Last edited by Master on Mon Sep 06, 2010 11:08 am; edited 1 time in total |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Thu Sep 02, 2010 9:15 pm |
|
|
Well, we do not know about the real hardware you have. To achieve what you want, you need to have at
minimum the MCU, the 24L512 and a RS232 transceiver properly wired and powered. Without this it would
be not easy to help you.
Assuming that you have the hardware, next step is to write a short code to R/W the EEPROM and with the
help of printf function + a PC -running a terminal application- you will be able to test and debug your project. |
|
|
Master
Joined: 27 Aug 2010 Posts: 8
|
|
Posted: Fri Sep 03, 2010 4:03 am |
|
|
Hello,
Thank for you reply.
My problem is i search this terminal application for computer.
About short code, maybe i'm in wrong but i must read the eeprom and use librairie RS232 to transfer ??
Thank you. |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Fri Sep 03, 2010 8:08 am |
|
|
In this forum there are a lot of info regarding how to manage a communication between a PIC and a PC.
As for terminal applications:
-TeraTerm
-PuTTY
-ProComm
-SIOW
-HiperTerminal
-CommShow
.....................
only to mention what I remember.
Regarding the required code, as starting code you already have the EX_EXTEE.C that is to manage a R/W
of external EEPROM and a PC. Be aware that the EEPROM used in the example is an old EEPROM 2416 with
8 bit wide address. The 24L512 needs 16 bit wide for the address field.
With the help of a PC and any terminal application you can send out (with printf) the relevant values that you
need to "watch" in order to debug your code.
Regards. |
|
|
Master
Joined: 27 Aug 2010 Posts: 8
|
|
Posted: Sat Sep 04, 2010 8:14 am |
|
|
Problem Resolved
Last edited by Master on Mon Sep 06, 2010 11:08 am; edited 1 time in total |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Sun Sep 05, 2010 8:31 am |
|
|
The 'C' languaje + MCU programming learning require a considerable time that can't be shortened and has
different learning levels according to its difficulties. We like to help begginers but also we expect they had
been overcome those levels and aquired the minimum hardware skills + 'C' languaje knowledge to try a
medium complexity project like this.
Regards |
|
|
|