Another method would be to use the rrf function and a number of constant values. if you were to use the code rlf Led1 btfsc LED1,0 bsf PORT..... btfss LED1,0 bcf PORT..... and just load Led1 with different values for different brightness 01010101 would be 50% 01000100 would be 25% 11111111 would be 100% and so on. Paul Harris ----- Original Message ----- From: "Pic Dude" To: Sent: Wednesday, February 27, 2002 8:10 AM Subject: [PIC]: LED brightness control thru PIC... I would like to control the brightness of some LEDs (directly attached to a port on a PIC) thru code. Each LED would be at full bright or dim -- just 2 intensities. Here's what I thought... Assume as some point in the code, I want to set the output to 'ooBoDDBo' where 'o' is Off, 'B' is Bright, and 'D' is Dim. Let V1 = value of port for dim LED's. In this case V1 = '00001100' Let V2 = value of port for bright LED's. In this case V2 = '00100010' Then set V3 1 = V1 OR V2 = 00101110' Now in my code, every time I come around in the main loop, I would alternate the output between V1 and V3. Bright LEDs would get set all the time (both times), and dim LED's would get set only on alternate cycles -- sort of like a pulse-width dimmer. Perhaps I may need to have 3 cycles with V1, V1, V3 depending on relative brightness level, etc. Is this reasonable? Is there an easier/better way to do this? I'll be using a 16F84 or 16F872 for this. Thanks, -Neil. -- 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 -- 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