kvsa
Newbie level 4
- Joined
- Oct 8, 2013
- Messages
- 6
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 45
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Hi, I develop a small project Using Pic microcontroller 16F676 i need the 'C' code for that.
In my hardware Pic 16f676 is used
RC5 is Input 1
RC4 is Input 2
RC0 is Output 1
RC1 is Output 2
I used internal oscillator in Pic 16f676
Sequence
Initially some delay time to start this operation
RC5 gets a input signal, Output RC0 enable (some delay for holding)
Interlock between this two operation
RC4 gets a input signal, Output RC1 enable (some delay for holding)
This cycle is continuous operation
Can you help me to develop the 'C' Code this sequence
By kvs
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 #include<htc.h> #define _XTAL_FREQ 20000000 // your xtal frequency in hz //configurations according to operation void main() { TRISC = 0b01100011; __delay_ms(100); while(1) { if (RC5 == 1 && RC6 == 0) // with interlock { RC0 = 1; } else if(RC6 == 1 && RC5 == 0) // with interlock { RC1 = 1; } else // if both inputs or high or low no output { RC0 = 0; RC1 = 0; } } }
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 //configurations as per your req... void main() { TRISC = 0b01100011; while(1) { if(RC5 && !RC6) { RC0 = 1; RC1 = 0; //Holding delay... } else if(!RC5 && RC6 ) { RC0 = 0; RC1 = 1; //Holding delay } else { RC0 = 0; RC1 = 0; } } }
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 //configurations as per your req... void main() { TRISC = 0b01100011; while(1) { if(RC5 == 1) RC0 = 1; else if(RC6 == 1) RC1 = 1; } }