maryanna
Newbie level 3
- Joined
- May 11, 2014
- Messages
- 3
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 15
hello friends actually i'm facing a big problem with my project,i must find a program that convert 8 analog input into digital;i'm using micrichip 16F877+8 potentiometre+8led+max232+serial
this the code
=>no result please help
- - - Updated - - -
https://obrazki.elektroda.pl/3165609200_1399826539.jpg
this the code
Code:
#include <16F877.h>
#device ADC=10 //N=10 pour le CAN interne
#use delay(clock=20000000) //Horloge à 20 MHz
#fuses HS,NOWDT,NOLVP
//#Défine ALL_ANALOG
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7) //Configuration liaison série
void main()
{
int16 valeur; //Déclaration d'une variable valeur en entier 16 bits
setup_adc_ports(ALL_ANALOG); //Configuration des 8 voies du CAN en analogique
setup_adc(ADC_CLOCK_INTERNAL); //Utilisation de l'horloge interne
set_adc_channel(1); //Utilisation de la voie 1 du micro-contrôleur (broche A1)
while(1) //Boucle infinie
{
valeur=read_adc(); //Lecture de la broche A1, affectation à la variable valeur
output_high(); //send a "1" to pin RB7, making RB7 "High" at 5v
//this will turn on the LED hooked to RB7
delay_ms(500); //wait half a second, delays for 500ms
output_low();
delay_ms(1000); //wait half a second, delays for 500ms
}
}
=>no result please help
- - - Updated - - -
https://obrazki.elektroda.pl/3165609200_1399826539.jpg
Attachments
Last edited by a moderator: