Author |
Message |
Topic: ADC Voltage <> integer values(compiler) |
FJMSoft
Replies: 17
Views: 23635
|
Forum: General CCS C Discussion Posted: Tue Nov 25, 2014 1:11 am Subject: ADC Voltage <> integer values(compiler) |
Got it PCM!
Thank you! |
Topic: ADC Voltage <> integer values(compiler) |
FJMSoft
Replies: 17
Views: 23635
|
Forum: General CCS C Discussion Posted: Mon Nov 24, 2014 12:27 pm Subject: ADC Voltage <> integer values(compiler) |
I am excited with all this, I am learning a lot!
Thank you PCM!
I was exactly thinking about something like that but didnt know how to do.
In Delphi I was using Trunc(float) and Round(float) func ... |
Topic: ADC Voltage <> integer values(compiler) |
FJMSoft
Replies: 17
Views: 23635
|
Forum: General CCS C Discussion Posted: Mon Nov 24, 2014 10:41 am Subject: ADC Voltage <> integer values(compiler) |
I was giving a little check in the ASM code:
.................... if (ADCA<ChargeCutV);
014A: CLRF 29
014B: MOVF 24,W
014C: MOVWF 28
014D: CALL 032
014 ... |
Topic: ADC Voltage <> integer values(compiler) |
FJMSoft
Replies: 17
Views: 23635
|
Forum: General CCS C Discussion Posted: Sun Nov 23, 2014 10:43 pm Subject: ADC Voltage <> integer values(compiler) |
Get more accuracy with floating point math:
#define VoltToByte(x) x*(255/30.0)
Now 77h = 119
NICE!
Thank you very much!!! |
Topic: ADC Voltage <> integer values(compiler) |
FJMSoft
Replies: 17
Views: 23635
|
Forum: General CCS C Discussion Posted: Sun Nov 23, 2014 9:06 pm Subject: ADC Voltage <> integer values(compiler) |
Hello again.
Friends, I was trying to use this technique in my code, test code is like this:
#define VoltToByte(x) x*(255/30) //Voltage will be divided by 6, so maximum will be 3 ... |
Topic: ADC Voltage <> integer values(compiler) |
FJMSoft
Replies: 17
Views: 23635
|
Forum: General CCS C Discussion Posted: Sat Nov 15, 2014 12:26 pm Subject: ADC Voltage <> integer values(compiler) |
I got it.
Thank you very much! |
Topic: How to work with low/high bytes of 16bit variable. |
FJMSoft
Replies: 12
Views: 20072
|
Forum: General CCS C Discussion Posted: Sat Nov 15, 2014 11:00 am Subject: How to work with low/high bytes of 16bit variable. |
Thank you very much! |
Topic: ADC Voltage <> integer values(compiler) |
FJMSoft
Replies: 17
Views: 23635
|
Forum: General CCS C Discussion Posted: Sat Nov 15, 2014 10:58 am Subject: ADC Voltage <> integer values(compiler) |
I dont want to jump into int16.
Above 5v for sure not, but for exact 5v is possible.
There is a way to compare ADC to 5v without using int16?
Using 0.0196 instead of 0.01953 will add a small er ... |
Topic: ADC Voltage <> integer values(compiler) |
FJMSoft
Replies: 17
Views: 23635
|
Forum: General CCS C Discussion Posted: Sat Nov 15, 2014 9:27 am Subject: ADC Voltage <> integer values(compiler) |
Wow!
VERY NICE!
Ttelmah code looks more interesting for me, more flexible and voltage value keeps exposed in the code.
So, I can securely make any math like this "#define int_adc(x) x/0.01 ... |
Topic: ADC Voltage <> integer values(compiler) |
FJMSoft
Replies: 17
Views: 23635
|
Forum: General CCS C Discussion Posted: Fri Nov 14, 2014 8:04 pm Subject: ADC Voltage <> integer values(compiler) |
Hello.
This may be a very basic question, my english is poor so I will try my best to explain what I need.
I want to work with voltages using the ADC.
Several times I just want to check for a vol ... |
Topic: How to work with low/high bytes of 16bit variable. |
FJMSoft
Replies: 12
Views: 20072
|
Forum: General CCS C Discussion Posted: Fri Nov 14, 2014 7:50 pm Subject: How to work with low/high bytes of 16bit variable. |
Sorry for that.
I think I understood it, thank you.
Ttelmah, I still have a doubt...
Using this kind: #byte TMR1L = getenv("SFR:TMR1L")
Can I port it to another uC which have a TMR1L ... |
Topic: How to work with low/high bytes of 16bit variable. |
FJMSoft
Replies: 12
Views: 20072
|
Forum: General CCS C Discussion Posted: Mon Oct 27, 2014 9:46 pm Subject: How to work with low/high bytes of 16bit variable. |
It's not.
Have a look at the thread example I posted, which shows how to do this with a #BYTE. However, remember that for things like the timers, you want to access them in a single I/O operation i ... |
Topic: How to work with low/high bytes of 16bit variable. |
FJMSoft
Replies: 12
Views: 20072
|
Forum: General CCS C Discussion Posted: Mon Oct 27, 2014 2:43 pm Subject: How to work with low/high bytes of 16bit variable. |
Shifts and other mathematics will take processor time.
I have found a joint betwen struct and union, I need to study it a little better, but looks it will fit for variable one, I dont understand wh ... |
Topic: How to work with low/high bytes of 16bit variable. |
FJMSoft
Replies: 12
Views: 20072
|
Forum: General CCS C Discussion Posted: Sun Oct 26, 2014 10:34 pm Subject: How to work with low/high bytes of 16bit variable. |
this is a basic C question.
read about
STRUCT
in the manual for your answer
asmboy, it is this one?
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf
I found something in page 31 (43 in pdf ... |
Topic: How to work with low/high bytes of 16bit variable. |
FJMSoft
Replies: 12
Views: 20072
|
Forum: General CCS C Discussion Posted: Sun Oct 26, 2014 9:03 pm Subject: How to work with low/high bytes of 16bit variable. |
Hello.
I want to set and/or read just the lower/higher byte of an 16bit variable.
How can I achieve this?
I know it is possible using bit shifts and some mathematics...
Which is the faster way?
... |
|