SPI 24-bit addressing

Post your requests and ideas on the future development of mikroC PRO for FT90x.
Post Reply
Author
Message
jkjoy
Posts: 29
Joined: 23 May 2012 05:19

SPI 24-bit addressing

#1 Post by jkjoy » 30 Mar 2015 10:47

I am communicating with an SPI Audio record IC which has 24-bit address and 16-bit offset. I made a structure to read/write data from that device which has,
Command - 1 byte Address - 3 byte (24-bit) Offset address - 2 byte (16-bit)

During simulation (in proteous), it is found that 4th byte (MSB of address) is overlapped by 5th byte (LSB of Offset).

Following is the code. Please help what are the changes I need to do in the code. Is the bit field operation for 16 or 24 bits ok?

Code: Select all

typedef struct {
unsigned  char Command:8 ;
unsigned  long Addr:24;
unsigned  int Offset:16;
} ISD_Struct;
ISD_Struct ISD_Rec;
void main()
{
    address = 0x563412 ;
    OFFST   = 0x9A78 ;
    ISD_Rec.Command = 0xBC;
    ISD_Rec.Addr    = address;
    ISD_Rec.Offset  = OFFST;
    Write_SPI(&ISD_Rec,6); //sending  (1byte command + 3byte address + 2 byte offset)
    //Delay_ms(1000);
}
Thanks

User avatar
petar.timotijevic
mikroElektronika team
Posts: 1739
Joined: 19 Feb 2014 13:46
Location: Serbia
Contact:

Re: SPI 24-bit addressing

#2 Post by petar.timotijevic » 31 Mar 2015 09:08

Hi,

Please can you tell me which compiler you use?

With SPI library send data in 8-bit segments.


Just to say that Proteus simulator is not fully compatible with our compilers.


Best regards,
Peter

jkjoy
Posts: 29
Joined: 23 May 2012 05:19

Re: SPI 24-bit addressing

#3 Post by jkjoy » 31 Mar 2015 10:21

petar.timotijevic wrote:Hi,

Please can you tell me which compiler you use?

With SPI library send data in 8-bit segments.


Just to say that Proteus simulator is not fully compatible with our compilers.


Best regards,
Peter

I am using MikroC PRO for PIC v6.5.0

Regards

User avatar
petar.timotijevic
mikroElektronika team
Posts: 1739
Joined: 19 Feb 2014 13:46
Location: Serbia
Contact:

Re: SPI 24-bit addressing

#4 Post by petar.timotijevic » 31 Mar 2015 11:08

Hi,

I'm asking that because you open new topic in "mikroC PRO for FT90x Wish List".


Best regards,
Peter

jkjoy
Posts: 29
Joined: 23 May 2012 05:19

Re: SPI 24-bit addressing

#5 Post by jkjoy » 01 Apr 2015 04:50

petar.timotijevic wrote:Hi,

I'm asking that because you open new topic in "mikroC PRO for FT90x Wish List".


Best regards,
Peter
I am sorry. Actually I cannot figure-out how it turned to be in this forum. In my understanding I posted in "mikroC PRO for PIC General".

User avatar
petar.timotijevic
mikroElektronika team
Posts: 1739
Joined: 19 Feb 2014 13:46
Location: Serbia
Contact:

Re: SPI 24-bit addressing

#6 Post by petar.timotijevic » 01 Apr 2015 13:11

Hi,

Ok, no problem. Each specific topic should be opened in the appropriate group of topics. That maintain order and transparency in forum.


Best regards,
Peter

jkjoy
Posts: 29
Joined: 23 May 2012 05:19

Re: SPI 24-bit addressing

#7 Post by jkjoy » 02 Apr 2015 05:31

Thanks Peter.
Can I route this topic to "mikroC PRO for PIC General" from here?

User avatar
petar.timotijevic
mikroElektronika team
Posts: 1739
Joined: 19 Feb 2014 13:46
Location: Serbia
Contact:

Re: SPI 24-bit addressing

#8 Post by petar.timotijevic » 02 Apr 2015 13:12

Hi,
jkjoy wrote:Thanks Peter.
Can I route this topic to "mikroC PRO for PIC General" from here?
All OK, no need for that.

With SPI library send data in 8-bit segments.


Best rgards,
Peter

jkjoy
Posts: 29
Joined: 23 May 2012 05:19

Re: SPI 24-bit addressing

#9 Post by jkjoy » 06 Apr 2015 06:33

OK. Thanks

Post Reply

Return to “mikroC PRO for FT90x Wish List”