OK, fine! :-) Ports are "working" then. Then over to the other ones. I probably have 690 code where I do this (the 690 is/was popular since it was included in the PICkit2 Start kit). No time right now, maybe later this evening... /Jan-Erik. Richard R. Pope wrote 2014-08-06 15:49: > Jan-Erik, > That is what I am doing right now. Ok! I have the Reset and Gate > pins working. I commented out the delay calls and the other commands. > The only thing that I am doing right now is just turning the Reset and > the Gate on and off. I have two square waves running at 571KHz. This is > correct. So it is the 16F690 Timer1 and interrupt code that I can't get > working. > Thanks, > rich! > > This is from the datasheet. > PORTC 0b76543210 these are the pins. > 0b00001000 this is DP1. > 0b00001010 this is DP1 and Reset. > 0b00001001 this is DP1 and Gate. > > On 8/6/2014 7:31 AM, Jan-Erik Soderholm wrote: >> 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. >> >> /* 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; >> >> // 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) >> { >> count =3D 0; // Reset the timer interrupt counter >> while(count < time) >> { >> int i =3D 0; >> int j =3D 0; >> for (i =3D 0; i <=3D 20000; i++) >> for (j=3D0; j <=3D 10000; j++); >> count++; >> } >> return; >> } >> --=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 .