Vad är det som jag missförstår.
Försöker även toggla en pinne för att se om det lever men det verkar stå helt still. Vad har jag missat?
MAIN
Kod: Markera allt
#include <xc.h>
#include "mcc_generated_files/mcc.h"
void main(void) {
while(1){
LATBbits.LATB1=1;
__delay_ms(100);
LATBbits.LATB1=0;
__delay_ms(100);
}
}
PIN MANAGER FILE
Kod: Markera allt
#include "pin_manager.h"
void PIN_MANAGER_Initialize(void)
{
/**
LATx registers
*/
LATA = 0x00;
LATB = 0x00;
LATC = 0x00;
/**
TRISx registers
*/
TRISA = 0x7E;
TRISB = 0x41;
TRISC = 0x81;
/**
ANSELx registers
*/
ANSELC = 0x00;
ANSELB = 0x80;
ANSELA = 0x46;
/**
WPUx registers
*/
WPUE = 0x00;
WPUB = 0x00;
WPUA = 0x00;
WPUC = 0x00;
/**
RxyI2C registers
*/
RB1I2C = 0x00;
RB2I2C = 0x00;
RC3I2C = 0x00;
RC4I2C = 0x00;
/**
ODx registers
*/
ODCONA = 0x00;
ODCONB = 0x00;
ODCONC = 0x00;
/**
SLRCONx registers
*/
SLRCONA = 0xFF;
SLRCONB = 0xFF;
SLRCONC = 0xFF;
/**
INLVLx registers
*/
INLVLA = 0xFF;
INLVLB = 0xFF;
INLVLC = 0xFF;
INLVLE = 0x08;
Kod: Markera allt
// Configuration bits: selected in the GUI
// CONFIG1L
#pragma config FEXTOSC = OFF // External Oscillator Selection->Oscillator not enabled
#pragma config RSTOSC = HFINTOSC_1MHZ // Reset Oscillator Selection->HFINTOSC with HFFRQ = 4 MHz and CDIV = 4:1
// CONFIG1H
#pragma config CLKOUTEN = OFF // Clock out Enable bit->CLKOUT function is disabled
#pragma config PR1WAY = ON // PRLOCKED One-Way Set Enable bit->PRLOCK bit can be cleared and set only once
#pragma config CSWEN = ON // Clock Switch Enable bit->Writing to NOSC and NDIV is allowed
#pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable bit->Fail-Safe Clock Monitor disabled
// CONFIG2L
#pragma config MCLRE = EXTMCLR // MCLR Enable bit->If LVP = 0, MCLR pin is MCLR; If LVP = 1, RE3 pin function is MCLR
#pragma config PWRTS = PWRT_OFF // Power-up timer selection bits->PWRT is disabled
#pragma config MVECEN = OFF // Multi-vector enable bit->Interrupt contoller does not use vector table to prioritze interrupts
#pragma config IVT1WAY = ON // IVTLOCK bit One-way set enable bit->IVTLOCK bit can be cleared and set only once
#pragma config LPBOREN = OFF // Low Power BOR Enable bit->ULPBOR disabled
#pragma config BOREN = SBORDIS // Brown-out Reset Enable bits->Brown-out Reset enabled , SBOREN bit is ignored
// CONFIG2H
#pragma config BORV = VBOR_2P45 // Brown-out Reset Voltage Selection bits->Brown-out Reset Voltage (VBOR) set to 2.45V
#pragma config ZCD = OFF // ZCD Disable bit->ZCD disabled. ZCD can be enabled by setting the ZCDSEN bit of ZCDCON
#pragma config PPS1WAY = ON // PPSLOCK bit One-Way Set Enable bit->PPSLOCK bit can be cleared and set only once; PPS registers remain locked after one clear/set cycle
#pragma config STVREN = ON // Stack Full/Underflow Reset Enable bit->Stack full/underflow will cause Reset
#pragma config DEBUG = OFF // Debugger Enable bit->Background debugger disabled
#pragma config XINST = OFF // Extended Instruction Set Enable bit->Extended Instruction Set and Indexed Addressing Mode disabled
// CONFIG3L
#pragma config WDTCPS = WDTCPS_31 // WDT Period selection bits->Divider ratio 1:65536; software control of WDTPS
#pragma config WDTE = OFF // WDT operating mode->WDT Disabled; SWDTEN is ignored
// CONFIG3H
#pragma config WDTCWS = WDTCWS_7 // WDT Window Select bits->window always open (100%); software control; keyed access not required
#pragma config WDTCCS = SC // WDT input clock selector->Software Control
// CONFIG4L
#pragma config BBSIZE = BBSIZE_512 // Boot Block Size selection bits->Boot Block size is 512 words
#pragma config BBEN = OFF // Boot Block enable bit->Boot block disabled
#pragma config SAFEN = OFF // Storage Area Flash enable bit->SAF disabled
#pragma config WRTAPP = OFF // Application Block write protection bit->Application Block not write protected
// CONFIG4H
#pragma config WRTB = OFF // Boot Block Write Protection bit->Boot Block not write-protected
#pragma config WRTC = OFF // Configuration Register Write Protection bit->Configuration registers not write-protected
#pragma config WRTD = OFF // Data EEPROM Write Protection bit->Data EEPROM not write-protected
#pragma config WRTSAF = OFF // SAF Write protection bit->SAF not Write Protected
#pragma config LVP = OFF // Low Voltage Programming Enable bit->HV on MCLR/VPP must be used for programming
// CONFIG5L
#pragma config CP = OFF // PFM and Data EEPROM Code Protection bit->PFM and Data EEPROM code protection disabled