Author |
Message |
Topic: How to set the PWM duty with the accelerometer value? |
pacman91
Replies: 1
Views: 4691
|
Forum: General CCS C Discussion Posted: Sat Jul 23, 2011 12:30 am Subject: How to set the PWM duty with the accelerometer value? |
#include<18F4520.h>
#DEVICE ADC=8
#fuses HS,NOWDT,NOPROTECT,NOLVP, BROWNOUT, PUT
#use delay(clock=4000000)
#include <flex_lcd.c>
#define data_width 3
int8 AccData[data_ ... |
Topic: How to set the PWM duty with the accelerometer value? |
pacman91
Replies: 1
Views: 4691
|
Forum: General CCS C Discussion Posted: Sat Jul 23, 2011 12:08 am Subject: How to set the PWM duty with the accelerometer value? |
#include<18F4520.h>
#DEVICE ADC=8
#fuses HS,NOWDT,NOPROTECT,NOLVP, BROWNOUT, PUT
#use delay(clock=4000000)
//#Define timer PIN_C2
#include <flex_lcd.c>
#define data_width 3
... |
Topic: Help me take a look on my code what error in it |
pacman91
Replies: 10
Views: 9230
|
Forum: General CCS C Discussion Posted: Sat Jul 16, 2011 10:09 am Subject: Help me take a look on my code what error in it |
Triple check the actual servo wiring - colour codes mean nothing. Normally the pin 'order' across the plug, is 0v, 5v, PWM. The manual you refer to, gives a different colour code to the one you are re ... |
Topic: Help me take a look on my code what error in it |
pacman91
Replies: 10
Views: 9230
|
Forum: General CCS C Discussion Posted: Sat Jul 16, 2011 7:00 am Subject: Help me take a look on my code what error in it |
o...the main problem is serve the timer interrupt used too long time? then have any idea i can set the 20ms for motor? |
Topic: Help me take a look on my code what error in it |
pacman91
Replies: 10
Views: 9230
|
Forum: General CCS C Discussion Posted: Fri Jul 15, 2011 8:35 pm Subject: Help me take a look on my code what error in it |
_One_ problem that will prevent the ADC returning a correct reading is fixed. Not the main ones.
Best Wishes
then what is the main 1=.= |
Topic: Help me take a look on my code what error in it |
pacman91
Replies: 10
Views: 9230
|
Forum: General CCS C Discussion Posted: Fri Jul 15, 2011 12:15 pm Subject: Help me take a look on my code what error in it |
As a separate comment, look at your own remarks. Note the one that says
"//a small delay is required after setting the channel ". Then why is the delay _before_ setting the channel?.
... |
Topic: Help me take a look on my code what error in it |
pacman91
Replies: 10
Views: 9230
|
Forum: General CCS C Discussion Posted: Fri Jul 15, 2011 7:04 am Subject: Help me take a look on my code what error in it |
Why you said that is a bad idea? Please teach me, i'm newbie, learning the CCS in this forum, no people teach =.=
setup_timer_2(T2_DIV_BY_16, 250, 5); //4ms, postscale 5 = 5*4ms=20ms(see ... |
Topic: Help me take a look on my code what error in it |
pacman91
Replies: 10
Views: 9230
|
Forum: General CCS C Discussion Posted: Fri Jul 15, 2011 7:00 am Subject: Help me take a look on my code what error in it |
This is C36R servo motor, A7260 accelerometer.
http://www.cytron.com.my/usr_attachment/RC_Servo_User_Manual.pdf
I connect the brown wire to ground, red to 5v, orange to PWM signal (I connect to D0 o ... |
Topic: Help me take a look on my code what error in it |
pacman91
Replies: 10
Views: 9230
|
Forum: General CCS C Discussion Posted: Fri Jul 15, 2011 3:15 am Subject: Help me take a look on my code what error in it |
#include<18F4520.h>
#DEVICE ADC=8
#fuses HS,NOWDT,NOPROTECT,NOLVP, BROWNOUT, PUT
#use delay(clock=4000000)
#include "C:\Program Files (x86)\PICC\Drivers\flex_lcd.c&q ... |
Topic: Help me take a look on my code |
pacman91
Replies: 1
Views: 3964
|
Forum: General CCS C Discussion Posted: Mon Jul 04, 2011 5:06 am Subject: Help me take a look on my code |
#include <18F4520.h>
#DEVICE ADC=10
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)
//#define PWN_PIN PIN_B0
#include <flex_lcd.c>
void main(void)
{ ... |
Topic: Servo Test Driver - SG 90 and MG 90 S micro servo |
pacman91
Replies: 4
Views: 47107
|
Forum: Code Library Posted: Thu Jun 30, 2011 11:15 am Subject: Servo Test Driver - SG 90 and MG 90 S micro servo |
setup_timer_1(T1_INTERNAL|T1_DIV_BY_2); // Timer set for 26.2ms overflow with 0.4 us resolution
20Mhz/4/2 = 0.4us
how to set the 26.2ms???
why 0.4us = 26.2ms
how to calculate |
Topic: Help me take a look on my code |
pacman91
Replies: 3
Views: 4993
|
Forum: General CCS C Discussion Posted: Wed Jun 22, 2011 7:48 am Subject: Help me take a look on my code |
ok thx bro
while(1)
{
}
i tried it
it works, thx |
Topic: Help me take a look on my code |
pacman91
Replies: 3
Views: 4993
|
Forum: General CCS C Discussion Posted: Mon Jun 20, 2011 10:33 pm Subject: Help me take a look on my code |
#include <18F4520.h>
#DEVICE ADC=10
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)
#include <flex_lcd.c>
void main(void)
{
//long ADC_Result;
s ... |
Topic: PWM issue |
pacman91
Replies: 4
Views: 6598
|
Forum: General CCS C Discussion Posted: Mon Jun 20, 2011 6:37 pm Subject: PWM issue |
Use 10-bit PWM mode. You will get 4x the resolution of 8-bit mode.
To enable 10-bit mode, use a 'long' (int16) value for the duty cycle.
For a constant, the easy way to declare it as a 'long' is t ... |
Topic: How to use Accelerometer |
pacman91
Replies: 2
Views: 5831
|
Forum: General CCS C Discussion Posted: Mon Jun 20, 2011 9:30 am Subject: How to use Accelerometer |
MMA7260Q.
What is the formula to calculate the angle of accelerometer??
What is the code for the three-axis accelerometer in CCS?? |
|