error compiling SD CARD PLAYER code
Moderators: David Barker, Jerry Messina
-
- Posts: 8
- Joined: Thu Jan 03, 2013 11:42 am
error compiling SD CARD PLAYER code
When compiling the basic code for the PIC18F452 to play a SD CARD,
it is pointed out an error concerning the command SD.Init(spiOsciDiv4),
stating that a Boolean expression is expected and that the identifier
spiOscDiv4 was not identified.
Thnaks for any suggestion.
it is pointed out an error concerning the command SD.Init(spiOsciDiv4),
stating that a Boolean expression is expected and that the identifier
spiOscDiv4 was not identified.
Thnaks for any suggestion.
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
If you're using SD lib V4.1.4, check out the wiki page on the SD library... some changes have been made to the Init() call.
Note that the Init command for initialising the card has been changed slightly since Version 3.1.1 and this will necesitate a change to existing user code. The command now returns a byte, not a boolean. The return variable gives more information in case of a failure (see err codes in comments above command in module for details). Note also that when using the hardware MSSP SPI option using #option SD_SPI = MSSP, the SPI bus speed is no longer passed to the Init command as a parameter, but is set using an option, e.g. #option SD_SPI_SPEED = spiOscDiv4. As for all options, this must be placed before the Include "SDFileSystem.bas" statement in the user code
-
- Posts: 8
- Joined: Thu Jan 03, 2013 11:42 am
SD Card Player code
Thanks for your reply.
I have included the command
#option SD_SPI_SPEED = spiOscDiv4
before the comand
Include "SDFileSystem.bas"
as you can see at the beginning of the code, as shown below.
The error pointed out still holds.
Device = 18F452
Clock = 32
Config OSC = HSPLL
#option SD_SPI = MSSP
#option SD_SPI_SPEED = spiOscDiv4
#option SD_SUPPORT_SUB_DIRECTORIES = True
#option LCD_DATA = PORTB.4
#option LCD_RS = PORTB.2
#option LCD_EN = PORTB.3
#option LCD_INIT_DELAY = 300
Include "SDFileSystem.bas"
Include "LCD.bas"
Device = 18F452
Clock = 32
Config OSC = HSPLL
#option SD_SPI = MSSP
#option SD_SPI_SPEED = spiOscDiv4
#option SD_SUPPORT_SUB_DIRECTORIES = True
#option LCD_DATA = PORTB.4
#option LCD_RS = PORTB.2
#option LCD_EN = PORTB.3
#option LCD_INIT_DELAY = 300
Include "SDFileSystem.bas"
Include "LCD.bas" command
I have included the command
#option SD_SPI_SPEED = spiOscDiv4
before the comand
Include "SDFileSystem.bas"
as you can see at the beginning of the code, as shown below.
The error pointed out still holds.
Device = 18F452
Clock = 32
Config OSC = HSPLL
#option SD_SPI = MSSP
#option SD_SPI_SPEED = spiOscDiv4
#option SD_SUPPORT_SUB_DIRECTORIES = True
#option LCD_DATA = PORTB.4
#option LCD_RS = PORTB.2
#option LCD_EN = PORTB.3
#option LCD_INIT_DELAY = 300
Include "SDFileSystem.bas"
Include "LCD.bas"
Device = 18F452
Clock = 32
Config OSC = HSPLL
#option SD_SPI = MSSP
#option SD_SPI_SPEED = spiOscDiv4
#option SD_SUPPORT_SUB_DIRECTORIES = True
#option LCD_DATA = PORTB.4
#option LCD_RS = PORTB.2
#option LCD_EN = PORTB.3
#option LCD_INIT_DELAY = 300
Include "SDFileSystem.bas"
Include "LCD.bas" command
-
- Posts: 8
- Joined: Thu Jan 03, 2013 11:42 am
SD Card Player code
Thanks for your interest to help me.
I'm using the version v4.1.4 and followed the instructions (in green) concerning the changes to the SdInit() command given on the page of
SdFilesystem v4.1.4.
I'm using the version v4.1.4 and followed the instructions (in green) concerning the changes to the SdInit() command given on the page of
SdFilesystem v4.1.4.
Thanks for confirming the SD lib version, now that you have changed the code to:
What is the compiler error now with the changes to the code?, because the code above looks correct.
Code: Select all
Device = 18F452
Clock = 32
Config OSC = HSPLL
#option SD_SPI = MSSP
#option SD_SPI_SPEED = spiOscDiv4
#option SD_SUPPORT_SUB_DIRECTORIES = True
#option LCD_DATA = PORTB.4
#option LCD_RS = PORTB.2
#option LCD_EN = PORTB.3
#option LCD_INIT_DELAY = 300
Include "SDFileSystem.bas"
Include "LCD.bas"
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Are you trying to compile the SDMMCWavPlayer code? If so, that code looks to be written for the older SD lib version.When compiling the basic code for the PIC18F452 to play a SD CARD,
it is pointed out an error concerning the command SD.Init(spiOsciDiv4)
Try changing
Code: Select all
LCD.Cls
LCD.WriteAt(1, 1, "PLEASE INSERT SD")
Repeat
Until SD.Init(spiOscDiv4)
Code: Select all
LCD.Cls
LCD.WriteAt(1, 1, "PLEASE INSERT SD")
Repeat
Until (SD.Init() = ErrOK)
-
- Posts: 8
- Joined: Thu Jan 03, 2013 11:42 am
SD Card Player code
I've made the changes suggested. Now it is ponted out the error
Program variable allocation exceeds Swordfish Special Edition (SE)
maximum.
Is the compiler as a freeware edition limited for this code, say, the code is
too large for this edition ?
Program variable allocation exceeds Swordfish Special Edition (SE)
maximum.
Is the compiler as a freeware edition limited for this code, say, the code is
too large for this edition ?