Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to send 12 bits data from pic18f??

Status
Not open for further replies.

brunokasimin

Member level 4
Joined
Jun 13, 2008
Messages
70
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,828
spi modules pic18f

hello,

Here is my simple question.How can I send 12 bits data from pic18f to a stepper motor controller (tmc 239)?? This is problem for me, because i know one register has only 8 bits, that means i can only send one byte of data.

any help will ge greatly appreciated.thx!

Best regards,
Bruno
 

stepper motor controller with pic18f

brunokasimin said:
hello,

Here is my simple question.How can I send 12 bits data from pic18f to a stepper motor controller (tmc 239)?? This is problem for me, because i know one register has only 8 bits, that means i can only send one byte of data.

any help will ge greatly appreciated.thx!

Best regards,
Bruno
TMC239 uses analog inputs or SPI to communicate with microcontrollers. Have a closer look into TMC239 and PIC18F datasheets, and you will see how to do it.

Cheers,
 

pic18f spi

hello,

thx for the reply.i have looked once more in tmc239 and pic18f4580 but i didn't find the solution..
 

brunokasimin said:
hello,

thx for the reply.i have looked once more in tmc239 and pic18f4580 but i didn't find the solution..

Hi,
I'd advise you creating two buffer registers. Then use the first one to save one byte (8 bits) and the second one can be used to save the 4 useful bits left.

In your code implementation you'll simply ignore the two bits in the second buffer.
Everything you need can be implemented with software.

Then use, as namqn said, the SPI modules of the PIC18F and your TCM239 for communication between the PIC and the driver.

Best regards
Kabanga
 

i have looked once more in tmc239 and pic18f4580 but i didn't find the solution.
I don't think, that you read the TMC239 datasheet thorougly. It also says this:

Even when there is only one device attached to a CPU, the CPU can communicate with it using a 16 bit transmission. In this case, the upper 4 bits are dummy bits.
This is actually required, cause SPI, by original defintion, is transmitting multiples of 8 bit. So the problem is, how to transmit 16 bit with a 8 bit SPI interface. I'm pretty sure that you are able to solve this problem, there are plenty of SPI examples using larger entities than 1 byte.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top