Nov 18, 2019
04:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 18, 2019
04:00 AM
Hi,
I'm using to TLE7242 for selenoid control. I am sending variable current value over SPI line to TLE in infinite loop. But, PWM output signals is distorted such as frequency value change or output signal loss. I'm using only channel 0 and channel 1 for pwm conntoller. I'm using 0.05 ohm for sense resistor. Could you please explain to me, why i can't update continuously the current value ?
My code example like below (its not last version or full code only for explained my problem. It's not include the other function like init etc):
setCurrent(int ch, int current){
char txData[4] = {0x8c,0x80,0xf8,0x00};
txData[0] |= ch;
txData[3] = current;
send_spi(txData);
}
while(1){
setCurrent(Channel_0, count);
setCurrent(Channel_1,count++)
delayMs(100);
if(count == 256){
count=0;
}
}
I'm using to TLE7242 for selenoid control. I am sending variable current value over SPI line to TLE in infinite loop. But, PWM output signals is distorted such as frequency value change or output signal loss. I'm using only channel 0 and channel 1 for pwm conntoller. I'm using 0.05 ohm for sense resistor. Could you please explain to me, why i can't update continuously the current value ?
My code example like below (its not last version or full code only for explained my problem. It's not include the other function like init etc):
setCurrent(int ch, int current){
char txData[4] = {0x8c,0x80,0xf8,0x00};
txData[0] |= ch;
txData[3] = current;
send_spi(txData);
}
while(1){
setCurrent(Channel_0, count);
setCurrent(Channel_1,count++)
delayMs(100);
if(count == 256){
count=0;
}
}
Labels
0 Replies