Author |
Message |
Topic: line follower with pd algorithm |
fbasaris
Replies: 1
Views: 8682
|
Forum: General CCS C Discussion Posted: Mon Mar 28, 2011 6:52 pm Subject: line follower with pd algorithm |
Hi everyone,
I am working on line follower robot. I have 8 sensors for tracking line use L298 for driving motors. I use 18f452 20 MHz and PD algorithm in my codes.
If I set motor's speed slowly ev ... |
Topic: it's about timer1 interrupt... |
fbasaris
Replies: 1
Views: 4282
|
Forum: General CCS C Discussion Posted: Sat Mar 05, 2011 7:20 pm Subject: it's about timer1 interrupt... |
Hi everyone,
My question: Can I use any function in the interrupt routine?
Like this:
....
int calculate_proportional(void);
int calculate_derivative(void);
....
#int_TIMER ... |
Topic: read 8 channel with 18f452 but time is too long... |
fbasaris
Replies: 9
Views: 10412
|
Forum: General CCS C Discussion Posted: Sat Mar 05, 2011 4:33 pm Subject: read 8 channel with 18f452 but time is too long... |
Uc is 18f452 and osc. frequency is 20 Mhz. If I understand truly:
I can set my timer1 interrupt in 1 ms.
by the way I changed code like this. It is working well now .
....
long bilgi;
long r ... |
Topic: read 8 channel with 18f452 but time is too long... |
fbasaris
Replies: 9
Views: 10412
|
Forum: General CCS C Discussion Posted: Sat Mar 05, 2011 1:56 pm Subject: read 8 channel with 18f452 but time is too long... |
I did not use adc_interrupt before. This is the first time. I can use timer1 interrupt too.
But I did not know the adc conversion time. 10 ms or 100 ms or 500 ms!!!! |
Topic: read 8 channel with 18f452 but time is too long... |
fbasaris
Replies: 9
Views: 10412
|
Forum: General CCS C Discussion Posted: Fri Mar 04, 2011 6:33 pm Subject: read 8 channel with 18f452 but time is too long... |
//variables
long bilgi;
long referans=614;
.
.
.
for(;;)
{
set_adc_channel(0);
delay_us(10);
bilgi=read_adc();
if(bilgi>referans) ... |
Topic: read 8 channel with 18f452 but time is too long... |
fbasaris
Replies: 9
Views: 10412
|
Forum: General CCS C Discussion Posted: Fri Mar 04, 2011 5:33 pm Subject: read 8 channel with 18f452 but time is too long... |
and by the way on the top of codes i did not add any line like this.
#include <math.h>
is it problem to calculate float numbers??? |
Topic: read 8 channel with 18f452 but time is too long... |
fbasaris
Replies: 9
Views: 10412
|
Forum: General CCS C Discussion Posted: Fri Mar 04, 2011 5:25 pm Subject: read 8 channel with 18f452 but time is too long... |
yes you are right. my variables are like:
unsigned long int bilgi;
float voltaj;
Actually i dont need to know the channel's voltage value. i want to know what logical value they are.maybe ;
in ... |
Topic: read 8 channel with 18f452 but time is too long... |
fbasaris
Replies: 9
Views: 10412
|
Forum: General CCS C Discussion Posted: Fri Mar 04, 2011 5:12 pm Subject: read 8 channel with 18f452 but time is too long... |
Hi everyone,
I want to read 8 channel ADC with 18f452 (20 MHz). After that I want to use adc interrupt but this code takes long time. How can I reduce the reading time???
void main()
& ... |
|