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

SDCARD problems
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rufinopc@rufinogg.com



Joined: 11 Mar 2023
Posts: 17

View user's profile Send private message

PostPosted: Thu Mar 16, 2023 5:22 am     Reply with quote

I appreciate the information on http://www.brushelectronics.com/software
I will consider purchasing, although for learning about SDs and PICs, it seems a bit excessive at the moment...
rufinopc@rufinogg.com



Joined: 11 Mar 2023
Posts: 17

View user's profile Send private message

PostPosted: Sat Apr 01, 2023 5:00 am     Reply with quote

Sorry for forgetting.
I had forgotten to give an answer to this problem that had been left open for 15 days.
First of all I put one of the MPLABx examples up and running with XC16, it took some work because it was not prepared for dsPIC33 either, but in the end it is very stable, but, as you know, it is quite complex due to the versatility of micros, FAT, etc for those who make it.
Once I got it working I couldn't resist leaving the example, posted by more people on this CCS forum, without getting it to work for 16-bit as well.
The solution was quite simple, but at the same time delicate. First of all, you have to remember that the PIC24 and dsPIC33 are 16-bit micros, so you have to be very scrupulous with the variables:
By default all types are 8-bit unsigned, while for the PCD compiler they are 16-bit signed, except float chat which are signed. This causes a severe conflict if you have not been very scrupulous when preparing the program, since it is not worth just adding
#include <stdint.h>
You also have to provide a substitution with
#type INT=8
#type unsigned
But this is not enough either since the "char" although they are 8 bits, the PCD interprets them as signed int8. If you don't want to maintain compatibilities, the best thing to do is replace the "char" with "unsigned char", the "int8", "int16" and "in32" with uint8_t...etc. as long as they are not specifically signed.
After all this you can already read and write to the SD. It is also true that it is not very stable, but with a little patience you can achieve a definitive job, and if you want it compatible with 8 bits.
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Sat Apr 01, 2023 9:58 am     Reply with quote

Well done.
This has been discussed here in the past, with migration to the DSPIC's,
with several people (myself included), pointing out these issues. It is a
different 'mindset' from the smaller PIC's.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
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