HOW TO TRANSMIT 16 BITS ON SPI CONNECTION

General discussion relating to the library modules supplied with the compiler

Moderators: David Barker, Jerry Messina

Post Reply
MARCOX
Posts: 6
Joined: Tue Jul 01, 2008 11:42 pm
Location: COLOMBIA

HOW TO TRANSMIT 16 BITS ON SPI CONNECTION

Post by MARCOX » Wed Feb 04, 2009 4:59 pm

I HAVE CIRCUIT BETWEEN PIC18F252 AND DAC MCP4822, BUT I NEED TO TX 16 BITS, AND I´VE TRIED TO DO THIS WITH THE MODIFIERS LIKE Byte0,Byte1 to send Out data to the Dac, but it isn´t works.
i´m sending two bytes, so i cut de Word in two bytes to transmit.
if someone can help.

tell me about the suggestions

nice day

liak
Registered User
Registered User
Posts: 195
Joined: Fri Oct 05, 2007 12:26 am

Post by liak » Mon Feb 09, 2009 12:50 am

Dear Marcox,
Mind telling us which SPI module you are using? SSPI or SPI? Does it work if you sent a byte only?

Regards,
Liak

Doj
Posts: 362
Joined: Wed Apr 11, 2007 10:18 pm
Location: East Sussex

Post by Doj » Mon Feb 09, 2009 8:57 am

You can send 16 bits out with SPI using the method you describe but you must keep the chip select line low during the whole transfer.
If you send one byte then raise chip select followed by the other byte it will fail

User avatar
ohararp
Posts: 194
Joined: Tue Oct 03, 2006 11:29 pm
Location: Dayton, OH USA
Contact:

Post by ohararp » Mon Feb 09, 2009 2:03 pm

I have also used the shift.bas command for talking SPI to a number of chips recently. I found the shift.bas command to work better than the SSPI or SPI commands for these instances.
Thanks Ryan
$25 SMT Stencils!!!
www.ohararp.com/Stencils.html

Post Reply