Interfacing Arduino SPI with MC33HB2001

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Interfacing Arduino SPI with MC33HB2001

1,189件の閲覧回数
mingentay
Contributor I

I have 3 things that I need to clarify:

1. I have a MC33HB2001 chip which I wish to set at a 10.7 current limit when I start using it. I want to use an arduino uno's SPI as the master to interface with the chip. However, I am not too sure about the order of things I should send to the chip, and how I should go about sending the commands to the chip since arduino is 8 bit and the chip is 16 bit. Here is the code I have come up with so far:

#include <SPI.h> //SPI library

#define SS 10 // define slave select pin here

const uint16_t limit = 58256; // 1110001110010000 is the 16 bit that fits my specification 

SPISettings chip(10000000, MSBFIRST, SPI_MODE0); // 10MHz, MSB first, output on falling, data capture on rising

void setup() {

pinMode(SS,OUTPUT); //setting slave select pin as a digital output

SPI.begin();  //initialise SPI bus

digitalWrite(SS,LOW); //contact MC33HB2001

SPI.transfer16(limit); // send the 16 bits over

digitalWrite(SS,HIGH); //end contact with chip

}

void loop() {

other portion of code that is not related to chip

}

I want to ask if I have to just send the 16 bits over once to the chip and that is the end of story, or must I keep running the commands in the arduino loop()?

2. For the MC33HB2001 chip, to send commands to it, do I just send a single 16 bit transmission, or must I do things in this order:

      1. Send a 'Write' command 16 bit

      2. Send my specific 'current limit' 16 bit

      3. End transmission

3. Under the MC33HB2001 documentation, for the 'control and configuration', if i set bit 2 (active INPUT control mode) to 0, does this mean that bit 1 (virtual input 1) and bit 0 (virtual input 2) can be any value since I am not using virtual input to control my chip?

0 件の賞賛
0 返答(返信)