Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug Function Setup with CDC - 18f45k50 ide 952 (solved)
29-11-2013, 06:28 PM, (This post was last modified: 13-01-2014, 02:17 PM by psteve.)
#1
Bug Function Setup with CDC - 18f45k50 ide 952 (solved)
Looking for a workaround for CDC problems, i found something...

Using this code:

__________________________________
char *string = "Hello world!";
char c = 65;
int i = 333;
long l = 115200;
float f = 3.14159265;


void setup()
{
toggle (USERLED);
delay(500);
toggle (USERLED);
delay(500);
toggle (USERLED);
delay(500);
toggle (USERLED);
delay(500);
toggle (USERLED);
delay(500);
toggle (USERLED);
delay(500);
}

void loop()
{
u8 *buffer;
CDC.printf("Write Any Texte ...\r\n");
buffer = CDC.getString();
CDC.printf("You wrote : %s\r\n", buffer);
CDC.printf("\r\n");
CDC.printf("Write Any Texte ...\r\n");
buffer = CDC.getString();
CDC.printf("You wrote : %s\r\n", buffer);
CDC.printf("\r\n");
}

________________________________

User led it's always off.


if loop routine is empty Userled flashes three times...

void setup()
{
toggle (USERLED);
delay(500);
toggle (USERLED);
delay(500);
toggle (USERLED);
delay(500);
toggle (USERLED);
delay(500);
toggle (USERLED);
delay(500);
toggle (USERLED);
delay(500);
}

void loop()
{

}


Undecided
Reply
30-11-2013, 10:31 AM, (This post was last modified: 30-11-2013, 10:38 AM by psteve.)
#2
RE: Bug Function Setup with CDC - 18f45k50 ide 952 - NEWS!!!
NEWS !!!

this code from tutos 1

_________________________________

u16 ValPot; //declaration d'une variable ValPot

void setup()
{
lcd.pins(23, 24, 25, 26, 27, 28, 0, 0, 0, 0);

lcd.begin(2, 0);

lcd.home();
lcd.print("Valeur analog A0");

}

void loop()
{
lcd.clear;
ValPot = analogRead(13);
lcd.setCursor(0, 1);
lcd.printf(" Valeur = %d", ValPot);
delay(500);
toggle (USERLED);

}
________________



Compile it for 18f4550

Select 18f45k50 Board

Download with f6 (previous hex compiled for 18f4550...) in 18f45k50

Works!!!

Big Grin

If you compile for 18f45k50 it doesn't works....

Help....
Reply
30-11-2013, 03:12 PM,
#3
RE: Bug Function Setup with CDC - 18f45k50 ide 952 - NEWS!!!
Please edit sources/main.c and comment those lines :
148 OSCCON2bits.PLLEN = 1;
149 while (pll_startup_counter--);
Any better result ?
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
01-12-2013, 10:08 AM, (This post was last modified: 01-12-2013, 10:52 AM by psteve.)
#4
RE: Bug Function Setup with CDC - 18f45k50 ide 952 - NEWS!!!
No difference.. :-(

User led flashes correctly but lcd is empty...

Code above compiled with 4550 board selected 11684 bytes,
compiled with 45k50 board selected 11206 bytes...
what's missing (478 bytes)???
Reply
01-12-2013, 08:05 PM,
#5
RE: Bug Function Setup with CDC - 18f45k50 ide 952 - NEWS!!!
My LCD works perfect with my 25k50 ...
But I found an issue with analogRead() for x5k50 family.
Please, edit analog.c and add these lines in analog_init() :

Code:
#elif defined(__18f25k50) || defined(__18f45k50)
    // RB : 01-12-2013
    TRISA  = TRISA  | 0x2F; // 0b00101111 = RA0,1,2,3 and RA5 = AN0 to AN4 are INPUT
    ANSELA = ANSELA | 0x2F; // AN0 to AN4 enabled
    ANSELB = 0;
    ANSELC = 0;
    #if defined(__18f45k50)
    ANSELD = 0;
    ANSELE = 0;
    #endif
    ADCON1 = 0x00;          // VRef-=VSS, VRef+=VDD
    ADCON2 = 0xBD;          // 0b10111101 = Right justified, 0, 20 TAD, FOSC/16

If it doesn't work you will have to update your files with the new ones I will commit on the svn server this evening.

Tell me ...
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
02-12-2013, 08:49 AM, (This post was last modified: 02-12-2013, 08:51 AM by psteve.)
#6
RE: Bug Function Setup with CDC - 18f45k50 ide 952 - NEWS!!!
Now code size is 11224 bytes but with no difference...

Lcd works only if i compile for 4550 and download it in 45k50...

Today i'll check what happens compiling for 25k50 (with lcd pins modified)..
Reply
02-12-2013, 11:42 AM, (This post was last modified: 02-12-2013, 12:01 PM by psteve.)
#7
RE: Bug Function Setup with CDC - 18f45k50 ide 952 - NEWS!!!
OK Regis Big Grin it works!!!

Using pins 23,24,25,26,27,28 in 45k50 LCD doesn't works in 4550 it's ok.

Using 2,3,4,5,6,7 in 45k50 lcd works Rolleyes

I hope this help...
Reply
02-12-2013, 12:40 PM,
#8
RE: Bug Function Setup with CDC - 18f45k50 ide 952 - NEWS!!!
Cool.
Please take a look at digitalw.c and see if pin definitions are all right ...
If not tell me and I will update this file.


(02-12-2013, 11:42 AM)psteve Wrote: OK Regis Big Grin it works!!!

Using pins 23,24,25,26,27,28 in 45k50 LCD doesn't works in 4550 it's ok.

Using 2,3,4,5,6,7 in 45k50 lcd works Rolleyes

I hope this help...
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
02-12-2013, 01:40 PM, (This post was last modified: 02-12-2013, 01:51 PM by psteve.)
#9
RE: Bug Function Setup with CDC - 18f45k50 ide 952 - NEWS!!!
In digitalw.c i found
----
elif defined(PINGUINO4550) || defined(PINGUINO45K50)
..
---

Bug is not here...Undecided


In 45k50 there are A7 & A6 pins... May Be here the problem?
Reply
02-12-2013, 04:39 PM,
#10
RE: Bug Function Setup with CDC - 18f45k50 ide 952 - NEWS!!!
Pins 23 to 28 are on Port D.
Port D is multiplexed with ADC.
Please, check that ANSELD is cleared the proper way in IO_digital() function (file io.c).
You should have this :

Code:
#elif defined(__18f25k50) || defined(__18f45k50)

        // Initialize all Analog pins as Digital I/O
        ANSELA = 0;
        ANSELB = 0;
        ANSELC = 0;
        #if defined(__18f45k50)
        ANSELD = 0;
        ANSELE = 0;
        #endif

I join my io.c :

.c   io.c (Size: 7.28 KB / Downloads: 3)
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)