CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

pic 16f876

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Master



Joined: 27 Aug 2010
Posts: 8

View user's profile Send private message

pic 16f876
PostPosted: Fri Aug 27, 2010 4:23 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Aug 27, 2010 4:10 pm     Reply with quote

Up !
Master



Joined: 27 Aug 2010
Posts: 8

View user's profile Send private message

PostPosted: Mon Aug 30, 2010 6:42 am     Reply with quote

Somebody Please ? Crying or Very sad
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Aug 30, 2010 7:04 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Sep 01, 2010 10:12 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Sep 02, 2010 4:33 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Sep 02, 2010 7:53 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Sep 02, 2010 9:47 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Sep 02, 2010 4:16 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Sep 02, 2010 9:15 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Sep 03, 2010 4:03 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Sep 03, 2010 8:08 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Sep 04, 2010 8:14 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Sep 05, 2010 8:31 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group