Nantes Université

Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 8e3aaf44 rédigé par Leo LEMAIRE's avatar Leo LEMAIRE
Parcourir les fichiers

eval

parent bca36cbb
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 102495 ajouts et 0 suppression
#
# There exist several targets which are by default empty and which can be
# used for execution of your targets. These targets are usually executed
# before and after some main targets. They are:
#
# .build-pre: called before 'build' target
# .build-post: called after 'build' target
# .clean-pre: called before 'clean' target
# .clean-post: called after 'clean' target
# .clobber-pre: called before 'clobber' target
# .clobber-post: called after 'clobber' target
# .all-pre: called before 'all' target
# .all-post: called after 'all' target
# .help-pre: called before 'help' target
# .help-post: called after 'help' target
#
# Targets beginning with '.' are not intended to be called on their own.
#
# Main targets can be executed directly, and they are:
#
# build build a specific configuration
# clean remove built files from a configuration
# clobber remove all built files
# all build all configurations
# help print help mesage
#
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
# .help-impl are implemented in nbproject/makefile-impl.mk.
#
# Available make variables:
#
# CND_BASEDIR base directory for relative paths
# CND_DISTDIR default top distribution directory (build artifacts)
# CND_BUILDDIR default top build directory (object files, ...)
# CONF name of current configuration
# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
# CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
# CND_PACKAGE_NAME_${CONF} name of package (current configuration)
# CND_PACKAGE_PATH_${CONF} path to package (current configuration)
#
# NOCDDL
# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
RANLIB=ranlib
# build
build: .build-post
.build-pre:
# Add your pre 'build' code here...
.build-post: .build-impl
# Add your post 'build' code here...
# clean
clean: .clean-post
.clean-pre:
# Add your pre 'clean' code here...
# WARNING: the IDE does not call this target since it takes a long time to
# simply run make. Instead, the IDE removes the configuration directories
# under build and dist directly without calling make.
# This target is left here so people can do a clean when running a clean
# outside the IDE.
.clean-post: .clean-impl
# Add your post 'clean' code here...
# clobber
clobber: .clobber-post
.clobber-pre:
# Add your pre 'clobber' code here...
.clobber-post: .clobber-impl
# Add your post 'clobber' code here...
# all
all: .all-post
.all-pre:
# Add your pre 'all' code here...
.all-post: .all-impl
# Add your post 'all' code here...
# help
help: .help-post
.help-pre:
# Add your pre 'help' code here...
.help-post: .help-impl
# Add your post 'help' code here...
# include project implementation makefile
include nbproject/Makefile-impl.mk
# include project make variables
include nbproject/Makefile-variables.mk
/*
* File: Q6.c
* Author: e208835u
*
* Created on 25 mai 2023, 10:24
*/
#include "conf.h"
#include <xc.h>
unsigned int res_r;
void __interrupt()isr(void) {
if(PIR1bits.ADIF){ // interuption sur resultat d'ADC
res_r = (unsigned int)(ADRESH << 8 | ADRESL);
PIR1bits.ADIF = 0;
}
}
void main(void) {
serialInit();
ADREFbits.NREF = 0; // ref negative a la masse
ADREFbits.PREF = 0; // reference positive a Vcc
ADPCHbits.PCH = 0b010001; // channel = RC1
TRISCbits.TRISC1 = 1; // RC1 en HZ
ADCON0bits.CONT = 1; // ADC en mode continu
ADCON0bits.CS = 1; // clock de l'ADC sur FRC
ADCON0bits.FM = 1; // resultats de l'ADC alignes droite
ADCON0bits.ON = 1; // activation de l'ADC
ADCON0bits.GO = 1; // demarrage de la lecture
PIE1bits.ADIE = 1; // activation de l'interuption sur resultat d'ADC
INTCONbits.PEIE = 1; // activation des interuption de peripherique
INTCONbits.GIE = 1; // activation des interuption generales
TRISCbits.TRISC0 = 0;
TRISCbits.TRISC3 = 0;
TRISCbits.TRISC4 = 0;
ANSELCbits.ANSC0 = 0;
ANSELCbits.ANSC3 = 0;
ANSELCbits.ANSC4 = 0;
WPUCbits.WPUC0 = 0;
WPUCbits.WPUC3 = 0;
WPUCbits.WPUC4 = 0;
while(1){
PORTCbits.RC0 = (res_r <= 1106);
PORTCbits.RC3 = (res_r > 1106 && res_r <= 1365);
PORTCbits.RC4 = (res_r > 1365);
unsigned int mV = 8 * res_r / 10;
unsigned int R = 10000L * mV / (3300 - mV);
char buf[64];
sprintf(buf, "V = %u mV; R = %u Ohm \n", mV, R);
serialDispString(buf);
}
return;
}
/*
* File: Q6.c
* Author: e208835u
*
* Created on 25 mai 2023, 10:24
*/
#include "conf.h"
#include <xc.h>
unsigned int res_r;
void __interrupt()isr(void) {
if(PIR1bits.ADIF){ // interuption sur resultat d'ADC
res_r = (unsigned int)(ADRESH << 8 | ADRESL);
PORTCbits.RC0 = !LATCbits.LATC0;
PIR1bits.ADIF = 0;
}
}
void main(void) {
serialInit();
ADREFbits.NREF = 0; // ref negative a la masse
ADREFbits.PREF = 0; // reference positive a Vcc
ADPCHbits.PCH = 0b010001; // channel = RC1
TRISCbits.TRISC1 = 1; // RC1 en HZ
ADCON0bits.CONT = 1; // ADC en mode continu
ADCON0bits.CS = 1; // clock de l'ADC sur FRC
ADCON0bits.FM = 1; // resultats de l'ADC alignes droite
ADCON0bits.ON = 1; // activation de l'ADC
ADCON0bits.GO = 1; // demarrage de la lecture
PIE1bits.ADIE = 1; // activation de l'interuption sur resultat d'ADC
INTCONbits.PEIE = 1; // activation des interuption de peripherique
INTCONbits.GIE = 1; // activation des interuption generales
TRISCbits.TRISC0 = 0;
TRISCbits.TRISC3 = 0;
TRISCbits.TRISC4 = 0;
ANSELCbits.ANSC0 = 0;
ANSELCbits.ANSC3 = 0;
ANSELCbits.ANSC4 = 0;
WPUCbits.WPUC0 = 0;
WPUCbits.WPUC3 = 0;
WPUCbits.WPUC4 = 0;
while(1){
unsigned int mV = 8 * res_r / 10;
unsigned int R = 10000L * mV / (3300 - mV);
char buf[64];
sprintf(buf, "V = %u mV; R = %u Ohm \n", mV, R);
serialDispString(buf);
}
return;
}
/*
* File: Q4.c
* Author: e208835u
*
* Created on 25 mai 2023, 10:03
*/
#define _XTAL_FREQ 4000000
#include "conf.h"
#include <xc.h>
void main(void) {
TRISCbits.TRISC0 = 0;
TRISCbits.TRISC3 = 0;
TRISCbits.TRISC4 = 0;
ANSELCbits.ANSC0 = 0;
ANSELCbits.ANSC3 = 0;
ANSELCbits.ANSC4 = 0;
WPUCbits.WPUC0 = 0;
WPUCbits.WPUC3 = 0;
WPUCbits.WPUC4 = 0;
unsigned char ind = 0;
while(1){
__delay_ms(500);
switch(ind){
case 0:
PORTCbits.RC4 = 0;
PORTCbits.RC0 = 1;
break;
case 1:
PORTCbits.RC0 = 0;
PORTCbits.RC3 = 1;
break;
case 2:
PORTCbits.RC3 = 0;
PORTCbits.RC4 = 1;
break;
}
ind++;
ind %= 3;
}
return;
}
/*
* File: Q6.c
* Author: e208835u
*
* Created on 25 mai 2023, 10:24
*/
#include "conf.h"
#include <xc.h>
void main(void) {
serialInit();
ADREFbits.NREF = 0; // ref negative a la masse
ADREFbits.PREF = 0; // reference positive a Vcc
ADPCHbits.PCH = 0b010001; // channel = RC1
TRISCbits.TRISC1 = 1; // RC1 en HZ
ADCON0bits.CONT = 0; // ADC en mode one-shot
ADCON0bits.CS = 1; // clock de l'ADC sur FRC
ADCON0bits.FM = 1; // resultats de l'ADC alignes droite
ADCON0bits.ON = 1; // activation de l'ADC
while(1){
ADCON0bits.GO = 1; // lancement d'une lecture
while(ADCON0bits.GO) ; // attente du resultat
unsigned int res_r = (unsigned int)(ADRESH << 8 | ADRESL);
unsigned int mV = 8 * res_r / 10;
unsigned int R = 10000L * mV / (3300 - mV);
char buf[64];
sprintf(buf, "V = %u mV; R = %u Ohm \n", mV, R);
serialDispString(buf);
}
return;
}
/*
* File: Q6.c
* Author: e208835u
*
* Created on 25 mai 2023, 10:24
*/
#include "conf.h"
#include <xc.h>
void main(void) {
serialInit();
ADREFbits.NREF = 0; // ref negative a la masse
ADREFbits.PREF = 0; // reference positive a Vcc
ADPCHbits.PCH = 0b010001; // channel = RC1
TRISCbits.TRISC1 = 1; // RC1 en HZ
ADCON0bits.CONT = 0; // ADC en mode one-shot
ADCON0bits.CS = 1; // clock de l'ADC sur FRC
ADCON0bits.FM = 1; // resultats de l'ADC alignes droite
ADCON0bits.ON = 1; // activation de l'ADC
TRISCbits.TRISC0 = 0;
TRISCbits.TRISC3 = 0;
TRISCbits.TRISC4 = 0;
ANSELCbits.ANSC0 = 0;
ANSELCbits.ANSC3 = 0;
ANSELCbits.ANSC4 = 0;
WPUCbits.WPUC0 = 0;
WPUCbits.WPUC3 = 0;
WPUCbits.WPUC4 = 0;
while(1){
ADCON0bits.GO = 1; // lancement d'une lecture
while(ADCON0bits.GO) ; // attente du resultat
unsigned int res_r = (unsigned int)(ADRESH << 8 | ADRESL);
PORTCbits.RC0 = (res_r <= 1106);
PORTCbits.RC3 = (res_r > 1106 && res_r <= 1365);
PORTCbits.RC4 = (res_r > 1365);
char buf[64];
sprintf(buf, "%u \n", res_r);
serialDispString(buf);
}
return;
}
Ce diff est replié.
Ce diff est replié.
build/default/production/Q10.p1: \
Q10.c \
conf.h
Ce diff est replié.
Ce diff est replié.
build/default/production/Q11.p1: \
Q11.c \
conf.h
Ce diff est replié.
Ce diff est replié.
build/default/production/Q4.p1: \
Q4.c \
conf.h
Ce diff est replié.
Ce diff est replié.
build/default/production/Q6.p1: \
Q6.c \
conf.h
Ce diff est replié.
Ce diff est replié.
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter