??? 05/25/06 08:04 Modified: 05/25/06 08:26 Read: times |
#117071 - Still doesn't work.. Responding to: ???'s previous message |
It suppose to light a led when the input from the A/D is greater or equal to 101010(bin). the problem is, that the led is light all the time....
the led is named Phone. I changed the code as you said: org 0000h ljmp 0100h AD_OUTPUTS EQU P0 ; DB0 to DB7 AD_CLK BIT P2.3 ; clock AD_ALE BIT P2.4 ; address latch enable: to enable that one of the inputs will start recieving information. AD_OE BIT P2.5 ; output enable PHONE BIT P2.7 ; MICROPHONE AD_SC BIT P2.4 ; start conversion AD_EOC BIT P2.6 ; end of conversion ;;;;;;;;;;;;;;;;;;;;;;;;?????;;;;;;;;;;;;;;;;;;;;;;;; int: ;--INITIALIZE A/D clr AD_OE clr AD_ALE clr AD_CLK lcall START_CONV lcall START_CLK begin: lcall START_CONV lcall compare jmp begin ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;FUNCTIONS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; START_CONV: mov AD_OUTPUTS,#0ffh clr AD_OE ; enabling the A/D send information setb AD_ALE ; start converter [SET both Start Conversion (SC) and Address Latch Enable (ALE)] clr AD_ALE ; start converter [SET both Start Conversion (SC) and Address Latch Enable (ALE)] Ret START_CLK: cpl AD_CLK ;change the clock variable jnb AD_CLK,START_CLK ;if the clock variable is 0, return back and set it to one. if it's one, continue. (was EOC) setb AD_OE mov a,AD_OUTPUTS clr AD_OE ret Compare: CJNE A,#101010b,acc_ne JMP acc_equal acc_ne: jc acc_small jmp acc_large acc_equal: lcall bip ret acc_small: lcall ok ret acc_large: lcall bip ret ok: setb phone ret bip: clr phone ret END |
Topic | Author | Date |
Problem on a code | 01/01/70 00:00 | |
clean up | 01/01/70 00:00 | |
Thanks | 01/01/70 00:00 | |
Still doesn't work.. | 01/01/70 00:00 | |
evidence | 01/01/70 00:00 | |
What about open collector on port 0? | 01/01/70 00:00 | |
Various problems | 01/01/70 00:00 | |
How to post code | 01/01/70 00:00 | |
20 different simulators![]() | 01/01/70 00:00 |