I don't see any real problem with the code. Also I think volatile declarations work the other way around and will not protect you from having to use a shadow register for the type of use you are putting it to. Cheerful regards, Bob On Fri, 21 Mar 2008 16:57:37 -0400, "Peter Todd" > Gotta love compilers... On SDCC 2.6.0 the following: > > LATC = 1 << i; > > Compiled to this: > > ; .line 32; driver.c LATC = 1 << i; > MOVLW 0x01 > MOVWF _LATC > MOVF r0x00, W > BZ _00111_DS_ > NEGF WREG > BCF STATUS, 0 > _00112_DS_: > RLCF _LATC, F > ADDLW > 0x01 > BNC > _00112_DS_ > _00111_DS_: > > Which caused some real strangeness as the hardware connected to LATC was > running at high speed and did not like getting turned on at the wrong > time. I checked the headers too, and LATC is correctly declared > volatile. Setting a temp variable to 1 << i, and then assigning that to > LATC fixed the problem. My copy of SDCC is rather old, 2.8.0 is the > current stable version, but it does show why you need to know assembly. > -- http://www.fastmail.fm - Access your email from home and the web -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist