I'm attempting to write some code to interface with a DS1620. I decided to do this the hard way, from scratch, on my own. I figured I might as well dive right in and muck about with everything and see if I can figure it out. After dissecting the timing diagrams for the DS1620, I wrote down the flow of how things are going to occur in the program to communicate with the temperature sensor chip, what to send, how, etc. Then I started converting that into assembly. My main concern, right now, is if there is a significantly better way of what I am doing. The way I scribbled it down, I'm taking the command that needs to be sent to the chip and testing the LSB. If the LSB is 0, I set the pin DQ (Data line) to low, toggle the clock, then go on to the next bit by rotating right. If a 1, I set DQ high, etc. Rinse, lather, repeat until no bits need to be sent. In my mind, this looked like an 'if 0 then send 0 else send 1' to me, but I couldn't figure out a good way of converting this to assembly. I ended up using a 'bit test, skip if set/clear' and a 'bit set/clear' after the appropriate one. It seems so inelegant ... SendCmd BCF PORTA,1 ; Bring CLK low BTFSC ReadCmd,0 ; If bit 0 is set, write a 1 to the BSF PORTA,0 ; DQ line BTFSS ReadCmd,0 ; If bit 0 is clear, write a 0 to the BCF PORTA,0 ; DQ line BSF PORTA,1 ; Bring CLK high to tell temp. sensor ; to read the next bit DECFSZ BitCount,1 ; Decrement count of bits left to send GOTO SendCmd ; If more bits need to be sent ... Oh, um, sorry for writing so much. O.O Thanks for your help, as well! Sabachka -- sabachka@oddmagic.net "Will there be signs?" "Yea, the heavens shall open and the NP-complete solution given forth. ATT executives shall give birth to two-headed operating systems, and copyrights shall be expunged. The voice of the GNU shall be heard, but the faithless will be without transceivers." "There will be signs." -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body