cancel
Showing results for 
Search instead for 
Did you mean: 

wait instruction

mariodettorre
Associate II
Posted on July 17, 2003 at 13:07

wait instruction

3 REPLIES 3
mariodettorre
Associate II
Posted on July 16, 2003 at 13:38

I have a software problem with wait instruction; I use wait to freeze the ST6 during AD conversion, but i fall low a pin before start of conversion and raise it after wait instruction. THe pin is configured in output open drain

The piece of code is

res 0, copy_portb

ld a,copy_portb

ld port_b,a ;Pb0 high

ld adcr,.............. ;start of converision

wait

nop

nop

set 0, copy_portb

ld a,copy_portb

ld port_b,a ;pb0 low

I suppose that Pb0 remains low until ad conversion and ad interrupt treatment terminate, but from oscilloscope measurements result to me that after Pb0 goes low then immediately goes high and remains high then goes low again after ~ 100 us and immediately goes high again.

So my question is if is possible that the wait instruction set the pin in high impedance mode, or something like this, that generate a high level.

thanks in advance

Mario d'ettorre

simonharrison9
Associate II
Posted on July 17, 2003 at 08:27

Hi,

are you changing the OR or DR to select the ADC channel?

If you are using thr DR, you will be leaving OR high, which will create spurious interrupts.

Leave the DR bit high and take the OR bit high to select the channel, take the bit low to deselect the channel.

Hope this helps,

Simon

[ This message was edited by: sjh on 12-11-2003 16:19 ]
mariodettorre
Associate II
Posted on July 17, 2003 at 13:07

I select a static I/O configuration at start of program, so i don't change the OR register in the rest of program