- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hi i am having problem in generating different duty cycles of PWM. can somebody check my code and tell what is wrong. well code is generating a duty cycle but it does not change it automatically as the code says. plz help
링크가 복사됨
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Your case(counter[15:0]) statement only covers 256 out of 65536 possibilities. I'm sure that's not what you intended.
Have you simulated this? I suspect not. I can see immediately what's wrong having done so and that your 'duty_cycle' value never 'appears' to change. It does change, but it always ends up at the same value for 65280/65536 of the time. (65280 = 65536-256) Cheers, Alex- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
yes i tested this one using altera DE2 board. and even i changed the size of counter to [7:0] from [15:0] but it still gives me only one duty cycle and this time it is little distorted. i use GPIO pins one positive and one negative to directly connected to scope. is there any problem with my code?
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
this takes only one duty cycle the first one it does not switch to other as clock proceed.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
So you've 'tested' it but you haven't simulated it - is that right?
Try simulating your code - like I did. The problem will be much clearer when you're looking at the behaviour of your code and not just the resulting output signal. Once again simulate your code! Make sure you're happy with the simulation before you even try it on hardware. Cheers, Alex hint: perhaps try counter[15:8] - (not the whole solution but a start...)- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
having problem in simulation output shows red line. i think i have problem calling the components. which components should it include the test bench module pwm or wave.
help!!! there is really no time- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Make sure all your variables/registers are initialized at the start of simulation.
Cheers, Alex- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
thanks it's works, but i haven't understand why it is not picking up with counter[0:7], i think there is a relationship between the counter and the period. as i go from [15:8] to [14:7] and so on the period is increasing. is it so. does the range depends on MSB(most significant bit) to LSB(least significant bit). is there any relationship between these???
yes thanks for the guide- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Yes, there must be a "relationship between these" - and the frequency is clearly dependent on which bits you select, as you've seen. I suggest you keep playing around with it - I'm sure you can work out the relationship for yourself.
Cheers, Alex- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
thanks for the help sir, it works now i will be back soon with a new problem
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
--- Quote Start --- yes i tested this one using altera DE2 board. and even i changed the size of counter to [7:0] from [15:0] but it still gives me only one duty cycle and this time it is little distorted. i use GPIO pins one positive and one negative to directly connected to scope. is there any problem with my code? --- Quote End --- how were you able to connect the GPIO pins to a scope? and how to assign pins from the code to the GPIO pins? can you please share a picture of the hardware setup?
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
I use quartus and you have to set it in pin assignments not in the code. you can download the file from internet be sure it is in csv format.
