View previous topic :: View next topic |
Author |
Message |
zeyad
Joined: 24 Feb 2015 Posts: 22
|
reply |
Posted: Wed Mar 04, 2015 10:57 pm |
|
|
Ttelmah wrote: | You are still ignoring lots of things you have been told. I'll put some comments in part of your code, _read them_:
Code: |
{
int j;
int i=0;
for(i=0;i<(rev*360/1.8);i++){
//rev *360, will overflow the maths being used as soon rev>1
output_b(ax[i%4]);
for (j=1000;j<50;j--){
//What is the biggest number that 'j' can hold?.
//Is the loop ever going to execute?. j is never '<50' so loop
//will exit immediately.
delay_ms(j);
//If it did work, just how long is this going to take?. 1 step per second
//at the start!.....
}
}
}
|
|
Code: | {
int8 j;
int8 i=0;
for(i=0;i<(rev*360/1.8);i++){
output_b(ax[i%4]);
for (j=55;j>90;j--){
delay_ms(j);
}
} | still problem ? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19587
|
|
Posted: Thu Mar 05, 2015 1:55 am |
|
|
All three comments still apply..... |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
Re: reply |
Posted: Thu Mar 05, 2015 2:30 am |
|
|
zeyad wrote: | Ttelmah wrote: | You are still ignoring lots of things you have been told. I'll put some comments in part of your code, _read them_:
Code: |
{
int j;
int i=0;
for(i=0;i<(rev*360/1.8);i++){
//rev *360, will overflow the maths being used as soon rev>1
output_b(ax[i%4]);
for (j=1000;j<50;j--){
//What is the biggest number that 'j' can hold?.
//Is the loop ever going to execute?. j is never '<50' so loop
//will exit immediately.
delay_ms(j);
//If it did work, just how long is this going to take?. 1 step per second
//at the start!.....
}
}
}
|
|
Code: | {
int8 j;
int8 i=0;
for(i=0;i<(rev*360/1.8);i++){
output_b(ax[i%4]);
for (j=55;j>90;j--){
delay_ms(j);
}
} | still problem ? | Run your code in MPLABSIM.
Examine the values for i, j and portB.
Are they what you expect them to be?
The penny may drop, you SHOULD then understand what Ttelmah is saying.
Mike |
|
|
zeyad
Joined: 24 Feb 2015 Posts: 22
|
Re: reply |
Posted: Thu Mar 05, 2015 3:58 am |
|
|
Mike Walne wrote: | zeyad wrote: | Ttelmah wrote: | You are still ignoring lots of things you have been told. I'll put some comments in part of your code, _read them_:
Code: |
{
int j;
int i=0;
for(i=0;i<(rev*360/1.8);i++){
//rev *360, will overflow the maths being used as soon rev>1
output_b(ax[i%4]);
for (j=1000;j<50;j--){
//What is the biggest number that 'j' can hold?.
//Is the loop ever going to execute?. j is never '<50' so loop
//will exit immediately.
delay_ms(j);
//If it did work, just how long is this going to take?. 1 step per second
//at the start!.....
}
}
}
|
|
Code: | {
int8 j;
int8 i=0;
for(i=0;i<(rev*360/1.8);i++){
output_b(ax[i%4]);
for (j=55;j>90;j--){
delay_ms(j);
}
} | still problem ? | Run your code in MPLABSIM.
Examine the values for i, j and portB.
Are they what you expect them to be?
The penny may drop, you SHOULD then understand what Ttelmah is saying.
Mike |
thank you |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Thu Mar 05, 2015 7:15 pm |
|
|
Just another suggestion: To improve readability don't quote each and every message.
What you are doing is good usage in mailing lists but here you are on a forum website where everybody clearly sees all previous messages. Quote nothing if you are responding to the full last message. Quote a message part when you are responding to an older message.
For example, in your last post there is a full page of text on my screen with only two new words of you: 'thank you'. |
|
|
|