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 support@ccsinfo.com

m25p80 driver

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







m25p80 driver
PostPosted: Fri Feb 16, 2007 3:35 pm     Reply with quote

Is there anyone has a driver of m25p80 chip? I need one to catch up schedule. Please help.

Thanks,
Tom
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 16, 2007 4:10 pm     Reply with quote

Do a web search using Goggle. Put in the name of the chip, and
then put in some line that is unique to CCS code. Example:

M25P80 "#use delay"

I ran a Google search on that and got two hits. The 2nd hit is a large
PDF file with nicely formatted code. It's for a M25P16 which has 2x
the amount of memory as the M25P80, but it's a similar chip.
Tom_On_PIC
Guest







M25p80 driver
PostPosted: Tue Feb 20, 2007 1:13 pm     Reply with quote

Hi PC programmer,

Thanks for help. I did find two drivers as you mentioned. with minor changes, the driver is not working. I have put together a testing code. It saves 231 into address 100, but reading from same address is always 0:

[
Code:

#include <18F452.h>
#device *=16 ADC=10
#include <string.h>
#fuses   HS,NOPROTECT,NOOSCSEN,BROWNOUT,PUT,NOWDT,CCP2C1,STVREN,\
         NODEBUG,LVP,NOWRT,NOWRTD,NOWRTB,NOWRTC,NOCPD,NOCPB,NOEBTR,NOEBTRB
#nolist

#use delay(clock=12352000)
#use rs232(baud=19200, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

//m25p20 chip
void init_flush()
{
   BYTE theInt;
   output_high(MEM_CLK); // Start CLK high
   output_high(MEM_CS); // Start CS high
   // setup SPI with master and rising edge transmit
   setup_spi(SPI_MASTER | SPI_CLK_DIV_16 | SPI_L_TO_H | SPI_XMIT_L_TO_H );
   
   delay_ms(500);
   write_byte(100, 231);
   theInt = read_Byte(100);
   
   printf("read frm addr 100(231):%x\r", theInt);
}

void main ( )
{
   init_flush();
   while (1);
}



PCM programmer wrote:
Do a web search using Goggle. Put in the name of the chip, and
then put in some line that is unique to CCS code. Example:

M25P80 "#use delay"

I ran a Google search on that and got two hits. The 2nd hit is a large
PDF file with nicely formatted code. It's for a M25P16 which has 2x
the amount of memory as the M25P80, but it's a similar chip.
ckielstra



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

View user's profile Send private message

PostPosted: Tue Feb 20, 2007 3:12 pm     Reply with quote

Please post a complete compilable test program. How are we to know what is in read_byte() and write_byte()? Especially since you say you have made some modifications to the original program.

Code:
#device *=16 ADC=10
The PIC18 processor is always using 16 bit pointers, the *=16 directive is doing nothing and can be left out.

You are setting the LVP fuse, do you really need this? Only home made programmers are using that programming method. For all other situations you want to set it to NOLVP as this fuse can cause erratic behaviour when no pull-up is connected.
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