joynal
Newbie level 6
- Joined
- Apr 2, 2012
- Messages
- 13
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,370
I am using pic12f675 . This IC GP4,GP5 pin is not working.... :???:
anyone solve this coding...
anyone solve this coding...
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 // PIN difine... #define Green_Led GP1_bit #define Yellow_Led GP2_bit #define Blue_Led GP4_bit #define Red_Led GP5_bit int ADC_Value; void main() { //Configuring Microcontroller TRISIO = 0b00000001; GPIO = 0x00; ANSEL = 0b00000001; //0x00; // AN2&AN3 CMCON = 0x07; // Comparator off while(1) { ADC_Value = ADC_Read(0); //Read ADC on Channel 3 delay_ms(100); if(ADC_Value > 0x2A4) // Check for 3.3V { Green_Led = 1; delay_ms(200); Green_Led = 0; delay_ms(200); } if(ADC_Value <= 0x2A4 && ADC_Value > 0x197) // 1.98V > Batt > 3.3V { Yellow_Led = 1; delay_ms(200); Yellow_Led = 0; delay_ms(200); } if(ADC_Value <= 0x197) // Check for Batt V < 1.98V { Blue_Led = 1; Red_Led = 1; delay_ms(200); Blue_Led = 0; Red_Led = 1; delay_ms(200); } }// While }// void main
Last edited by a moderator: