CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

mems tilt operated mobile

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
riya



Joined: 15 Feb 2012
Posts: 10

View user's profile Send private message

mems tilt operated mobile
PostPosted: Wed Mar 21, 2012 5:14 am     Reply with quote

hello every one,

i'm using pic 16f877a controller. and also i have one mems module. i want to calculate the tilt by which i need to send a message through GSM modem.

please help me where to start and how to develop this application?

my software is proteus 7 professional

help me regardin this.
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Mar 21, 2012 6:02 am     Reply with quote

do the following in order...

1) get rid of Proteus..

2) buy real parts..

3) cut code and show us, we will help

here's why

1) Proteus is FULL of bugs, errors, faulty DRCs and will never EVER 'simulate' the PIC correctly.

2) only REAL PICs work properly

3)Guys here have tens of thousands of manhours cutting real code for PICs,real PICs.No one here can or will try to debug Proteus 'code'.Sure, it may look ok but 'inside' Proteus is a lot of bad,faulty code.


so...once you get the real PIC, breakdown the project into steps...
1) read, read some more,get familiar with the PIC, cut the 'hello World' and 'blinking LED' type programs..

2) read some more, get the PIC to talk to the 'mems module' and display data to a local LCD or send to PC terminal program...

3) read some more, get the PIC to talk to the GSM module..

The 'trick' here is to read, read and READ again! The more you read and understand the better and faster you'll appreciate PICs and the CCS C compiler.
riya



Joined: 15 Feb 2012
Posts: 10

View user's profile Send private message

PostPosted: Fri Mar 30, 2012 12:52 am     Reply with quote

thanks for your help.
riya



Joined: 15 Feb 2012
Posts: 10

View user's profile Send private message

mems tilt calculation
PostPosted: Wed Apr 04, 2012 5:41 am     Reply with quote

Hello sir,

i have followed you suggestion.
i purchased the modules.
and tried the code as you said divided my code into parts and finally i get the code like this.

please have a glance and tell me the mistakes.
thank you.[/code]




*****************************************************************
I assumed,
if no tilt i.e x,y=0 lock the phone.
if y==3\\ tilted down - phone book, call window, message window
if x==5\\ tilted left - scroll contacts
if x==10\\ tilted right - dail a number
if y==6\\ tilted up - home
******************************************************************


#include<16f877a.h>
#include<stdio.h>
#use delay(clock=20MHZ)
#fuses PROTECT, HS
#use rs232(baud=9600,rcv=PIN_C1,xmit=PIN_C2,stream=GSM)
#use i2c(sda=PIN_C3,scl=PIN_D0)
#define led PIN_D0
void flash_led()
{
output_high(led);
delay_ms(1000);
output_low(led);
delay_ms(1000);
output_high(led);
delay_ms(1000);
output_low(led);
}
char ch;
int x=5;
int y=3;
int a;
void display_homepage()
{
printf(lcd_putc,"\f welcome riya");
}
read_i2c()
{
x=i2c_read(0);
y=i2c_read(1);

while(!(x==3 && y==5))
}
void main()
{
flash_led();
while(1)
{
display_homepage();
{
if(x==0&&y==0)
{
fprintf(lcd_putc,"\f lock");
}
if(y==3)
{
fprintf(lcd_putc,"\f phone book");
if(x==5)
{
fprintf(gsm,"at+cpbr=a%d");
a++;
if(x>5)
fprintf(gsm,"atd9494166736;\n");
}
}
if(y==3)
{
fprintf(lcd_putc,"\f call window");

if(x==5)
{
fprintf(gsm,"at+cpbr=a%d");
a++;
if(x>5)
fprintf(gsm,"atd9494166736;\n");
}
}
if(y==3)
{
fprintf(lcd_putc,"\f message window");
if(x>5)
fprintf(gsm,"at+cmgs=9494166736\n");
}

}
}
}
jeremiah



Joined: 20 Jul 2010
Posts: 1346

View user's profile Send private message

PostPosted: Wed Apr 04, 2012 6:24 am     Reply with quote

please use the "code" tags to post code in the future.

Three things I noticed off the bat:
1. You don't use ERRORS in your #use rs232() call like you should be. That needs to be fixed.

2. You use PIN_D0 for both I2C and the LED.

3. Just a format issue: led should be LED or something capitalized. Constant names should typically be capitalized for readability...not an issue with performance though.

I can't really read the rest of your code well enough to spot other things due to the format.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group