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

how to work with Bi-Directional data spi

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jaikumar



Joined: 15 Dec 2006
Posts: 109

View user's profile Send private message

how to work with Bi-Directional data spi
PostPosted: Sat Aug 23, 2014 6:42 am     Reply with quote

Hi all,

I am trying to use this chip - RTC-4543 SA
Most SPI has a MISO MOSI or DI DO but this chip the data is bi-directional will the ccs spi driver support this chip or what changes do i have to do.

https://www.spezial.com/commercio/dateien/produktbeitraege/rtc-4543sa_sb.pdf

Thanks and Regards,
Jai
temtronic



Joined: 01 Jul 2010
Posts: 9241
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Aug 23, 2014 6:54 am     Reply with quote

I downloaded the applications manual and it's not really an SPI device. If you use Google you'll find a 'driver' for another micro , in C, that you could adapt for CCS C.
You'll need to read/write 52 bits of data though.
Epson is famous for this..I think it's based on nibbles rather then bytes.

hth
jay
jaikumar



Joined: 15 Dec 2006
Posts: 109

View user's profile Send private message

PostPosted: Sat Aug 23, 2014 7:06 am     Reply with quote

So its a SERIAL-INTERFACE device not the Motorola SPI.

So the driver would be a software one. no hardware module in pic to perform

comm.

Thanks temtronic.
temtronic



Joined: 01 Jul 2010
Posts: 9241
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Aug 23, 2014 9:56 am     Reply with quote

YES ..NOT SPI, you have to create your own software driver...


jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Sun Aug 24, 2014 1:04 am     Reply with quote

As a quick comment, the standard #use rs232 driver may be able to do this!.
I don't know if the software serial driver supports software sync. You'd have to write a quick test to see. However if it does, you'd need to generate two streams, one for TX, and one for RX. So:

Code:

#use rs232(BAUD=xxx,XMIT=B0,RCV=B1,SYNC_MASTER,STREAM=TX)
#use rs232(BAUD=xxx,XMIT=B0,RCV=B1,SYNC_MASTER_CONT,STREAM=RX)

I don't see where it specifies a baud rate?.
Then you'd have to operate the WR pin to the right direction, and send or receive on the corresponding stream.

If the software doesn't support it, you'd need a PIC that supports a USART, rather than a UART.

The data sheet lacks important things like what the byte format is, serial clock rate, bit order etc. etc..
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Sun Aug 24, 2014 3:55 am     Reply with quote

Pull this manual, instead of the one you have:

<http://www.epsondevice.com/docs/qd/en/DownloadServlet?id=ID000500>

The supported baud rate is 128Hz, to 1.3MHz. Pretty much anything you want.

The format, could be generated by the hardware EUSART, as already mentioned. Being LSb first, it is not compatible with hardware SPI. It is basically synchronous serial, sending 6.5 bytes at a time. The hardware would have to do 7 bytes, but they are careful to tell you that extra clocks after the 52nd one are ignored, so 8bit hardware could be used.

It could also be generated by the software SPI routines, again using two streams, one for transmit, and one for receive.
jaikumar



Joined: 15 Dec 2006
Posts: 109

View user's profile Send private message

PostPosted: Mon Aug 25, 2014 12:34 am     Reply with quote

Thanks Ttelmah.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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