Author |
Message |
Topic: Basics Working - PIC18 ADC/PWM |
ounvme
Replies: 25
Views: 33164
|
Forum: General CCS C Discussion Posted: Tue Jun 05, 2012 7:35 pm Subject: Basics Working - PIC18 ADC/PWM |
x=128
y=129
z=1
Add them using int8 arithmetic, and the result is 128+129+1 = 258 -> int8 _2_. So the sum of these three numbers will test as <5.
Arithmetic wraps. Go past the larges ... |
Topic: Basics Working - PIC18 ADC/PWM |
ounvme
Replies: 25
Views: 33164
|
Forum: General CCS C Discussion Posted: Mon Jun 04, 2012 5:21 pm Subject: Basics Working - PIC18 ADC/PWM |
If the sum of adcR+adcG+adcB > 255 the program goes into random_color mode. Why does that happen? Because you told it to.
You've declared each of the three variables as int8. If their sum goes ... |
Topic: Basics Working - PIC18 ADC/PWM |
ounvme
Replies: 25
Views: 33164
|
Forum: General CCS C Discussion Posted: Mon Jun 04, 2012 5:01 pm Subject: Basics Working - PIC18 ADC/PWM |
What do you mean by this?
What is a good efficient way to check each channel for changes. Could I just use an if x1 != x2 update pwm or is there a better way?
Are you wanting a neat way to:-
(1) ... |
Topic: Basics Working - PIC18 ADC/PWM |
ounvme
Replies: 25
Views: 33164
|
Forum: General CCS C Discussion Posted: Sun Jun 03, 2012 5:20 pm Subject: Basics Working - PIC18 ADC/PWM |
@Mike, I was looking for an if statement to check if the value has changed vs constantly updating the pwm duty cycle. Since the adc values have some variation a simple if statement will not work. If t ... |
Topic: Basics Working - PIC18 ADC/PWM |
ounvme
Replies: 25
Views: 33164
|
Forum: General CCS C Discussion Posted: Wed May 30, 2012 10:00 pm Subject: Basics Working - PIC18 ADC/PWM |
Small Update:
I have all 3 A/D and PWM working and updating. I am now able to manually adjust 4096 different colors. I am now going to start to clean up the code make it run more efficient and star ... |
Topic: Basics Working - PIC18 ADC/PWM |
ounvme
Replies: 25
Views: 33164
|
Forum: General CCS C Discussion Posted: Mon May 28, 2012 8:07 pm Subject: Basics Working - PIC18 ADC/PWM |
That seems to have fixed the error. I tried int10 and 12 but not int16. For what I am using the 8 bit adc is more than enough. I wanted to test with 10 12 and 16. Here is the beginning of my work in p ... |
Topic: Basics Working - PIC18 ADC/PWM |
ounvme
Replies: 25
Views: 33164
|
Forum: General CCS C Discussion Posted: Sun May 27, 2012 10:39 pm Subject: Basics Working - PIC18 ADC/PWM |
Well I have had some free time to play with some examples and do some testing. I am having an issue with A/D above 8 bit. Using 8 bit I can adjust a potentiometer and change the blink rate of the led. ... |
Topic: Basics Working - PIC18 ADC/PWM |
ounvme
Replies: 25
Views: 33164
|
Forum: General CCS C Discussion Posted: Wed Apr 25, 2012 11:03 pm Subject: Basics Working - PIC18 ADC/PWM |
The 18F26K80 uses 12 bit and the registers are setup much differently. It is a good reference but still does not make it clear for how I would calculate TAD and Tacq for my application. With the ADCON ... |
Topic: Basics Working - PIC18 ADC/PWM |
ounvme
Replies: 25
Views: 33164
|
Forum: General CCS C Discussion Posted: Tue Apr 24, 2012 7:47 am Subject: Basics Working - PIC18 ADC/PWM |
Thanks PCM. I will look more into that after I understand how the A/D timing functions and how to properly configure the ADCON2 register. |
Topic: Basics Working - PIC18 ADC/PWM |
ounvme
Replies: 25
Views: 33164
|
Forum: General CCS C Discussion Posted: Mon Apr 23, 2012 9:03 pm Subject: Basics Working - PIC18 ADC/PWM |
Can someone "dumb" down the setting of adcon2?
To begin I won't be using an interrupt until I learn more about those also.
What I have so far from the data sheet
ADCON0 = 0b00000000
... |
Topic: Basics Working - PIC18 ADC/PWM |
ounvme
Replies: 25
Views: 33164
|
Forum: General CCS C Discussion Posted: Sun Apr 22, 2012 5:31 pm Subject: Basics Working - PIC18 ADC/PWM |
Awesome I can work in debug and external power mode. I am going to have to read more about how the fuses work as those seem to be very important.
The next step is to learn the hardware A/D and see ... |
Topic: Basics Working - PIC18 ADC/PWM |
ounvme
Replies: 25
Views: 33164
|
Forum: General CCS C Discussion Posted: Sun Apr 22, 2012 10:36 am Subject: Basics Working - PIC18 ADC/PWM |
The simple program worked and I was able to go step by step in debug mode. I figured the problem to be the fuses that I was using. So now I have both programs running in debug mode. When I unplug the ... |
Topic: Basics Working - PIC18 ADC/PWM |
ounvme
Replies: 25
Views: 33164
|
Forum: General CCS C Discussion Posted: Sat Apr 21, 2012 4:31 pm Subject: Basics Working - PIC18 ADC/PWM |
To start off I am about as green as a beginner can get. I don't know C very well, I don't know assembly, and I have never used uC's. I however am pretty proficient at building circuits and learning fr ... |
|