Gordon, I've sent you an excel spreadsheet under separate cover in oorder to not post a big attachemtn to the list. Here is the idea: Teach Excel to do some of your work for you. The spreadsheet does the following: 1. Calculates 1/F, 1/F / 2, and converts it to microseconds, which is the same as machine cycles in a 4mHz PIC. 2. Formats this info into an array: int16 freqlookup[] = { 625, 588, etc etc }; << All this tedious symtax is generated inside Excel 3. Now cut and paste the array into your C code 4. Place it in a constant table like this: BYTE CONST freqlookup[] = { 625, 588, etc etc }; warning, this works in CCS C, may not in Hitech 5. Use it in your code like this: freqlookup[5]; 6. Stuff this number into a timer preset, say you are using timer2, preset Timer2 with 65535 - freqlookup[x], where x is incremented each timer interrupt. This is all off the top of my head, YMMV. --Lawrence ----- Original Message ----- From: "Gordon Varney" To: Sent: Wednesday, June 05, 2002 3:37 PM Subject: [PIC]: incrementing in steps > I need a pin to clock out a square wave at 800Hz. Simple, just set pin high for 625us, set pin low for 625us, and > repeat. > > Now I need to increment the clock frequency by 50Hz, do some work and increment by 50Hz again, continue incrementing > until complete. The step duration in a time period is not a constant. What is the best method to incrementing the > frequency by 50Hz. > > (Note: I am using a combination of Assembly and the CCS compiler for this program.) > > Gordon Varney > www.iamnee.com > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu