??? 07/08/10 18:57 Modified: 07/08/10 19:25 Read: times |
#177164 - So many questions Responding to: ???'s previous message |
Avni Modi said:
zero crossing waveform on CRO is perfect.we are using aassembly language for AT89c2051. If you are already using and oscilloscope it is easy enough to verify if the code is working- Channel one on the zero crossing signal and trigger on that & Channel 2 on P1.3. Is P1.3 going high with the expected delay after every crossing? If yes then the code is alright (at a first iteration) and vice versa. Avni Modi said:
But problem is that triac firing angle is not changed.and voltage comming out is continuous..230v.. How did you measure the voltage. If P1.3 is switching as above, make sure your 'scope is isolated and then check the waveform that the phase angle matches the activation of P1.3. I would bet 50c that your logic on driving the MOC3021 is inverted and you are turning it off when you think you are turning it on. You have given no schematic, so not much more can be guessed. There is no mention of the clock frequency that you are running at even though it is the basis of your timing. On any project of significance you would be far better off using the internal timer/counter so you don't have to count execution cycles and modify the counters any time a code change is needed. As to your code- I can only assume that you are beginners, probably homework- you provide no comments at all! How are we (or your teachers) expected to understand what you are trying to do? This is to say nothing of trying to remember what you did on any project that is more than a few lines. Also you obviously understand what a subroutine is, but have no idea of passing a parameter since you call the delay subroutine multiple times, yet you do not know how to nest loops. Inelegantly you could add the instruction DJNZ R4,DELAY before the RET in the DELAY subroutine. Then each delay period could be initiated by MOV R4,#XX (where XX is the number of mS) followed by a single CALL DELAY instruction. [Added after 5 minutes] There is also no mention if you can simply turn the triac on and off via P1.3 either from a simple program or via an emulator. [Added after 10 minutes] Every engineer that I know would have had a single zero crossing input, and the selection of the phase angle determined by a binary pattern on other input pins. This would mean that the software would have polled for the zero crossing in only one spot and then determined the phase angle based on the binary pattern. In a real piece of software you would want the phase angle to be dynamically adjustable. As it stands your software does not synchronize to the zero crossing very well- it does not detect an edge. Also you look for an exact pattern- Avni Modi said:
STARTTA:MOV A,0B0H
CJNE A,#11111101B,STARTTB what if any of the other pins on the port are at a zero- you will never see the zero crossing condition, to say nothing of the fact that the signal to P3.0, P3.1 and P3.5 is possibly the same signal unless you switch from one to the other externally. |