PDA

View Full Version : how to generate triangular wave.....



kvrajasekar
- 11th September 2008, 11:01
Hi,

Can anyone help me to built a triangular wave using counter(in 16f877).

I am using asm code.Plz guide me.



Regards,
Raja.

eggman
- 11th September 2008, 12:36
use pwm, just ramp up and down with a counter and put a filter on the pin (RC).

kvrajasekar
- 11th September 2008, 12:54
Thanks for ur quick response,

i want fixed amplitude triangle wave of 2.5v,so how can i set a counter to generate the wave.

Plz give me the required steps to do this.


Regards,
Raja.

eggman
- 11th September 2008, 13:05
how about this as an example of a low frequency triangular wave:

loop:

for counter = 0 to 127
hpwm 1,counter,10000
pause 1
next counter

for counter = 127 to 0 step -1
hpwm 1,counter,10000
pause 1
next counter

goto loop

Of course all in PBP, not assembly, but this is a PBP forum as you may have observed.

kvrajasekar
- 11th September 2008, 13:08
Thanks,but i am using assembly language.

mat janssen
- 11th September 2008, 17:03
Than you'v got the wrong forum.
You will need the PIC_assembly forum and not one of the picbasic forum's.

skimask
- 11th September 2008, 18:16
Than you'v got the wrong forum.
You will need the PIC_assembly forum and not one of the picbasic forum's.
That's been said before...
But somebody doesn't heed advice well...
Not that assembly isn't spoken here obviously, but it's spoken so much more elsewhere.