Jump to content

DevilMKD1426459920

Members
  • Content Count

    1
  • Joined

  • Last visited

About DevilMKD1426459920

  • Rank
    Noob Class
  1. DevilMKD1426459920

    Help: How to Simulate PWM on Pin PA_6 (Stellaris)?

    You can try to use the timer (if you see how its made a PWM with some comparators, the same method can be used here) so you can make a software controlled PWM, on every pin you want not only on the hardware pins here is a sample code, if you need more help i will try to explain you the code (with pictures ) You need some code for input to change the variable, so you can set the duty cycle. If you see the signal from the timer, its like a sawtooth signal, if you make the code right so you can change the value of n, you can set the middle of the timer, you can set the point when it will rise and fall, so because its a endless loop, it will every time set the new value, and you can set the right value.... I dont know if you can understand me what im trying to tell you (it some bit difficult to me to explain this in this way), sorry if you dont understand Here is the sample code, insert some code to make some "borders" in witch the variable can go up and down, dont make it so it can go to endless while (1) { for (i=1;i<=100;i++) { if (i<n) { GPIO_PORTJ_DATA = 255; } else { GPIO_PORTJ_DATA = 0; } }
×