136 ADCON0bits.ACONV = 0;
137 ADCON0bits.ACSCH = 0;
140 ADCON1bits.FIFOEN = 0;
191 unsigned char temperature;
260 OpenTimer2 (TIMER_INT_OFF & T2_PS_1_16 & T2_POST_1_1);
272 if (modality ==
LAP) {
275 PWMCON0 = 0b00110000;
288 PTCON1bits.PTEN = 0x01;
306 PTPERL = (
unsigned char) (period & 0x00FF);
307 PTPERH = (
unsigned char) ((period & 0xFF00) >> 8);
317 PDC0L = (
unsigned char) (duty_cycle & 0x00FF);
318 PDC0H = (
unsigned char) ((duty_cycle & 0xFF00) >> 8);
328 PDC1L = (
unsigned char) (duty_cycle & 0x00FF);
329 PDC1H = (
unsigned char) ((duty_cycle & 0xFF00) >> 8);
352 DC_motor_wanted_speed = speed;
360 SetDCPWM1 (DC_motor_wanted_speed);
367 SetDCPWM2(DC_motor_wanted_speed);
374 SetDCPWM1 (DC_motor_wanted_speed);
379 SetDCPWM2(DC_motor_wanted_speed);
427 DC_motor_wanted_speed = speed;
434 SetDCPWM1 (DC_motor_wanted_speed);
441 SetDCPWM2(DC_motor_wanted_speed);
448 SetDCPWM1 (DC_motor_wanted_speed);
453 SetDCPWM2(DC_motor_wanted_speed);
564 signed char initialize_RS485 (
unsigned char baud_rate,
unsigned char rx_interrupt_enable,
unsigned char tx_interrupt_enable) {
575 OpenUSART( tx_interrupt_enable &
576 rx_interrupt_enable &
584 RCSTAbits.CREN = 0x01;
587 PIE1bits.RCIE = 0x01;
659 unsigned char convertedInt [6];
662 unsigned char index = 0;
665 itoa ((
unsigned char*) convertedInt, value,10);
667 if (number_of_digits >0 ) {
669 convertedInt[number_of_digits] =
'\0';
672 while (!(convertedInt[number_of_digits-1] <=
'9' && convertedInt[number_of_digits-1] >=
'0')){
674 for (index = number_of_digits-1; index > 0; index--){
675 convertedInt[index] = convertedInt[index-1];
676 convertedInt[index-1] =
' ';
683 putsUSART (convertedInt);
703 unsigned char dip_switch = 0;
726 static int ADC_buffer_reading;
730 ADCON0bits.GO_DONE = 1;
732 while (ADCON0bits.GO_DONE);
734 ADC_buffer_reading = (int) ADRESH;
735 ADC_buffer_reading = ADC_buffer_reading << 2;
736 ADC_buffer_reading = ADC_buffer_reading + (int) (ADRESL >> 6);
738 return (ADC_buffer_reading);
748 ADCON0bits.ACMOD0 = 0;
749 ADCON0bits.ACMOD1 = 1;
763 ADCON0bits.ACMOD0 = 1;
764 ADCON0bits.ACMOD1 = 1;
778 ADCON0bits.ACMOD0 = 0;
779 ADCON0bits.ACMOD1 = 0;
793 ADCON0bits.ACMOD0 = 1;
794 ADCON0bits.ACMOD1 = 0;
814 ADCON0bits.ACMOD0 = 0;
815 ADCON0bits.ACMOD1 = 0;
822 ADCON0bits.ACMOD0 = 1;
823 ADCON0bits.ACMOD1 = 0;
856 OpenTimer2 (TIMER_INT_OFF & T2_PS_1_16 & T2_POST_1_1);
1067 T0CONbits.T016BIT = 0;
1075 T0CONbits.T0PS0 = 1;
1076 T0CONbits.T0PS1 = 0;
1077 T0CONbits.T0PS2 = 0;
1080 INTCONbits.TMR0IE = 1;
1084 INTCON2bits.TMR0IP = 0;
1087 INTCON2bits.TMR0IP = 1;
1091 T0CONbits.TMR0ON = 1;
1103 INTCONbits.INT0IE = 0x01;
1140 INTCONbits.RBIE = 1;
1142 INTCON2bits.RBIP = 1;
1156 INTCONbits.GIEH = 1;
1158 INTCONbits.GIEL = 1 ;
1165 INTCONbits.GIEH = 0;
1167 INTCONbits.GIEL = 0 ;