??? 01/14/05 12:41 Read: times |
#84970 - just the obvious errors Responding to: ???'s previous message |
$INCLUDE(REG517.SRC) intt0: OK, so if this is an interrupt service routine (isr), you must store all registers that are used both in main program and the interrupt. Here, you need to store at least the accumulator, so you need a push acc at the beginning of isr and pop acc at the end of it. It is always a good idea to store also the psw, although not necessary here, as no flags are modified (but I doubt you have considered this). Please, read the tutorial on this site, concentrate on the interrupts section - a lot of good hints for beginners is there. mov tl0,#0feh ;comprobación de teclado cada 0,02sg mov th0,#0ffh First, it might be a good idea to stop the counter prior you change it. Then, setting tl0 while running to -2 means, that the counter rolls over before it hits the next instruction. So you end up with setting th0:tl0 to 0ff00h, which is maybe not what you intended. And, if you would stop the counter and set th0:tl0 to 0fffeh, it would roll over the next instruction after you reenable it (before reti), hence you will have int0 active all the time, allowing for only 1 instruction from the main program to be executed between consecutive timer0 interrupts, which is probably not what you wanted. ... lazo2: mov r0,#30h dec r0 you can do a little optimisation if you wish :-) you can use mov r0,#30h-1 ... busco: inc r0 movx a,@r0 cjne a,digito,busco mov a,r0 mov r2,a ljmp sigue So here you want to end up with a number of pressed key in r2. However, if this works OK, this will give you a result between 30h and 3Ch - are you sure you wanted this? You are processing it furher here: ... ponnota: mov dpsel,#01h mov a,r2 ;meto numero nota en registro movc a,@a+dptr ;apunto a la parte alta de la nota mov cmh7,a inc r2 ;incremento r2 para leer siguiente valor mov a,r2 ;meto r2+1 movc a,@a+dptr ;parte baja nota mov cml7,a inc r2 mov a,r2 movc a,@a+dptr mov ctrelh,a inc r2 mov a,r2 movc a,@a+dptr mov ctrell,a ret which is certainly wrong, as you pick from the table values offset 30h,31h,32h,33h for DO, 31h,32h,33h,34h for DO#, 32h,33h,34h,35h for RE etc. These are only the obvious errors, I did not check, if this would really work on the given processor (and you hardware, which you did not describe at all). Jan Waclawek |
Topic | Author | Date |
How to make a piano | 01/01/70 00:00 | |
Happy to help but... | 01/01/70 00:00 | |
Piano, violin, trumpet ... | 01/01/70 00:00 | |
Not a Piano | 01/01/70 00:00 | |
And not a Violin | 01/01/70 00:00 | |
re: | 01/01/70 00:00 | |
frequencies | 01/01/70 00:00 | |
you could also | 01/01/70 00:00 | |
getting 41.2 Hz out using T2 AutoReload | 01/01/70 00:00 | |
select proper xtal | 01/01/70 00:00 | |
Try higher pitches | 01/01/70 00:00 | |
well.. | 01/01/70 00:00 | |
8 octaves with 16 keys??? | 01/01/70 00:00 | |
What? | 01/01/70 00:00 | |
re: | 01/01/70 00:00 | |
Enough power? | 01/01/70 00:00 | |
to Joseph | 01/01/70 00:00 | |
Software reformated. No changes. | 01/01/70 00:00 | |
How to post code | 01/01/70 00:00 | |
just the obvious errors![]() | 01/01/70 00:00 | |
iguana labs sound tutorial | 01/01/70 00:00 | |
debugging | 01/01/70 00:00 | |
Be more descriptive!! | 01/01/70 00:00 |