It is different types of checking your talking about.

A check to see if the SD card is working is in the sample

if sd_error == TRUE then
   const byte SD_ERROR_MESSAGE[] = "ERROR - SD CARD FAILED"
   print_string(serial_data, SD_ERROR_MESSAGE)
end if

A check to see if the SD card is inserted, is not in the sample. You could 
add this by checking if the socket switch is on or off.

A check to see if the card is formatted with FAT32 could be added 
after fat32_init, by checking the value of variable fat32_init_ok.
if fat32_init_ok == FALSE then
   const byte FAT32_ERROR_MESSAGE[] = "ERROR - FAT32 FAILED"
   print_string(serial_data, FAT32_ERROR_MESSAGE)
end if

Matt.

On Thursday, June 2, 2016 at 5:38:12 PM UTC-4, Guido Jones wrote:
>
> OK...
>
>
> FYI, the SD libraries in both C18 and Arduino always to a test for the 
> existence of a card *before *you attempt to do anything with the card and 
> throw an error if one isn't detected (C18 has the choice between hard 
> (switch contact) and media check via read, Arduino is always media check 
> unless you do your own switch-check).  
>
> The "soft" check is probably better since it's still possible that an 
> improperly-formatted card could be inserted.
>
>
>
> Thanks.
>
> On Thursday, June 2, 2016 at 2:41:02 PM UTC-4, Matthew Schinkel wrote:
>>
>> This pin is not used in the sd card lib, but can be used in the sample, 
>> for example, if you want to list the fat32 directory as soon as the sd card 
>> is inserted.
>>
>> Remove it, see if you get any errors.
>>
>> The only case i can think of that doing so would make the code work 
>> incorrectly is if there is a 'if defined' statement anywhere for it. But 
>> 'if defined' statements would be working as designed.
>>
>> I don't think there is a software detect, but it is a good idea as we 
>> could save a pin.
>>
>> Sent from my iPhone
>>
>> On Jun 2, 2016, at 2:30 PM, Guido Jones <[email protected]> wrote:
>>
>> No, an SD card socket usually has a physical detect pin if a card is 
>> inserted (microSD sockets usually don't). 
>>
>> I'm wondering if the SD code requires you to declare/not declare the 
>> existence of a detect pin and the associated PIC I/O if needed.  If you 
>> didn't declare a pin and it was looking for a signal, it might mess-up the 
>> code.
>>
>>
>> Thanks!
>>
>> On Thursday, June 2, 2016 at 11:20:09 AM UTC-4, Matthew Schinkel wrote:
>>>
>>> Not sure what part of the code your referring to.
>>>
>>> Do you mean hardware spi? Hardware spi is faster then software spi
>>>
>>> Sent from my iPhone
>>>
>>> On Jun 2, 2016, at 10:53 AM, Guido Jones <[email protected]> wrote:
>>>
>>> On last question; I don't see any use of a hardware SD card detect in 
>>> the 18F67J50 code example.
>>>
>>> Is there a choice between hardware detect and software detect? (some 
>>> parameter that needs to be set?)
>>>
>>>
>>>
>>> Thanks,
>>>
>>> On Wednesday, June 1, 2016 at 11:58:41 PM UTC-4, Matthew Schinkel wrote:
>>>>
>>>> *** To clarify, you simply changed the include statement from the 
>>>> 18F67J50 to the 18F46J50?
>>>>
>>>> Right, and you can do that with any PIC that has the required 
>>>> peripherals (USB, SPI, etc), ram, and available pins. Make sure you use 
>>>> one 
>>>> of the blink USB samples, running at 48 Mhz.
>>>>
>>>> I do know there are a few PICs that USB will not work with, but I'm 
>>>> sure they would give you compiler errors. Some updates to the libraries 
>>>> would need to be done.
>>>>
>>>> There are samples for how to do PPS (Peripheral Pin Select), but I am 
>>>> not familiar with it. Should work.
>>>>
>>>> Let me know if you get it working, we may be able to add a sample to 
>>>> jallib.
>>>>
>>>> Matt.
>>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "jallib" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://groups.google.com/group/jallib.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "jallib" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at https://groups.google.com/group/jallib.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/jallib.
For more options, visit https://groups.google.com/d/optout.

Reply via email to