At 22:07 07.7.1997 EST, you wrote: >Easy Question (for you pro's): I want to read a non-interrupt driven >port on a PIC16C74 and detect a rising or falling edge. Any ideas on >the best way to implement this? I'm quite the rookie here -this is >my first design. Reasoning tells me to : > > Read the port > Store it's value > Read it again > Compare the values > >If the values are different - i've detected the edge change. Does >this make sense? How could I implement this in C? > >Thanks - > > Hi Daniel, u can try this: loop movf last,w ; load last port value movwf work ; move it to work register movf port,w ; load port value movwf last ; move to last register xorwf work,f ; exlusive OR port value with last port value ; compare is done, last port status is stored ; btfsc status,z ; goto loop ; if no change, go to loop btfsc work,0 goto do_0 ; if port,0 is changed do 0 btfsc work,1 goto do_1 ; if port,1 is changed do 1 ..... goto loop ; port is not changed, go to begining do_0 ...... goto loop ; 0 is done, go to begining do_1 ...... goto loop ; 1 is done, go to begining Cheers, Chris B.