Make a short (the shortest possible) test prog and get the pins working. Then change your application accordingly. There is a lot in the posted code that has nothing to do with setting the pins. Noone wants to read that. Remove interrupt, timers and so on. This is simple fault tracing. Simplify until the problem is clear. Regards, Jan-Erik. Richard R. Pope wrote 2014-08-06 14:10: > Hello all, > First I want to apologize to everyone on the list. I am sorry. I know > that I can be an opinionated, stubborn, know it all. My intent is not to > annoy, irritate, or make anyone mad. I'm just trying to learn, help, and > have fun. So please forgive me and tolerate my personally. If I irritate > you or get out of line please just tell me? It won't bother me at all. > I'm trying to be a good member. > I have decided to switch over to a 16F690 because it has more pins. > In MpSim I can see the pins switching but in real life it isn't > happening. The reset pin is on RC1, pin 15. The Gate is on RC0, pin 16. > DP1 is on RC3, pin 7. Help! Please! I'm not worried about the proper > timing at this point. I just want to get those three pins working. The > crystal is running at about 16MHz. > I have read the datasheet and done research on the Internet. I > still can't get it. > Thanks, > rich! > > Here is the listing: > > // Includes go here > #include > #include > > // Prototypes go here > int main(void); > void delay(int time); > void resettimer(void); > void InitTimer1(void); > void ReadTBSwitch(void); > void DebounceButton(int button); > > /*Richard R. Pope > 07-19-14 > */ > > #pragma config FOSC =3D HS, WDTE =3D OFF, PWRTE =3D ON, MCLRE =3D OFF \ > CP =3D OFF, CPD =3D OFF, BOREN =3D OFF, IESO =3D OFF, FCMEN =3D OFF > > /* Crystal Freq =3D 16MHz. > Gate is on RC0, pin 16, Reset is on RC1, pin 15, DP1 is on RC3, pin 7, > DP2 is on RC4, pin 6, DP3 is on RC5, pin 5. The TimeBase Switch will be > connected to RB4 and RB5, pins 13 and 12 respectively. The DisplayTime > pot will be connected to AN2, pin 17. */ > > // Global variables > int count =3D 0; // number of interrupts counter > > int main(void) > { > > PORTA =3D 0b00000000; // Turn PortA off > TRISA =3D 0b11111111; // Set PortA as all Inputs > PORTB =3D 0b00000000; > TRISB =3D 0b11111111; > PORTC =3D 0b00001000; // Set RC3 to high > TRISC =3D 0b11000100; // Start with DP1 on, the rest of > // portc is inputs > CM1CON0 =3D 0b00000000; // Turn off Comparators > CM2CON0 =3D 0b00000000; > ANSEL =3D 0b00000100; // Set RA2/AN2 as analog > ANSELH =3D 0b00000001; > VRCON =3D 0b00000000; > InitTimer1(); // Set up the timer > > // Define commands > // PORTC xx543210 5=3DReset, 4=3DGate, 1=3DDP1 > int DP =3D 0b00001000; //The decimal points are counted from 1 > int Reset =3D 0b00000010 + DP; // Turn on RC1 > int GateOn =3D 0b00000001 + DP; // Turn on RC0 > int GateOff =3D DP; // Leave only the DP on > int GateTime =3D 1000; // The gate time =3D 1 Second > int DisplayTime =3D 5000; // The display time =3D 5 seconds > int TwentyMS =3D 20; // Holds the value for a 20mS delay > > while (1 =3D=3D 1) // Loop forever > { > PORTC =3D Reset; // Clear the Display > PORTC =3D GateOn; // Start counting > delay(GateTime); // Count the frequency for one second =3D HZ > PORTC =3D GateOff; > delay(DisplayTime); // Display the frequency for 15 seconds > ReadTBSwitch(); > } > } // End NewControlCode.c > > void delay(int time) > { > TMR1ON =3D 0; // Turn the timer off > TMR1IE =3D 0; // Disable timer interrupts > count =3D 0; // Reset the timer interrupt counter > TMR1IE =3D 1; // Enable the timer interrupts > TMR1ON =3D 1; // Turn the timer on > > while(count < time) > { > } > return; > } > > void ReadTBSwitch(void) > { > int Button =3D 0; > =09 > DebounceButton(Button); > return; > } > > void DebounceButton(int Button) > { > return;=09 > } > > void resettimer(void) > { > //TMR1H =3D 0xCF; // Reset the timer to roll over > //TMR1L =3D 0x48; //at 100mS > TMR1H =3D 0xFB; // Reset the timer to roll over > TMR1L =3D 0x24; //at 1mS =09 > } > //Timer1 > //Prescaler 1:8; TMR1 Preload =3D 64292 for 1 mS and 53064 for 100 ms > > //Place/Copy this part in declaration section > > void InitTimer1(void) > { > T1CON =3D 0x31; > TMR1IF =3D 0; > TMR1IE =3D 1; > INTCON =3D 0xC0; > GIE =3D 1; > INTEDG =3D 1; > } > > void interrupt MyISR(void) > { > if (TMR1IF){ > TMR1IF =3D 0; > resettimer(); > count++; > } > } > --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .