Discussion in "Project Help" started by    cenadius    Aug 19, 2007.
Sat Sep 01 2007, 12:10 am
#31
well.. everything is possible and is not at all hard to do that i will explain how to do that ok!

all you have to do is.. wait for the key press.. and when a key is pressed.. execute some part of code related to that key.
So when sw2 is pressed it will execute the code for sw2, and set the fan speed, and if you pressed sw3 then it will execute the sw3 code and will set the new fan speed... overriding the old speed set by sw2.
Try to write a code.. to read which key is pressed.. and execute code for that key... PM me the code
 cenadius like this.
Sat Sep 01 2007, 04:29 pm
#32
I saw your code...
there are many mistakes.. i think you have no idea about what interrupts are.. anyways.. i explain you..
its like this..
whenever an interrupt occur, as clear from the name.. it interrupt the current processing of the CPU, and start executing the code which deal with that interrupt, that special part of code is called interrupt routine.
In AT89C51 there are 5 interrupts (2 external, 2 timer and one serial). and specific addresses are assigned to these interrupts in the ROM, which is called Interrupt vector location.
There is one more interrupt which is usually there in all the MCUs, called Reset interrupt and vector location is 00H
so whenever you press a reset button your CPU jumps and start executing from 00H.

This way for.. INT0 - location is 0003H
Timer 0 - 000BH
INT1 - 00013H
Timer 1 - 0001BH
Serial - 00023H

so whenever an interrupt occur it jumps to these location to execute the code.. and the code written in these location is called interrupt service routine. When you return from these routines you cannot use simple RET instruction. you need RETI (return from Interrupt).

In your code.. you are overwriting on location where timer interrupt has to jump. so you need to rearrange your code something like this..

org 0H
sjmp reset

org 0BH
sjmp timer0int

reset:
--- your starting of program---

timer0int:
---the PWM code---


I hope you got my idea.. please try rearranging the code.. so i understand a better way what you did. if i feel anything wrong in the code i will correct it and send you back
 cenadius like this.
Sat Sep 01 2007, 06:02 pm
#33
what is the meaning of pullups?i compile the program,still got error,which is the reset there,from error columm it show say that symbol already defined,what is that mean?symbol defined also an error?
Sat Sep 01 2007, 06:46 pm
#34
mm.. i think lable is written twice..
i did not compile the program. and your program was having lot of errors..

Pullup means.. connect the pin to VCC via 10K resistor...
Sat Sep 01 2007, 07:08 pm
#35
its working properly no error!

Build target 'Target 1'
assembling test.asm...
linking...
Program Size: data=8.0 xdata=0 code=85
creating hex file from "test"...
"test" - 0 Error(s), 0 Warning(s).


which compiler you using?
Sat Sep 01 2007, 09:54 pm
#36
i using Fet89c5x compiler
Sun Sep 02 2007, 12:52 am
#37
well i don't know why it is giving you error.. can you please post the error? in detail?
or if possible download the demo version of Keil.. www.keil.com
because your code will be lesser than 2K limit of demo.. so you can use it...
if you don't want to do that.. then you need to give complete error details.
try to take a screenshot and upload it to www.imageshack.us and post the link here.. i will take a look at the error.
Sun Sep 02 2007, 04:22 pm
#38
Can u give the hint on how to start the 7segment program?The 7segment is needed to show the temperature value sense by sensor in the auto mode in celsius unit.The error link as shown below:
http://img505.imageshack.us/my.php?image=erorkn2.jpg


[ Edited Sun Sep 02 2007, 04:43 pm ]
Sun Sep 02 2007, 04:49 pm
#39
hmm.. ok.. i think i first need to download your assembler and then check what is wrong..
regarding.. 7-segment.. search in the site.. you will get it in the forum..
Mon Sep 03 2007, 06:33 pm
#40
just rename the label RESET with something else.. like main
and it will work.. test it. and tell me the results..

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm
Bernardwarge
Tue Mar 26 2024, 11:15 am