/* * File: PUMPE_TASTER_628A.c * Author: J.P.S * * Created on 24.11.2023 */ #include #include #include #pragma config FOSC = INTOSCIO // Oscillator Selection bits (INTOSC oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN) #pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled) #pragma config PWRTE = ON // Power-up Timer Enable bit (PWRT enabled) #pragma config MCLRE = OFF // RA5/MCLR/VPP Pin Function Select bit (RA5/MCLR/VPP pin function is digital input, MCLR internally tied to VDD) #pragma config BOREN = OFF // Brown-out Detect Enable bit (BOD disabled) #pragma config LVP = OFF // Low-Voltage Programming Enable bit (RB4/PGM pin has digital I/O function, HV on MCLR must be used for programming) #pragma config CPD = OFF // Data EE Memory Code Protection bit (Data memory code protection off) #pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off) unsigned char Delay_ms( unsigned int i); char Delay_us( unsigned char i); /* * */ void main(void) { CMCON = 7; PORTA = 0x00; PORTB = 0x00; TRISA = 0x3c; TRISB = 0x0f; while(1) { if(RA2 == 1)PORTB = 0x00,PORTA = 0x02, Delay_ms(200); if(RA3 == 1)PORTB = 0x00,PORTA = 0x01, Delay_ms(200); if(RA4 == 1)PORTB = 0x00,PORTA = 0x80, Delay_ms(200); if(RA5 == 1)PORTB = 0x00,PORTA = 0x40, Delay_ms(200); if(RB0 == 1)PORTA = 0x00,PORTB = 0x80, Delay_ms(200); if(RB1 == 1)PORTA = 0x00,PORTB = 0x40, Delay_ms(200); if(RB2 == 1)PORTA = 0x00,PORTB = 0x20, Delay_ms(200); if(RB3 == 1)PORTA = 0x00,PORTB = 0x10, Delay_ms(200); } }