zapollon
Newbie level 3
- Joined
- May 31, 2014
- Messages
- 4
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 35
hello ,
I am new to this forum and I do not speak much anglai, here is my setup is a pic 16f877 connected a variable resistor 2 and 2 and a bargraph LCD 16 * 2 to display the liquid level,
this is my schema
and my program code :
So i need the program code Mikro C for pic to lcd 16*2 please , i need it so help me please
I am new to this forum and I do not speak much anglai, here is my setup is a pic 16f877 connected a variable resistor 2 and 2 and a bargraph LCD 16 * 2 to display the liquid level,
this is my schema
and my program code :
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 unsigned int niv_bac1; unsigned int niv_bac2; unsigned char i,j; unsigned int niveaux[8] = {127, 254, 382, 510, 638, 776, 894, 1022}; unsigned char VnDuNiveau(unsigned int val) { unsigned char i = 0; while (i < sizeof(niveaux)) { if (val < niveaux[i]) return i; else i++; } } void main() { // Configuration des pins 2 et 3 en analogique TRISA = 0xFF; // programmtion du PORTA en entrée TRISB = 0; // programmtion du PORTB en sortie TRISC = 0; // programmtion du PORTC en sortie TRISD = 0; // programmtion du PORTD en sortie OPTION_REG.NOT_RBPU = 0; do { adcon0=0x80; niv_bac1= Adc_Read(0); // lecture du niveau de fluide du bac1 //portB=niv_bac1>>2; //Affichage en binaire du niveau de fluide j= VnDuNiveau(niv_bac1); switch ( j ) { case 0: // Code portB = 0x01; break; case 1: // Code portB = 0x03; break; case 2: // Code portB = 0x07; break; case 3: // Code portB = 0x0F; break; case 4: // Code portB = 0x1F; break; case 5: // Code portB = 0x3F; break; case 6: // Code portB = 0x7F; break; case 7: // Code portB = 0xFF; break; } adcon0=0x88; //du bac1 sur le portB niv_bac2= Adc_Read(1); // lecture du niveau de fluide du bac2 //PORTC = niv_bac2>>2; //Affichage en binaire du niveau de fluide //du bac2 sur le portC j= VnDuNiveau(niv_bac2); switch ( j ) { case 0: // Code portC = 0x01; break; case 1: // Code portC = 0x03; break; case 2: // Code portC = 0x07; break; case 3: // Code portC = 0x0F; break; case 4: // Code portC = 0x1F; break; case 5: // Code portC = 0x3F; break; case 6: // Code portC = 0x7F; break; case 7: // Code portC = 0xFF; break; } } while(1); }
So i need the program code Mikro C for pic to lcd 16*2 please , i need it so help me please
Last edited by a moderator: