Author |
Message |
Topic: "for" loop problem |
Harry Mueller
Replies: 10
Views: 11375
|
Forum: General CCS C Discussion Posted: Fri May 05, 2006 8:49 am Subject: "for" loop problem |
Thanks Ronald, good point.
Harry |
Topic: "for" loop problem |
Harry Mueller
Replies: 10
Views: 11375
|
Forum: General CCS C Discussion Posted: Fri May 05, 2006 8:24 am Subject: "for" loop problem |
If you have CCP1 and CCP2 available you may be better off using the IRQ approach to producing the wavformes.
Thanks Treitmey, I've actually got code that does that. I was just playing around with s ... |
Topic: "for" loop problem |
Harry Mueller
Replies: 10
Views: 11375
|
Forum: General CCS C Discussion Posted: Fri May 05, 2006 8:18 am Subject: "for" loop problem |
I guess the PIC was resetting.
I was powering the servo off the board. I tried powering the servo with a separate battery and common ground and it started working.
Thanks for pointing me in the ... |
Topic: "for" loop problem |
Harry Mueller
Replies: 10
Views: 11375
|
Forum: General CCS C Discussion Posted: Fri May 05, 2006 7:59 am Subject: "for" loop problem |
And did it help to improve things?
If not, is it possible the PIC is resetting due to voltage spikes caused by the servo's?
No, The while(1) statement didn't change anything. But possibly the PIC ... |
Topic: "for" loop problem |
Harry Mueller
Replies: 10
Views: 11375
|
Forum: General CCS C Discussion Posted: Fri May 05, 2006 7:00 am Subject: "for" loop problem |
A single call to either of the servo routines takes about 20ms. You call each function 25 times in succession: 25 * 20ms = 450ms.
I'm sorry, I don't understand your point here. The servo should mov ... |
Topic: "for" loop problem |
Harry Mueller
Replies: 10
Views: 11375
|
Forum: General CCS C Discussion Posted: Fri May 05, 2006 6:20 am Subject: "for" loop problem |
I've got a couple of "for" loops that I think should run one after the other but they seem to form some type of nested loop that runs forever. If printf statements are substituted for the two servo po ... |
Topic: minus signs not showing up consistently in printf |
Harry Mueller
Replies: 6
Views: 7009
|
Forum: General CCS C Discussion Posted: Fri Apr 21, 2006 12:28 pm Subject: minus signs not showing up consistently in printf |
What compiler version?.
There was a bug that applied to a few versions, where if the 'carry' flag is set from one arithmetic operation, it incorrectly gets displayed as a 'sign', in printf...
If you ... |
Topic: minus signs not showing up consistently in printf |
Harry Mueller
Replies: 6
Views: 7009
|
Forum: General CCS C Discussion Posted: Fri Apr 21, 2006 9:44 am Subject: minus signs not showing up consistently in printf |
Can you show us the declarations for these variables and the math that calculates them? I suspect somewhere you are using an unsigned type to hold a signed value.
I don't think I've done that but ... |
Topic: minus signs not showing up consistently in printf |
Harry Mueller
Replies: 6
Views: 7009
|
Forum: General CCS C Discussion Posted: Fri Apr 21, 2006 9:40 am Subject: minus signs not showing up consistently in printf |
What compiler version?.
There was a bug that applied to a few versions, where if the 'carry' flag is set from one arithmetic operation, it incorrectly gets displayed as a 'sign', in printf...
If you ... |
Topic: minus signs not showing up consistently in printf |
Harry Mueller
Replies: 6
Views: 7009
|
Forum: General CCS C Discussion Posted: Fri Apr 21, 2006 6:39 am Subject: minus signs not showing up consistently in printf |
In a debugging exercise I print out 3 variables. The calculations are all done correctly but two of the printed values, Accel_percent and Avg may or may not show a minus sign, it seems almost arbitrar ... |
Topic: Question about hardware CCP/PWM value to set duty |
Harry Mueller
Replies: 3
Views: 17542
|
Forum: General CCS C Discussion Posted: Wed Apr 19, 2006 11:50 am Subject: Question about hardware CCP/PWM value to set duty |
Thanks for the great explanation!
Harry |
Topic: Question about hardware CCP/PWM value to set duty |
Harry Mueller
Replies: 3
Views: 17542
|
Forum: General CCS C Discussion Posted: Wed Apr 19, 2006 11:02 am Subject: Question about hardware CCP/PWM value to set duty |
I've got version 3.245 and am using a 16F877.
When I write the following code it will work if I declare torque as an 8 bit variable but not if I declare it as a 16 bit variable:set_pwm1_duty(to ... |
Topic: Odd result for capturing duty cycle with TIMER_1 and #int_RB |
Harry Mueller
Replies: 4
Views: 7137
|
Forum: General CCS C Discussion Posted: Thu Apr 13, 2006 2:06 pm Subject: Odd result for capturing duty cycle with TIMER_1 and #int_RB |
Thanks guys, that fixed it. I think I understand the "=" vs "==" better too.
Harry |
Topic: Odd result for capturing duty cycle with TIMER_1 and #int_RB |
Harry Mueller
Replies: 4
Views: 7137
|
Forum: General CCS C Discussion Posted: Thu Apr 13, 2006 1:27 pm Subject: Odd result for capturing duty cycle with TIMER_1 and #int_RB |
if (delta_portb = 0x80 || 0xc0) //If PIN_B7 has changed
I tried changing the line to:if ((delta_portb = 0x80) || (delta_portb = 0xc0))
I think that provides the c ... |
Topic: Odd result for capturing duty cycle with TIMER_1 and #int_RB |
Harry Mueller
Replies: 4
Views: 7137
|
Forum: General CCS C Discussion Posted: Thu Apr 13, 2006 12:33 pm Subject: Odd result for capturing duty cycle with TIMER_1 and #int_RB |
I'm trying to develop a program that will calculate the duty cycle of an ADXL202E accelerometer on an 16F877 PIN_B7 using #int_RB. Here's the code of the interrupt service routine.
#int_RB
void ... |
|