problem with sd MMC_FAT16 library

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
salar1991
Posts: 3
Joined: 12 Jan 2022 13:28

problem with sd MMC_FAT16 library

#1 Post by salar1991 » 12 Jan 2022 14:00

hi, I want to write a string on a text file on sd card with PIC18F452 and I want to use a mikroc library named Mmc_FAT16. I did this before with stm32 and it wasn't much hard because of the various libraries but now I have to use PIC and I have a problem using this library. I wrote a code using the examples that mikroc provided but the compiler gives an error that says "360 Unresolved extern 'Mmc_Chip_Select_Direction' __Lib_Mmc.c". I added the Mmc and Mmc_FAT16 and Mmc_Fat16_Config libraries from the library manager window. what might be the problem. here is my code :

Code: Select all

#define Mmc_Chip_Select LATB |= (1<<0);
#define Mmc_Chip_Select_Direction TRISB &= ~(1<<0);

  void main() 
{

  // Initialize SPI1 module
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV64, _SPI_DATA_SAMPLE_MIDDLE,_SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);

// use fat16 quick format instead of init routine if a formatting is needed
if (!Mmc_Fat_Init()) {
// reinitialize SPI1 at higher speed
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV4, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);

}
Mmc_Fat_Assign("MIKRO007.TXT",0xA0);
Mmc_Fat_Append();
Mmc_Fat_Write("Hello world",255);


}

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: problem with sd MMC_FAT16 library

#2 Post by filip » 12 Jan 2022 15:01

Hi,

Can you please put this project in an archive and attach it here ?

Regards,
Filip.

salar1991
Posts: 3
Joined: 12 Jan 2022 13:28

Re: problem with sd MMC_FAT16 library

#3 Post by salar1991 » 13 Jan 2022 05:33

i attached the project
Attachments
sd_card.rar
(6.84 KiB) Downloaded 29 times

salar1991
Posts: 3
Joined: 12 Jan 2022 13:28

Re: problem with sd MMC_FAT16 library

#4 Post by salar1991 » 14 Jan 2022 15:37

i used these lines instead of the define lines and my code compiled with no errors

Code: Select all

sbit Mmc_Chip_Select at RC0_bit;
   sbit Mmc_Chip_Select_Direction at TRISC0_bit;

Post Reply

Return to “mikroC PRO for PIC General”