Jump to content
Derekspeegle

ADC with MSP430

Recommended Posts

Update: I need help with another related issue. 

 

Hello everyone,

 

It turned out that in order to get a solid drive I needed a different gate resistor. Having solved that issue, a new issue came up and this one is actually software related. I'm mapping my input values which range from about 0 - 1580 into a range of 0 - 255. From there, I convert the RGB values that I receive into a HSV number range, adjust the V value, then reconvert the numbers to RGB and output it. 

 

The problem is that the output values will be sitting on the edge of the input ranges and swing up and down. The input value will only vary around 1 point after I take a large number of samples but that's enough for it to swing between 2 of the 255 output values. Here is my code :

  1. byte PWM_PIN = P1_3;
  2. byte PWM_PIN2 = P1_4;
  3. byte PWM_PIN3 = P1_5;
  4. byte rout = P8_3;
  5. byte gout = P1_6;
  6. byte bout = P1_7;
  7.  
  8. float pwm_value;
  9. float pwm;
  10. float pwm_value2;
  11. float pwm2;
  12. float pwm_value3;
  13. float pwm3;
  14.  
  15. const int numReadings = 25;
  16. const int numReadings2 = 25;
  17.  
  18. int readings[numReadings]; // the readings from the analog input
  19. int readIndex = 0; // the index of the current reading
  20. float total = 0; // the running total
  21. float average = 0; // the average
  22. int readings2[numReadings]; // the readings from the analog input
  23. int readIndex2 = 0; // the index of the current reading
  24. float total2 = 0; // the running total
  25. float average2 = 0; // the average
  26. int readings3[numReadings2]; // the readings from the analog input
  27. int readIndex3 = 0; // the index of the current reading
  28. float total3 = 0; // the running total
  29. float average3 = 0; // the average
  30. int readings4[numReadings]; // the readings from the analog input
  31. int readIndex4 = 0; // the index of the current reading
  32. int total4 = 0; // the running total
  33. float average4 = 0; // the average
  34. int readings5[numReadings]; // the readings from the analog input
  35. int readIndex5 = 0; // the index of the current reading
  36. int total5 = 0; // the running total
  37. float average5 = 0; // the average
  38. int readings6[numReadings2]; // the readings from the analog input
  39. int readIndex6 = 0; // the index of the current reading
  40. int total6 = 0; // the running total
  41. float average6 = 0; // the average
  42. double r;
  43. double g;
  44. double b;
  45. double rd;
  46. double gd;
  47. double bd;
  48. double h;
  49. double s;
  50. double v;
  51. double hsv[2];
  52. double max1;
  53. double min1;
  54. double max2;
  55. double min2;
  56. double max;
  57. double min;
  58. double v1;
  59. double r1;
  60. double r2;
  61. double g1;
  62. double g2;
  63. double b1;
  64. double b2;
  65. double s1;
  66. double r3;
  67. double g3;
  68. double b3;
  69.  
  70.  
  71. void setup() {
  72. pinMode(PWM_PIN, INPUT);
  73. pinMode(PWM_PIN2, INPUT);
  74. pinMode(PWM_PIN3, INPUT);
  75. pinMode(rout, OUTPUT);
  76. pinMode(gout, OUTPUT);
  77. pinMode(bout, OUTPUT);
  78. Serial.begin(9600);
  79.  
  80. //Setup for the 6 averaging functions
  81. for (int thisReading = 0; thisReading < numReadings; thisReading++) {
  82. readings[thisReading] = 0;
  83. }
  84. for (int thisReading2 = 0; thisReading2 < numReadings; thisReading2++) {
  85. readings2[thisReading2] = 0;
  86. }
  87. for (int thisReading3 = 0; thisReading3 < numReadings2; thisReading3++) {
  88. readings3[thisReading3] = 0;
  89. }
  90.  
  91. for (int thisReading4 = 0; thisReading4 < numReadings; thisReading4++) {
  92. readings4[thisReading4] = 0;
  93. }
  94. for (int thisReading5 = 0; thisReading5 < numReadings; thisReading5++) {
  95. readings5[thisReading5] = 0;
  96. }
  97. for (int thisReading6 = 0; thisReading6 < numReadings2; thisReading6++) {
  98. readings6[thisReading6] = 0;
  99. }
  100. }
  101. void loop() {
  102. analogFrequency(10000);
  103.  
  104. //This section is mapping the signal and inverting it so that it is correct, it also makes it so max zeroes out properly.
  105. if (average == 0) {
  106. pwm = 0;
  107. }
  108. else {
  109. pwm = map(average,1,1560,260,6);
  110. }
  111. if (average2 == 0) {
  112. pwm2 = 0;
  113.  
  114. }
  115. else {
  116. pwm2 = map(average2,1,1560,260, 6);
  117. }
  118. if (average3 == 0) {
  119.  
  120. pwm3 = 0;
  121. }
  122. else {
  123. pwm3 = map(average3,1,1560,260,8);
  124. }
  125.  
  126. average = constrain(average,0 , 1560);
  127. average2 = constrain(average2,0 , 1560);
  128. average3 = constrain(average3,0 , 1560);
  129.  
  130.  
  131. r = pwm;
  132. g = pwm2;
  133. b = pwm3;
  134.  
  135.  
  136.  
  137. //This section converts the rgb values into HSV values
  138. double rd = (double) r/255;
  139. double gd = (double) g/255;
  140. double bd = (double) b/255;
  141. double max1 = max(gd, bd);
  142. double max2 = max(rd, max1);
  143. double min1 = min(gd, bd);
  144. double min2 = min(rd, min1);
  145.  
  146. double h, s, v = max2;
  147. double d = max2 - min2;
  148.  
  149. s = max2 == 0 ? 0 : d / max2;
  150.  
  151.  
  152. if (max2 == min2) {
  153. h = 0; // achromatic
  154. } else {
  155. if (max2 == rd) {
  156. h = (gd - bd) / d + (gd < bd ? 6 : 0);
  157. } else if (max2 == gd) {
  158. h = (bd - rd) / d + 2;
  159. } else if (max2 == bd) {
  160. h = (rd - gd) / d + 4;
  161. }
  162. h /= 6;
  163. }
  164. //This section adjusts the HSV values
  165. s1=1.08+0.41*logf(s);
  166. v1 = v*32/100;
  167. s1 = constrain(s1,0,1);
  168.  
  169. //This section takes the newly adjusted HSV values and converts them back to RGB
  170.  
  171. float r1, g1, b1;
  172.  
  173. int i = int(h * 6);
  174. float f = h * 6 - i;
  175. float p = v1 * (1 - s1);
  176. float q = v1 * (1 - f * s1);
  177. float t = v1 * (1 - (1 - f) * s1);
  178.  
  179. switch(i % 6){
  180. case 0: r1 = v1, g1 = t, b1 = p; break;
  181. case 1: r1 = q, g1= v1, b1 = p; break;
  182. case 2: r1 = p, g1 = v1, b1 = t; break;
  183. case 3: r1 = p, g1 = q, b1 = v1; break;
  184. case 4: r1 = t, g1 = p, b1 = v1; break;
  185. case 5: r1 = v1, g1 = p, b1 = q; break;
  186. }
  187. r2 = r1 * 255;
  188. g2 = g1 * 255;
  189. b2 = b1 * 255;
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. //Section for taking an average of the 3 inputs
  203. total = total - readings[readIndex];
  204. readings[readIndex] = pulseIn(PWM_PIN, HIGH, 10000);
  205. total = total + readings[readIndex];
  206. readIndex = readIndex + 1;
  207. if (readIndex >= numReadings) {
  208. readIndex = 0;
  209. }
  210. average = total / numReadings;
  211.  
  212.  
  213. total2 = total2 - readings2[readIndex2];
  214. readings2[readIndex2] = pulseIn(PWM_PIN2, HIGH, 10000);
  215. total2 = total2 + readings2[readIndex2];
  216. readIndex2 = readIndex2 + 1;
  217. if (readIndex2 >= numReadings) {
  218. readIndex2 = 0;
  219. }
  220. average2 = total2 / numReadings;
  221.  
  222.  
  223. total3 = total3 - readings3[readIndex3];
  224. readings3[readIndex3] = pulseIn(PWM_PIN3, HIGH, 10000);
  225. total3 = total3 + readings3[readIndex3];
  226. readIndex3 = readIndex3 + 1;
  227. if (readIndex3 >= numReadings2) {
  228. readIndex3 = 0;
  229. }
  230. average3 = total3 / numReadings2;
  231. //Section for taking an average of new rgb values before output
  232. total4 = total4 - readings4[readIndex4];
  233. readings4[readIndex4] = r2;
  234. total4 = total4 + readings4[readIndex4];
  235. readIndex4 = readIndex4 + 1;
  236. if (readIndex4 >= numReadings) {
  237. readIndex4 = 0;
  238. }
  239. r3 = total4 / numReadings;
  240.  
  241.  
  242. total5 = total5 - readings5[readIndex5];
  243. readings5[readIndex5] = g2;
  244. total5 = total5 + readings5[readIndex5];
  245. readIndex5 = readIndex5 + 1;
  246. if (readIndex5 >= numReadings) {
  247. readIndex5 = 0;
  248. }
  249. g3 = total5 / numReadings;
  250.  
  251.  
  252. total6 = total6 - readings6[readIndex6];
  253. readings6[readIndex6] = b2;
  254. total6 = total6 + readings6[readIndex6];
  255. readIndex6 = readIndex6 + 1;
  256. if (readIndex6 >= numReadings2) {
  257. readIndex6 = 0;
  258. }
  259. b3 = total6 / numReadings2;
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266. Serial.println("b1");
  267. Serial.println(average);
  268. Serial.println("b2");
  269. Serial.println(average2);
  270. Serial.println("b2");
  271. Serial.println(average3);
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280. analogWrite(rout, r3);
  281.  
  282. analogWrite(gout, g3 );
  283.  
  284. analogWrite(bout, b3);
  285.  
  286. //Serial.println("average3");
  287. //Serial.println(B);
  288.  
  289.  
  290. }
  291.  

I was also having an issue where in the final stage of calculation it would multiply 0.01 by 255 but it would give me 4.5 and vary to 3.8 without the input 0.01 changing. Why would the result change without the input changing? This was also making my output vary. I would also appreciate any pointers on how to execute code since I'm a novice.

 

Thanks,  

 

 

 

 

 

 

 

 

 

 

 

Hello,

 

I have been trying to get a program to work that will analyze a ADC signal and send it back out on another pin with a higher frequency.  After trying to make it work using different methods of measuring the duty cycle, I found out that the MSP430fr4133 isn't coded correctly in Energia for ADC. My question is, what functions would you suggest to use in order to measure the wave properly? The waves are not clean digital waves, which is why i want to clean it up. Also, what MSP430 launchpad would you suggest for getting ADC to work on Energia?

 

Thanks,

Share this post


Link to post
Share on other sites

Hi @@Derekspeegle, I just send you a fix via e-mail.

 

For others, the issue was that INTERNAL1V5 was not defined. It turned out that indeed INTERNAL1V5 was no defined and that the existing defines were wrong. The FR4133 has only one internal reference (1.5Volt). Fix below:

 

As for your second question, would be good to see a picture of the waveform. If it is a square wave but has noise, then you might be able to capture it with edge detection using attachInterrupt() flipping the edge whenever you detect an edge. The signal will have cross the positive and negative going input threshold voltage without the noise / ripple going causing the edge. For the FR4133 @ 3 Volt VCC the MAX Positive-going input threshold voltage is 2.25 and the MIN Negative-going input threshold voltage is 0.75.

 

 #if defined(__MSP430_HAS_ADC__)
 #define DEFAULT ADCSREF_0
-#define INTERNAL1V2 (ADCSREF_1 | REFON | REFVSEL_0)
-#define INTERNAL2V0 (ADCSREF_1 | REFON | REFVSEL_1)
-#define INTERNAL2V5 (ADCSREF_1 | REFON | REFVSEL_2)
+#define INTERNAL1V5 (ADCSREF_1)
 #define EXTERNAL ADCSREF_2
 #endif

Share this post


Link to post
Share on other sites

Hi @@Derekspeegle,

 

There is additional background that would be needed to give meaningful help here.  E.G. what frequencies are you working with, what algorithms are you using, what kind of resolution are you trying to achieve, why are you doing it?  Do you need floating point math?  Are you trying to do it in "real time" or are you storing and processing it later?  Etc...

 

If this is new to you, then here are a couple of links that might help you get started:

 

Adafruit tutorial on real time voice changing

43oh post on 5 kHz FFT using Energia

43oh post on CounterLib

 

In any event, this kind of analysis can push (or exceed) the limits of a microcontroller.  So select a fast LaunchPad - e.g. something from the Tiva C series or maybe the MSP432.  Depending on what you are trying to achieve, it may be necessary to code outside of the Energia functions.

 

edit: took out bit on issues with FR4133

Share this post


Link to post
Share on other sites

Thanks for the help with that fix energia.

 

Fmilburn,

 

Thanks for the response. I'm working with a frequency around 600hz and I want to step up the frequency to about 10k while keeping the duty cycle. The point is to increase the frequency of an LED driver. So I need to keep the duty cycle in order to output the correct RGB values. This would need to be done in Real Time in order to allow for control of the values. I'm working on creating my own driver but for now i'm trying to use this to improve upon an existing driver. The values done need to anymore accurate then 0-255 decimal so i dont think i need floating point math. Let me know if you have any suggestions.

 

 Thanks!

Share this post


Link to post
Share on other sites

@@Derekspeegle

 

I don't understand the application, especially the high output frequency, but here are some thoughts....

 

Signal input and conditioning - Where is it coming from and what does it look like?

 

Frequency determination - Have you been using PulseIn()? It is a standard Energia function and reads the length of a pulse down to 10 microseconds. Alternatively, you could use CounterLib in the link above to count for a specified time and convert to frequency.

 

Signal output - It sounds like your output is PWM. Here is a link that explains what you can do in Energia with the MSP430: http://forum.43oh.com/topic/4858-solved-pwm-frequency-in-energia/

 

For the ARM microcontrollers like the Tiva and CC3200 there is this function that won't work on the MSP430: http://forum.43oh.com/topic/8677-analogfrequency-not-working-cc3200-lp/

Share this post


Link to post
Share on other sites

Hello, 

 

So, I was able to more accurately read the pulses by pulling the PWM from a different location. When I used the pulseIn function before it wasnt working because I was pulling the waves from the output of the driver, so it was supplying ground on the pulses not voltage. Now I'm getting pretty accurate data and it reflects the data of the driver perfectly. I believe I can handle the rest from here, Thanks to both of you :) 

 

Thanks,

Share this post


Link to post
Share on other sites

Hello,

 

So it looks like everyone worked the way it was suppose to except one issue. The PulseIn function causes a huge delay of about 5 seconds when I change the input signal. It updates properly but takes a long time to do it. I know that it's because the PulseIn function sits on the signal until it times out, I just dont know how to fix it. I tried adding a small incremental timer just so that the sample is short but that stops it from working altogether. Please Help >< 

 

Here's my code, I'm new to coding so please feel free to give any pointers. 

 

byte PWM_PIN = P1_5;
byte PWM_PIN2 = P1_4;
 byte PWM_PIN3 = P1_3;
 byte rout = P1_7;
 byte gout = P1_6;
 byte bout = P8_3;
 
int pwm_value;
int pwm;
int pwm_value2;
int pwm2;
int pwm_value3;
int pwm3;
volatile int timers = 0;
 
 
 
 
 
void setup() {
  pinMode(PWM_PIN, INPUT);
    pinMode(PWM_PIN2, INPUT);
  pinMode(PWM_PIN3, INPUT);
pinMode(rout, OUTPUT);
pinMode(gout, OUTPUT);
pinMode(bout, OUTPUT);
  
  
}
 
 
void loop() {
  analogFrequency(10000);
  
  for (int timers = 0; timers < 2; timers++) {
  int pwm = map(pwm_value, 0, 1636, 0, 255);
  pwm_value = pulseIn(PWM_PIN, HIGH);
  delay(100);
}
  for (int timers = 1; timers < 3; timers++) { 
   int pwm2 = map(pwm_value2, 0, 1636, 0, 255);
  pwm_value2 = pulseIn(PWM_PIN2, HIGH);
  delay(100);
}
  for (int timers = 2; timers < 4; timers++) {
  int pwm3 = map(pwm_value3, 0, 1636, 0, 255);
  pwm_value3 = pulseIn(PWM_PIN3, HIGH);
  delay(100);
}
for (int timers = 3; timers < 5; timers++) {
analogWrite(rout, pwm);
 
analogWrite(gout, pwm2);
 
analogWrite(bout, pwm3);
delay(100);
timers = 0;
}
}

Share this post


Link to post
Share on other sites

@@Derekspeegle

 

Maybe this will do what you want:

byte PWM1_PIN = P1_5;
byte PWM2_PIN = P1_4;
byte PWM3_PIN = P1_3;
byte ROUT = P1_7;
byte GOUT = P1_6;
byte BOUT = P8_3;

void setup() {
  analogFrequency(10000);  // moved from loop() to setup()
  pinMode(PWM1_PIN, INPUT);
  pinMode(PWM2_PIN, INPUT);
  pinMode(PWM3_PIN, INPUT);
  pinMode(ROUT, OUTPUT);
  pinMode(GOUT, OUTPUT);
  pinMode(BOUT, OUTPUT);
}

void loop() {
  analogWrite(ROUT, map(pulseIn(PWM1_PIN, HIGH), 0, 1636, 0, 255));
  analogWrite(GOUT, map(pulseIn(PWM2_PIN, HIGH), 0, 1636, 0, 255));
  analogWrite(BOUT, map(pulseIn(PWM3_PIN, HIGH), 0, 1636, 0, 255));
}
If not, since sometimes some functions have issues calling other functions from within themselves, maybe:

byte PWM1_PIN = P1_5;
byte PWM2_PIN = P1_4;
byte PWM3_PIN = P1_3;
byte ROUT = P1_7;
byte GOUT = P1_6;
byte BOUT = P8_3;

int pwm1_value;
int pwm1;
int pwm2_value;
int pwm2;
int pwm3_value;
int pwm3;

void setup() {
  analogFrequency(10000);  // moved from loop() to setup()
  pinMode(PWM1_PIN, INPUT);
  pinMode(PWM2_PIN, INPUT);
  pinMode(PWM3_PIN, INPUT);
  pinMode(ROUT, OUTPUT);
  pinMode(GOUT, OUTPUT);
  pinMode(BOUT, OUTPUT);
}

void loop() {
  pwm1_value = pulseIn(PWM1_PIN, HIGH);
  pwm1 = map(pwm1_value, 0, 1636, 0, 255);
  pwm3_value = pulseIn(PWM2_PIN, HIGH);
  pwm2 = map(pwm2_value, 0, 1636, 0, 255);
  pwm3_value = pulseIn(PWM3_PIN, HIGH);
  pwm3 = map(pwm3_value, 0, 1636, 0, 255);
  analogWrite(ROUT, pwm1);
  analogWrite(GOUT, pwm2);
  analogWrite(BOUT, pwm3);
}
Note that I changed some of your variables' names and their "case" so that those that don't change are all CAPS and those that do are lower case.

Share this post


Link to post
Share on other sites

Sorry for the slow response, I was doing a ton of testing. Using the delay function from within the PulseIn I am able to have it read and output at a high frequency and its fairly accurate. My issue now is that it has a weird jitter from time to time and cant properly read the pulse when it's value is under 5. How can I trim the results so that they are more solid and enable it to read the low end?? Here is my code as it stands. Thanks for all the help :)

byte PWM_PIN = P1_5;
byte PWM_PIN2 = P1_4;
byte PWM_PIN3 = P1_3;
byte rout = P1_7;
byte gout = P1_6;
byte bout = P8_3;
 
float pwm_value;
float pwm;
float pwm_value2;
float pwm2;
float pwm_value3;
float pwm3;






void setup() {
pinMode(PWM_PIN, INPUT);
pinMode(PWM_PIN2, INPUT);
pinMode(PWM_PIN3, INPUT);
pinMode(rout, OUTPUT);
pinMode(gout, OUTPUT);
pinMode(bout, OUTPUT);
  
  
}
 
 
void loop() {
analogFrequency(10000);
int pwm = map(pwm_value, 0, 1024, 0, 255);
pwm_value = pulseIn(PWM_PIN, HIGH, 10000);
int pwm2 = map(pwm_value2, 0, 1024, 0, 255);
pwm_value2 = pulseIn(PWM_PIN2, HIGH, 10000);
int pwm3 = map(pwm_value3, 0, 1024, 0, 255);
pwm_value3 = pulseIn(PWM_PIN3, HIGH, 10000);
  

analogWrite(rout, pwm);

analogWrite(gout, pwm2);

analogWrite(bout, pwm3);

}


Share this post


Link to post
Share on other sites

So, the signal is mostly a square wave but its frequency is a little messed up. Here is a picture of the signal, https://www.dropbox.com/s/nprycl84ckpgh56/20160303_091710.jpg?dl=0

 

Once my processor receive it, it runs this code :

byte PWM_PIN = P1_5;
byte PWM_PIN2 = P1_4;
byte PWM_PIN3 = P1_3;
byte rout = P1_7;
byte gout = P1_6;
byte bout = P8_3;
 
float pwm_value;
float pwm;
float pwm_value2;
float pwm2;
float pwm_value3;
float pwm3;

const int numReadings = 15;

int readings[numReadings];      // the readings from the analog input
int readIndex = 0;              // the index of the current reading
int total = 0;                  // the running total
int average = 0;                // the average






void setup() {
pinMode(PWM_PIN, INPUT);
pinMode(PWM_PIN2, INPUT);
pinMode(PWM_PIN3, INPUT);
pinMode(rout, OUTPUT);
pinMode(gout, OUTPUT);
pinMode(bout, OUTPUT);

Serial.begin(9600); 
for (int thisReading = 0; thisReading < numReadings; thisReading++) {
     readings[thisReading] = 0;
   }

  
}
 
 
void loop() {
analogFrequency(10000);
int pwm = map(average, 0, 1579, 0, 255);
//pwm_value = pulseIn(PWM_PIN, HIGH, 10000);
//int pwm2 = map(pwm_value2, 0, 1579, 0, 255);
pwm_value2 = pulseIn(PWM_PIN2, HIGH, 10000);
//int pwm3 = map(pwm_value3, 0, 1579, 0, 255);
pwm_value3 = pulseIn(PWM_PIN3, HIGH, 10000);
  


total = total - readings[readIndex];
   readings[readIndex] = pulseIn(PWM_PIN, HIGH, 5000);
   total = total + readings[readIndex];
   readIndex = readIndex + 1;
   if (readIndex >= numReadings) {
     readIndex = 0;
   }
average = total / numReadings;
Serial.println(pwm);
analogWrite(rout, pwm);

analogWrite(gout, pwm2);

analogWrite(bout, pwm3);
}


Then this is the wave I get, which is fairly accurate as the same signal at a higher frequency.

https://www.dropbox.com/s/vpbbll1r70b0gvo/20160303_091800.jpg?dl=0

 

Then it is put through a gate driver , 849-IXDN602SIA, through a 74 Ohm Resistor then into the Omnifet, 511-VND14NV04-E.

 

Afterword, I get this driven signal,

. https://www.dropbox.com/s/f1o87jftcq6lu8g/20160303_091822.jpg?dl=0

 

 

The issue that I'm having currently is that when I'm in the duty cycle range of 2-19, the Omnifet puts out strange signals. My serial com is showing that my device is putting out the correct duty cycle for the most part. When my duty cycle is 1 it even works correctly Just not between 2 and 19.

 

Here is the signal coming in during that range,

https://www.dropbox.com/s/0zxfbskqax7jr0e/20160303_093528.jpg?dl=0

 

Here is the signal after the MCU

https://www.dropbox.com/s/6gb4i490rxo1s06/20160303_093547.jpg?dl=0

 

Here is my issue, after the Mosfet

https://www.dropbox.com/s/vxlbn4psy3xzwxy/20160303_093601.jpg?dl=0

 

That signal at the end is wavering all over the place. Any help would be appreciated, Thanks.

Share this post


Link to post
Share on other sites

@@Derekspeegle

 

The input in your first link looks pretty good actually with the exception that it is over 4V.  I don't know what microcontroller you are using but that could be a problem sooner or later.  See the datasheet for maximum.

 

The code must be working if you get reasonable output after the microcontroller - i.e. the 5th link.  Accordingly, the problem must be in the circuit that follows the microcontroller and not in the code.  You are posting in the wrong place if that is the case since this is the Energia MSP section.

 

I'm not an electrical engineer and not familiar with those components but here are a couple of suggestions:

  • Try probing with the oscilloscope between the discrete components, including the resistor in case it is RC.  That may tell you which one is acting up.
  • Look at the datasheets.  For the 511-VND14NV04-E in particular the maximum turn-on delay, rise time, turn-off delay and fall times add up to a pretty big number at your higher frequency.

 

Suggest posting in an electronics forum rather than microcontroller if you can't figure it out and I have interpreted your problem correctly.  When you post, sketch out the circuit and post it along with oscilloscope so they have the data to help you.  It looks like your oscilloscope has a USB connection.  Use a memory stick and the print button to get better screen shots.

Share this post


Link to post
Share on other sites

Thank you for all of your suggestions. Your right that it would seem that the coding is working correctly. I just wasn't sure if there might be a way to help with the problems in the lower range by altering the code. I'll be sure to post this in an electronics forum next using your suggestions.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...