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 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 last
JITENDER SINGH
jitendertara

posted on 2018/07/06 04:44:58 PM CEST

Audio & Speech

PIC24FJ1024GA610

I need sample code for initialization of pic24fj1024ga610 mcu..
1.Need toggle pin of mcu.

Adamu Abubakar
Adamsonics

posted on 2017/10/15 04:14:12 PM CEST

Audio & Speech

PASSWORD CODE AND 4X4 KEYPAD CCODE

I am using PIC16F877 to implement communication with a PC. I want a code in C language to execute the following tasks:

(1) To password it to prevent unauthorized access.
(2) To use a key on the 4x4 keypad to display more than one character. For example, key 1 to able display Number "1" and Letter "E", "F" and "G".

I need the code in C language to execute the two task above.

Obrien Requina
orequina

posted on 2017/06/16 06:05:15 AM CEST

Audio & Speech

Interface PIC16F877A to MPU 6050 Gyroscope to read data via Serial

I been trying to interface PIC16877 to MPU6050 to read angular data to the computer through SERIAL @ 9600 buad rate. Can anyone help me provide a simple code just for me to start with... Thank you very much in advance

Emmanuel Abraham
mwanyamaki_1992

posted on 2016/12/20 10:58:31 AM CET

Audio & Speech

PROBLEM ON CODE OF GSM CONTROLLING APPLIANCES THROUGH SMS

Dear members I have a problem, I have prepared the code of GSM CONTROLLING APPLIANCES THROUGH SMS and when I compile it no any error comes after compiling and when i tested it on proteus using PIC16F877A all lights are turned on initially and always remain on until i stopped a simulation. Any one who can collect my code please can help me.. Below it's my code the code was compiled in MikroC for PIC.


/*GSM based device control system*/
/*The device status is stored in EEPROM inorder to avoid power failure problem*/
/*Mobile phone interfacing functions requires serial port with a baud rate of 9600*/


/*************************************************************/



sbit Device1 at RC1_bit; /*Device 1*/
sbit Device2 at RC2_bit; //Device 2
sbit Device3 at RC3_bit; //Device 3



unsigned char msg[7]; /*array to store message content*/


/***********************sends a command passed to it***************************/


void Send_Command(unsigned char *ptr)
{
/*it sends the array until a null character reached*/
unsigned char Tx_Count=0;
do
{ Uart1_Write(ptr[Tx_Count]); Tx_Count++;
}while(ptr[Tx_Count]!='\0'); /*checks for null*/
}


/***********************Initmobile***********************/


void Init_Mobile()
{ Send_Command("AT\r\n");
Delay_Ms(1000);
Send_command("ATE0\r\n"); /*ECHO off*/
Delay_Ms(1000);
Send_Command("AT+CMGF=1\r\n"); /*Select TEXT mode*/
Delay_Ms(1000);
}
/******************Reads message from 1st location****************/


/*The address of the destination array is passed*/
unsigned char Read_Message(unsigned char *ptr_array)
{
unsigned char Rx_Count=0,Rx_Buffer,temp;
unsigned char array1[6];
Rx_Buffer=RCREG;
Rx_Buffer=RCREG;
Rx_Buffer=RCREG;
RCSTA.CREN=0;
RCSTA.CREN=1;
Send_Command("AT+CMGR=1\r\n"); /*Command for reading message*/
do{
while(Uart1_Data_Ready()==0){;} Rx_Buffer=RCREG; //Read message
array1[Rx_Count]=Rx_Buffer; Rx_Count++;
}while(Rx_Count<6);


array1[Rx_Count-1]='\0';
if(strcmp(array1,"ERROR")==0){ Send_Command("AT+CMGR=1\r\n");
}


if(Rx_Buffer=='S') /*Checks for valid message*/
return 0;
else if(Rx_Buffer=='G')
{
do /*if message is there*/
{
while(Uart1_Data_Ready()==0){;} /*receive upto next 0x0A*/
Rx_Buffer=RCREG; //avoid number and msg status
}while(Rx_Buffer!=0x0a);


Rx_Count=0;
do
{ while(Uart1_Data_Ready()==0){;} Rx_Buffer=RCREG; //Read message
ptr_array[Rx_Count]=Rx_Buffer; Rx_Count++;
}while(Rx_Buffer!=0x0d); /*receive message uptp 0x0d*/
ptr_array[Rx_count-1]='\0'; /*the array is terminated with a null*/
return 1;
}
}
void Send_msg(){ Send_Command("AT+CMGS=\"9089189115\"\r");
Delay_Ms(1000);
Send_Command("Activated");
Delay_Ms(1000);
Uart1_Write(0x0d);
Delay_Ms(1000);
Uart1_Write(26); // Ctrl+z
}


/*************************************************************************
**/
void main()
{
unsigned char Count=0,Dev_Status;
Uart1_Init(9600); /*Init Uart*/
Dev_Status=Eeprom_Read(0x00); /*read the previous status*/
ADCON1=0x06; /*Porta as digital*/
TRISA=0XFF; /*PORTA input*/
TRISC&=0XF0;
PORTC=Dev_Status; /*output the status*/
Init_Mobile(); /*Init mobile*/
Delay_Ms(1000); /*1sec delay*/


while(1)
{
/*************************************************************************
***/
if(Read_Message(&msg[0])==1)
{
if(strcmp(msg,"1 ON")==0)
{ Device1=1;
Dev_Status =0x02;
Eeprom_Write(0x00,Dev_Status);
Send_msg();
}


else if(strcmp(msg,"1 OFF")==0)
{
Device1=0;
Dev_Status&=0xfd;
Eeprom_Write(0x00,Dev_Status);
Send_msg();
}


else if(strcmp(msg,"2 ON")==0)
{ Device2=1; Dev_Status=0x04;
Eeprom_Write(0x00,Dev_Status);
Send_msg();
}


else if(strcmp(msg,"2 OFF")==0)
{ Device2=0; Dev_Status&=0xfA;
Eeprom_Write(0x00,Dev_Status);
Send_msg();
}


else if(strcmp(msg,"3 ON")==0)
{ Device3=1; Dev_Status=0x08;
Eeprom_Write(0x00,Dev_Status);
Send_msg();
}


else if(strcmp(msg,"3 OFF")==0)
{ Device3=0; Dev_Status&=0xf7;
Eeprom_Write(0x00,Dev_Status);
Send_msg();
}
Delay_Ms(2000); /*2sec delay*/
Send_Command("AT+CMGD=1\r\n"); //Delete message
Delay_Ms(2000);
}


else
{
;
}


Delay_Ms(3000); //Delay before next checking



}
}

Emid Alipour
Emid

posted on 2016/12/01 10:48:38 PM CET

Audio & Speech

stm32l4 discovery board USB and I2S

Hi

i have discovery board of stm32l476VG ( www.st.com/stm32l4-discovery ).
but mikroC cant support USB for this board, so mikroC have not any solution to use I2S of this board.
this board have a 43L22 I2S codec of CIRRUS company.
i cant find any source code or library for it.
if anyone have any source code , please help me.

Regards.

first | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 last