Results 1 to 3 of 3

Thread: Programming Amicus with MPLABX

  1. #1

    Default Programming Amicus with MPLABX

    I'm just trying to get a pin high on the Amicus18 board using the new MPLABX and XC8 compiler and failing. Is there something wrong with my configuration settings?

    Below is my code.

    Code:
    #include <xc.h>
    #pragma config IESO = OFF, FOSC = HSPLL, FCMEN = OFF 
    #pragma config BOREN = ON, BORV = 1, PWRT = ON  
    #pragma config WDTEN = OFF
    #pragma config CCP2MX = PORTC, PBADEN = OFF, LPT1OSC = OFF, MCLRE = ON 
    #pragma config DEBUG = OFF, STVREN = ON, XINST = OFF, LVP = OFF
    
    
    	
    void main(void){
    	TRISB = 0;
    	TRISA = 0;
    	TRISC = 0;
    	while(1){
    		PORTAbits.RA1 = 1;
    		PORTAbits.RA0 = 1;
    		PORTBbits.RB0 = 1;
    		PORTBbits.RB1 = 1;
    	
    	
    	}
    
    
    }

  2. #2

    Default

    Got it. It was probably just my configuration bits. This was the code I used.

    Code:
    #include <xc.h>
    // CONFIG1H
    #pragma config FOSC = HSPLL // Oscillator Selection bits (HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1))
    #pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor disabled)
    #pragma config IESO = OFF // Internal/External Oscillator Switchover bit (Oscillator Switchover mode disabled)
    // CONFIG2L
    #pragma config PWRT = OFF // Power-up Timer Enable bit (PWRT disabled)
    #pragma config BOREN = SBORDIS // Brown-out Reset Enable bits (Brown-out Reset enabled in hardware only (SBOREN is disabled))
    #pragma config BORV = 18 // Brown Out Reset Voltage bits (VBOR set to 1.8 V nominal)
    // CONFIG2H
    #pragma config WDTEN = OFF // Watchdog Timer Enable bit (WDT is controlled by SWDTEN bit of the WDTCON register)
    #pragma config WDTPS = 32768 // Watchdog Timer Postscale Select bits (1:32768)
    // CONFIG3H
    #pragma config CCP2MX = PORTC // CCP2 MUX bit (CCP2 input/output is multiplexed with RC1)
    #pragma config PBADEN = OFF // PORTB A/D Enable bit (PORTB<4:0> pins are configured as digital I/O on Reset)
    #pragma config LPT1OSC = OFF // Low-Power Timer1 Oscillator Enable bit (Timer1 configured for higher power operation)
    #pragma config HFOFST = ON // HFINTOSC Fast Start-up (HFINTOSC starts clocking the CPU without waiting for the oscillator to stablize.)
    #pragma config MCLRE = ON // MCLR Pin Enable bit (MCLR pin enabled; RE3 input pin disabled)
    // CONFIG4L
    #pragma config STVREN = ON // Stack Full/Underflow Reset Enable bit (Stack full/underflow will cause Reset)
    #pragma config LVP = ON // Single-Supply ICSP Enable bit (Single-Supply ICSP enabled)
    #pragma config XINST = OFF // Extended Instruction Set Enable bit (Instruction set extension and Indexed Addressing mode disabled (Legacy mode))
    #include <stdio.h>
    #include <stdlib.h>
    #include <p18f25k20.h>
    #include <delays.h>
    /*
    * */
    #define test PORTBbits.RB0
    #define test2 PORTBbits.RB5
    void main(void)
    {
    unsigned char dc ;
    TRISC = 0 ; // set PORTC as output
    PORTC = 0 ; // clear PORTC
    /*
    * configure CCP module as 4000 Hz PWM output
    */
    PR2 = 0b01111100 ;
    T2CON = 0b00000101 ;
    CCP1CON = 0b00001100 ;
    CCP2CON = 0b00111100 ;
    PORTB = 0;
    LATB = 0b11111111;
    TRISB = 0b00000000;
    TRISA = 0b00000000;
    TRISC = 0b00000000;
    TRISBbits.TRISB5 =0;
    PORTBbits.RB5 = 1;
    LATA = 0b11111111;
    LATC =0b11111111;

  3. #3
    Amicus Senior Developer
    Join Date
    Feb 2010
    Posts
    132

    Default

    With PICmicros it is important to include all fuse settings, as default fuse settings change from device to device. And it is always important to make sure XINST is off.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •