Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

Sort By

USER REQUESTS

first | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 last
Peter Bieri
BieriP

posted on 2011/10/19 08:02:39 AM CEST

Communication

INitialize mmc

hi i wana use a MMC card. i hve the impression that the buffer is overfloding.
could someone check the code and tell me what i did wrong....

Code:

void sd_card_init()
{
// Initialisiere SPI für MMC Zugriff
SPI2_Init_Advanced(_SPI_MASTER, _SPI_8_BIT, 64, _SPI_SS_DISABLE, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_HIGH, _SPI_ACTIVE_2_IDLE);
Delay_ms(10);

// Initialize MMC
if (!Mmc_Fat_Init())
{
// Falls MMC Init nicht i.O. ist SPI schneller initialisieren.
SPI2_Init_Advanced(_SPI_MASTER, _SPI_8_BIT, 4, _SPI_SS_DISABLE, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_HIGH, _SPI_ACTIVE_2_IDLE);
}




}

void sd_card_read()
{
int zi = 0, zb = 0, zc = 0 ,zd = 0; // Schlaufenzähler
Mmc_Fat_Assign("config.txt", 0); //File config.txt öffnen
Mmc_Fat_Reset(&size); //grösse des Files auslesen und in size speichern

//File Auslesen und in buffer schreiben
for (zi = 1; zi <= size; zi++)
{
Mmc_Fat_Read(&buffer[0]);
//Wenn ein "-" (ASCII Code 45)
if (buffer[0] == 45)
{
zb = 0;
//Hier wird eine Zeile eingelesen (bis zum nächsten CR ASCII 13)
//oder 200 Zeichen eingelesen wurden
while (buffer [zb] != 13)
{
zb++;
Mmc_Fat_Read(&buffer[zb]);
if (zb == 200) break;
}

//Die ersten 4 Bytes des buffer werden in das Kommandobyte kopiert
zc = 0; //Schlaufenzähler auf 0 setzen
while (zc != 4) //Schlaufe um 4 bytes zu lesen
{
buffer_kdo[zc] = buffer[zc+1];
zc++;
}

//Byte 6 bis Byte 26 werden in buffer_ebene gespeichert
zd = 0; //Schlaufenzähler auf 0 setzen
while (zd != 20) //Schlaufe um 20 bytes zu lesen
{
buffer_ebene[zd] = buffer[zd+6];
zd++;
}
fill_vars();
}
}
}


void fill_vars()

{
//In dieser Funktion wird ein gefülltes Kommandobyte und Ebenenbyte
//vom Puffer in die entsprechende Variable ebenen_bez abgefüllt
//
//Funktionsinterne Variablendeklaration
int ebene_einer = 0 , ebene_zehner=0, ebene_total =0; //Ebenen Vraiablen
int ia = 0, i=0; //Schlaufen Variablen
//oder Ebenen Text

if (buffer_kdo[0] != 'E') return;
if (buffer_kdo[1] == 'B')

{
ebene_einer = buffer_kdo[3]-48;
ebene_zehner = buffer_kdo[2]-48;
ebene_total = (ebene_zehner * 10) + ebene_einer;
//4 Bytes Ebenentext in entsprechendes Array abfüllen
while (ia != 5)
{
ebenen_bez [ebene_total] [ia] = buffer[ia+6];
ia++;
}
}

//Ebenen Text in Array kopieren
ia = 0;
if (buffer_kdo[1] == 'T')
{
ebene_einer = buffer_kdo[3]-48;
ebene_zehner = buffer_kdo[2]-48;
ebene_total = (ebene_zehner * 10) + ebene_einer;
//Bytes Ebenentext in entsprechendes Array abfüllen
while (ia != 28)
{
ebenen_text [ebene_total] [ia] = buffer[ia+6];
ia++;
}
}

for (i = 0; i <= 128; i++)
{
buffer[i] = 0;
}
}

thanks

Bahman Mohammadhoseini
bobx

posted on 2011/10/15 03:51:31 AM CEST

Graphics & LCD > GLCD

Meaning of GLCD T6963C PAGING

Hello.I use the instruction ;[ T6963C_txtFill(0);//Clear current text panel ] to make a page and to make 20 pages I write that instruction at the first and top of each page.But I think that is not a corrected way[on the basis of paging in T6963C GLCD].

Would you please tell me about the meaning of paging in T6963C GLCD and how can I make 20 different pages by T6963C GLCD?
Thanks,

Bahman Mohammadhoseini
bobx

posted on 2011/10/15 03:48:07 AM CEST

Timers (Real time clock)

Reapeated 5 seconds interrupt

Hello.I want to write an interrupt so that at every 5 seconds goes to one of the 3 different
labels in my Main program and runs all instructions followed by each labels
and after run the label3 back again to the label1 and repeat all those
labels endlessly,that is;

.........
........... //*** My circuit specifications; PIC18F8722,XTAL=20MHZ.
..........

void interrupt(){ // 5 seconds interrupt.

????? //At each 5 seconds just goes and runs
//one of labels and do the other one then
//reapeat those again and again,endlessly.
}//~

void main(){
.............

Label1:
instruction1;
instruction2;
instruction3;
.......

Label2:
instructionx1;
instructionx2;
instructionx3;
.......

Label3:
instructiony1;
instructiony2;
instructiony3;
.......

}//~!

Would you please help me to write that interrupt?

Thanks,

Bora Akar
Un_NaMeD

posted on 2011/10/14 03:38:59 AM CEST

Communication

18F2550 recognized as a hid USB mouse?

Hey everyone.

I have an elecronic card programmed by MicroC used.
I want that to be recognized as an hid mouse...

Is it possible to make it modifying descriptor file?
if it is, how can I achieve this?

Any examples will be well appreciated.

My best regards...

gennaro padula
relinquished

posted on 2011/10/07 07:23:14 AM CEST

Communication

mikroBASIC and PS2 Protocol

Sorry for the strange request, but I need to create a communication protocol ps2, I would like to psatica in a mouse and a keyboard made ​​in house, but mikroBASIC only allows reading and sending data, then ask someone can help me on this little problem

first | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 last