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 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 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

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

marcel nijssen
marcel n

posted on 2011/10/05 06:04:36 AM CEST

Communication > CAN / LIN / RS485

Can someone make a example for Dynamixel AX-12+ servo

He do can someone make a example for the Dynamixel AX-12+ servo in mikrobasic for the pic16f887 or 16f877a , i have two of this servos but dont know how to use then , can i use the ONE-WIRE Lib
or wont that work here the datasheet of the motor .

http://www.agaverobotics.com/products/servos/robotis/ax12/ax12-protocol.aspx

Or can someone tell me what to use to control then. whit a pic

thanks for your reaction

Yasuyuki Yoshida
piroham13

posted on 2011/10/05 12:03:26 AM CEST

Communication

UART data commincation with PC using PIC16F1827 (mikroC)

Does anyone have example UART commincation using PIC16F1827 (mikroC PRO for PIC) ?

first | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 last