| ??? 01/08/04 06:55 Read: times |
#62136 - RE: PWM assembly code for 5 PWM signals Responding to: ???'s previous message |
Open wide, here comes the spoon:
dseg
org 040h
pwmreg: ds 5
pwmset0: ds 1
pwmset1: ds 1
pwmset2: ds 1
pwmset3: ds 1
pwmset4: ds 1
cseg
org 0
jmp Init
org 00400h
Init: mov pwmset0,#1
mov pwmset1,#50
mov pwmset2,#100
mov pwmset3,#150
mov pwmset4,#200
Pwm: mov r0,#pwmreg
inc @r0
mov a,@r0
cjne a,pwmset0,$+3
mov p0.0,c
inc r0
inc @r0
mov a,@r0
cjne a,pwmset1,$+3
mov p0.1,c
inc r0
inc @r0
mov a,@r0
cjne a,pwmset2,$+3
mov p0.2,c
inc r0
inc @r0
mov a,@r0
cjne a,pwmset3,$+3
mov p0.3,c
inc r0
inc @r0
mov a,@r0
cjne a,pwmset4,$+3
mov p0.4,c
jmp Pwm
This took me 10 minutes to type. It's quick, dirty, of course it's not been tested, and I haven't even tried to assemble it. In the likely case that you are a lazy student: I provided you with this code for the purpose of getting this message through to you (and other lazy students everywhere). You did not write this, I did. Maybe you have a copy now, but you are still unable to do this yourself. By presenting this code as your own, you will be cheating yourself. If this code gets you a good grade, you will get a good grade for something you are not actually capable of. Because you did not bother to try and write this by yourself, you will not have developed your skills in any way, and after you leave school, you will still be unable to do this on your own steam. I however don't have to worry if I can cope with what people throw at me. I know what I can and can not do, and do not have to lie about it. I don't have to be ashamed of myself. It's up to you how much you can rely on yourself in the future. |



