Page 10 of 10

Re: Simplified Microchip PIC USB demos (C18/XC8 MLA)

PostPosted: Wed Jul 19, 2017 12:29 pm
by Dennis
Hello,

I am trying to use the 4550 C18 example and modify it for use with 18f2455. Sadly the example doesn't build with MPLAB X 3.61 and C18 v3.47.
I get this error:
C:\Program Files\Microchip\mplabc18\v3.47\h\string.h:623:Error [1174] local 'c' in program memory can not be 'auto'
nbproject/Makefile-PDFSUSB_4550_C18.mk:162: recipe for target 'build/PDFSUSB_4550_C18/production/usb_descriptors.o' failed
make[2]: Leaving directory 'C:/Users/Administrator/Desktop/src/LPC_FSUSB-CDC-X'
nbproject/Makefile-PDFSUSB_4550_C18.mk:90: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/Administrator/Desktop/src/LPC_FSUSB-CDC-X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

BUILD FAILED (exit value 2, total time: 91ms)


I already tried to google it but didn't find anything helpfull and nobody in this thread seemed to have this problem.
Help would be appreciated :)

Re: Simplified Microchip PIC USB demos (C18/XC8 MLA)

PostPosted: Wed Jul 19, 2017 1:20 pm
by vloki
Read the info in C18_changes_in_framework.txt please.
(Comment line 623 and report here if this file is not included in the download)

Re: Simplified Microchip PIC USB demos (C18/XC8 MLA)

PostPosted: Wed Jul 19, 2017 1:31 pm
by Dennis
Okay thank you. Didn't realize it meant to just comment the line


Edit: I modified the 4550 code for my 2455 and it built and programmed fine. But the PC just recognizes an unknown USB device. I tried to use the drivers from the MLA but then it just says the drivers for unknown USB device are up to date.

Any suggestions?

Re: Simplified Microchip PIC USB demos (C18/XC8 MLA)

PostPosted: Thu Jul 20, 2017 8:10 am
by vloki
Did you prove that the oscillator setting and the "fixed memory" stuff is correct?

Re: Simplified Microchip PIC USB demos (C18/XC8 MLA)

PostPosted: Thu Mar 29, 2018 10:18 pm
by Charon
Hi vloki,
can you help me with location of source code? I installed MLA library on directory:
C:\microchip\mla\v2014_07_22\apps\LPC_FSUSB-CDC-X-r2\...
and build project in MPLAB X IDE v4.15, XC8 (v1.45) for PIC18F4550.

I test it with MLA v2013_12_20 and v2017_03_06 too. Without success.

my configuration:
Output showe me few errors:

Re: Simplified Microchip PIC USB demos (C18/XC8 MLA)

PostPosted: Fri Mar 30, 2018 9:45 am
by vloki
Guess the main problem is that MCHP dropped PLIB for XC8 later than v1.34.
You can install v1.34 and try again, copy the source of the PLIB functions to your project
or rewrite all the functions coming from PLIB.
You can download PLIB from the same site you got xc8 from.
It wont work with the new xc8 version, but you get the source code for the fucktions.

Only two functions should be affected. I modified them recently for the 27J53.
THERE thy look like this now:
Code: Select all
void initADC(void)
{
//    OpenADC(ADC_FOSC_64 & ADC_RIGHT_JUST & ADC_2_TAD,
//            ADC_CH0 & ADC_INT_OFF & ADC_REF_VDD_VSS,
//            ADC_TRIG_CCP2,
//            ADC_5ANA & ADC_VBG_OFF);

    ADCON1bits.ADCS = 0b110;    //ADC_FOSC_64
    ADCON1bits.ADFM = 1;        //ADC_RIGHT_JUST
    ADCON1bits.ACQT = 0b01;     //ADC_2_TAD

    ADCON0bits.CHS = ADCH_0;
    ADCON0bits.VCFG = 0b00;     //ADC_REF_VDD_VSS

    ADCTRIGbits.TRIGSEL = 0b00; //ADC_TRIG_CCP2

    ANCON0 = 0xE0;              //ADC_5ANA
    ANCON1bits.VBGEN = 0;       //ADC_VBG_OFF

    ADCON0bits.ADON = 1;
}


/******************************************************************************
 * Function:        void initSpecialEventTrigger(void)
 *
 * PreCondition:    None
 * Input:           None
 * Output:          None
 * Side Effects:    None
 *
 * Overview:
 *
 * Note:
 *
 *****************************************************************************/
void initSpecialEventTrigger(void)
{
    // Timer1 input = 48MHz/4 = 12MHz; Prescaler 8 -> 1.5MHz
//    OpenTimer1(TIMER_INT_OFF & T1_16BIT_RW & T1_SOURCE_FOSC_4 &
//               T1_PS_1_8 & T1_OSC1EN_OFF & T1_SYNC_EXT_OFF,
//                TIMER_GATE_OFF);
 
    T1CONbits.RD16 = 1;         //T1_16BIT_RW
    T1CONbits.TMR1CS = 0b00;    //T1_SOURCE_FOSC_4
    T1CONbits.T1CKPS = 0b11;    //T1_PS_1_8
    T1CONbits.T1OSCEN = 0;      //T1_OSC1EN_OFF
    T1CONbits.nT1SYNC = 0;      //T1_SYNC_EXT_OFF
    T1GCONbits.TMR1GE = 0;      //TIMER_GATE_OFF


    T1CONbits.TMR1ON = 0;       // gets activated later when measurement starts
    CCPTMRS0bits.C2TSEL = 0;    // timer <-> ccp module (CCP2 / TMR1)
    CCPR2 = 15000;              // 1.5MHz/100Hz
    ECCP2CONbits.CCP2M = 0b1011; // Compare Mode with Special Event Trigger
}

For the 4550 they are different, but I think you can do this with the help of the data sheet ;-)

Re: Simplified Microchip PIC USB demos (C18/XC8 MLA)

PostPosted: Tue Jun 19, 2018 11:45 am
by 6O6A9R1VP
I am trying to use USB CDC code released by Mr.vloki in our project work.

On MCU side we have done porting and changes with little difficulty, after going through forums & net.

In our projectn we need to display temperature , pressure values using simple GUI on PC/Laptop.

For this we tried to customise source code provided by Mr.vloki, i am stuckup.

i could not undestand which library files i have to include in our code & how to use call them.
The source code file is "Source_Serial_20150806.zip" .

i have good idea about c programming, and i am not thorough in OOPs concepts.
That is a bottleneck for us, i can understand oops programs to some extent.

any idead or hint or clue is most welcome.

Re: Simplified Microchip PIC USB demos (C18/XC8 MLA)

PostPosted: Wed Jun 20, 2018 6:31 am
by 6O6A9R1VP
Hi vloki,
we tried to initialize serial port, by following your QT serial com example.

The snippet added is:

Code: Select all
 settings =new PortSettings {(BaudRateType)sbBaudrate->value(),
                          DATA_8, PAR_NONE, STOP_1, FLOW_OFF, 1000};
[color=#FF8000]port = new QextSerialPort(QString(COM_STRING) +"1", settings, QextSerialPort::EventDriven);[/color]
if(port->isOpen())port->close();
inOut = new QhsuProt();


I am getting following error at 2nd line for "
Code: Select all
port = new QextSerialPort(....);
"

The error message is:

C:\Users\ABS524\Documents\bogotobogo\sccusb - Cdc\scc_usb\demoapp.cpp:43: error: no matching function for call to 'QextSerialPort::QextSerialPort(const QString, PortSettings*&, QextSerialPort::QueryMode)'
port = new QextSerialPort(QString(COM_STRING) +"1", settings, QextSerialPort::EventDriven);
^
should i include any file or do any modifiacation.

with thanks,