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

PIC16F88

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



Joined: 26 May 2014
Posts: 2

View user's profile Send private message

PIC16F88
PostPosted: Mon May 26, 2014 4:06 pm     Reply with quote

I want to receive two analogue signal with Sharp distance sensor (GP2D12) and after measuring those voltages I have to control two dc motor in such a way that they work like segway (PID control). A bluetooth (HC-06) communication also need to be set up with any android phone to control the mini robot. Can anyone please help me with sample code??? Thanks
_________________
Eli
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon May 26, 2014 4:20 pm     Reply with quote

How about looking in the Drivers directory of the CCS compiler ?
Quote:
c:\program files\picc\drivers\gp2d12.c


Also use the forum's search page to find threads on the gp2d12:
http://www.ccsinfo.com/forum/viewtopic.php?t=37242
temtronic



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

View user's profile Send private message

PostPosted: Mon May 26, 2014 4:49 pm     Reply with quote

Start off by breaking down the project into simpler tasks.
First, get the PIC to flash an LED at 1Hz. This will prove you've wired up the board right and are able to program the PIC.Choose your pin usage wisely so you always have this LED available for future tests.
Next, I'm assuming you'll need some serial communications to a PC. Use 'RS232' and verify this works.Unless you have an onboard LCD module you WILL need to have a PC link to confirm the rest....
Try a pot attached to ONE analog input, cut code to read and send the raw data to the PC.Confirm it works for the full range.Then test the sensors on one channel. After that, code for the 2nd channel, confirm it works as well.
Not sure how you're going to control the motors but I'm assuming PWM. If so, there may be code here in the 'library' for something similar.
Bluetooth would be the next task...
PID is easy and will be last thing to do.

hth
jay
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Mon May 26, 2014 6:24 pm     Reply with quote

just wondering.

what pic projects have you done prior to this?

what pics have you worked with before?

do you have a circuit designed for the ambitious external functions
you want to implement?
that you can SHOW us?
can you post the schematic of what you have designed so far?

have you considered powering the system with a
di-lithium crystal reactor ?
http://www.waxingmoondesign.com/WarpSystemTech.html
Very Happy Very Happy Very Happy Very Happy Very Happy
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Tue May 27, 2014 12:11 pm     Reply with quote

asmboy wrote:
have you considered powering the system with a
di-lithium crystal reactor ?
http://www.waxingmoondesign.com/WarpSystemTech.html
Very Happy Very Happy Very Happy Very Happy Very Happy

Awesome, had not realised my understanding of basic physics was so out of date.

Mike
sarkarelias



Joined: 26 May 2014
Posts: 2

View user's profile Send private message

PostPosted: Wed May 28, 2014 3:00 pm     Reply with quote

I have attached my circuit design.

https://www.dropbox.com/s/zmj7whb30pdpg6h/photo.JPG
_________________
Eli
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Wed May 28, 2014 3:43 pm     Reply with quote

Hi,

Here is a test program that uses the internal 8.00 MHz oscillator, and blinks an LED connected to an I/O pin. Give it a try and see if your circuit is alive or not!

Code:

#include <16f88.h>
#fuses INTRC, NOWDT, NOLVP, BROWNOUT //,NOPROTECT

// Tell compiler clock speed is 8.00 MHZ internal Oscillator
#use delay(clock=8000000)

//-----< General Program Defines >-----

#define PWR_LED PIN_B0            // Power LED (High to turn ON)


void main(void)
{
      int8 iIndex;

   // Here we blip the Power LED at power-up to show that the interface is working
   for ( iIndex=0 ; iIndex<4 ; iIndex++ )
   {
      output_high(PWR_LED);
      delay_ms(250);
      output_low(PWR_LED);
      delay_ms(250);
   }
      
   // Here we leave the Power LED ON
   output_high(PWR_LED);

       while(1); //prevent the code from running off the end.....
}


John
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