Anthony and alla others, Thank you very much following the tips I got the code working. the 1us delay is't critical,since both signals are feded into a decoder. thanks guys >From: Anthony Fremont >Reply-To: pic microcontroller discussion list >To: PICLIST@MITVMA.MIT.EDU >Subject: Re: [PIC:] simple code question >Date: Wed, 18 Aug 2004 10:04:07 -0500 > >From: "Aslam Jallali" > > > > Hi to every one of you every where > > A Very concrete question: If in the following code I want to clear bit 4 >and > > bit 3 and then call the delay and then set both bit 3 and 4 Basically, > > instead of one pin at the time I want to make two pins high or low How >can > > I do this? > >Depending upon your timing constraints, several different ways. > > > Would simply bcf PORTC, 4,3 work? > >No. > > > Not to waste your time I spare you with the rest just straight to the >loop:) > > ; LED FLASH LOOP > > > > Loop > > bcf PORTC,4 ; RC4 = low = led on > >You could just simply add a "bcf PORTC,3" right here, unless the 1uS >(assuming 4mhz clock) delay is a problem. If you need them to change at >the >same exact time, then change the "bcf PORTC,4" statement above to: > > movlw b'00011000' > andwf PORTC, F > > > call Delay > > > > bsf PORTC,4 ; RC4 = high = led off > >Same as before, either add a "bsf PORTC,3" right here, or change the "bsf >PORTC,4" above to: > > movlw b'00011000' > iorwf PORTC, F > > > call Delay > > goto Loop > >Since you don't seem to be worried about the extra delay added by this >goto, >you could aparently do it either way you choose. I would recommend you go >with the AND's and OR's as I feel that it is more clear (but that's just me >;-) > >Others here will point out that you should probably use "shadow" registers >instead of directly modifying the individual pins on the output port. >Search for RMW (read-modify-write) issues for reasons why. You may also >wish to use an "equ" pseudo-op or "#define" to define the bit mask, that >way >if it ever changes you just have to fix one line in the source and then >re-assemble it, instead of hunting down every place you used the bit mask >and having to fix them one-by-one. > >-- >http://www.piclist.com hint: To leave the PICList >mailto:piclist-unsubscribe-request@mitvma.mit.edu _________________________________________________________________ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics