CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

ADC reading problem with 16 bit processor
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
MCUprogrammer



Joined: 08 Sep 2020
Posts: 218

View user's profile Send private message

PostPosted: Fri Jan 22, 2021 1:34 pm     Reply with quote

All right. I will order this. I will use enameled wire until the product arrives. Well because I use this graphic lcd, I waste a lot of time for writing and deleting. Buddha system slows down. What do you think should I do?
_________________
Best Regards...
MCUprogrammer
_______________________________
Work Hard
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Sat Jan 23, 2021 2:03 am     Reply with quote

It's worth also understanding that the ADC on these faster chips can sample
much higher frequencies than the ones on the 8bit PIC's. A 100KHz signal
will basically be integrated by the PIC16/18 ADC. The same signal on a
16bit PIC will be read. If you are only sampling signals at low frequencies
it is worth adding external filtering.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Jan 23, 2021 6:41 am     Reply with quote

re: ...Well because I use this graphic lcd, I waste a lot of time for writing and deleting. Buddha system slows down.

You can increase the overall speed of your program by getting rid of 'floating point' numbers. By using 'scaled integers' you can easily get x10-x20 increase in 'math calculations' AND get better precision.

Also code is smaller,though maybe not a problem for your choice of PIC ?

Jay
MCUprogrammer



Joined: 08 Sep 2020
Posts: 218

View user's profile Send private message

PostPosted: Sat Jan 23, 2021 7:21 am     Reply with quote

I needed 64 entries and exits while designing my project. Since I need 64 pins, I chose my processor with 100 pins. Processors beyond 64 pins do not have a 5-volt PIC. I looked at the microchip page. Did not have. So when my processor was 3.3 volts, I had to choose 3.3 volts on my screen. There is the S1D13700 processor on the screen I use. This is a very troublesome processor. Fortunately I focused on it and wrote the driver. But now there is slow running. I think about 2 situations.
I have made the read write time of the graphic LCD delay_cycles (80). I will reduce this time a little and experiment. Of course why did I give this value?

If you are running at (say) 120MHz, this needs 14 machine cycles. Even with standard I/O, you only use a couple of extra delay cycles, so would need the timings for this to be increased significantly....

Also, this is my third project. I'm just at the beginning of the road. I spend a lot of time on my PC. I don't know if this is normal.
But before I write here, I've been struggling for a while myself, I think. I am writing to you last. I really thank you all for your support. Thanks to your Mr. Ttelmah site, I am learning a lot. Thank you.
_________________
Best Regards...
MCUprogrammer
_______________________________
Work Hard
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Jan 23, 2021 8:48 am     Reply with quote

re:...
Quote:
So when my processor was 3.3 volts, I had to choose 3.3 volts on my screen

If 'screen' you mean LCD module, I've run 5 volt 20x4 text LCD module using 3 volt PICs for 8-10 years. All I had to do was use a PWM pin, at 50% to drive a 'voltage doubler' to get 5 volts for LCD Vdd. The doubler is 2 diodes and 2 caps.
I'm pretty sure a 100-pin PIC should have ONE pin you could use for this purpose !

Jay
MCUprogrammer



Joined: 08 Sep 2020
Posts: 218

View user's profile Send private message

PostPosted: Sat Jan 23, 2021 9:10 am     Reply with quote

It takes more than 500ms to enter the keypad read function, get the value and press the screen. Do you think it would work if I did something like this? Does it work if I create a 1 microsecond interrupt, and set a keypad read function in 1 microsecond ?
_________________
Best Regards...
MCUprogrammer
_______________________________
Work Hard
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Jan 23, 2021 9:15 am     Reply with quote

Reading the keypad should be an interrupt driven task.
MCUprogrammer



Joined: 08 Sep 2020
Posts: 218

View user's profile Send private message

PostPosted: Sat Jan 23, 2021 11:16 am     Reply with quote

okay. I'll do it using interrupt.
_________________
Best Regards...
MCUprogrammer
_______________________________
Work Hard
MCUprogrammer



Joined: 08 Sep 2020
Posts: 218

View user's profile Send private message

PostPosted: Mon Jan 25, 2021 5:47 am     Reply with quote

21 Trying to read voltage from ADc input. But I'm applying the channel 1 input voltage. I am reading the right value. I plug the same cable into channel 2 by bridging them together. I saw the voltage drops by half. Is this normal?
_________________
Best Regards...
MCUprogrammer
_______________________________
Work Hard
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Jan 25, 2021 6:06 am     Reply with quote

Probably yes, basic electrical101. Same as putting two resistors in parallel ?
A lot depends on all those pesky 'specs' i the datasheet we never seem to
reaad until something 'weird' happens !

I've never seen it as I always use RTRI/RTRO opamp buffers with the ADC inputs.

Jay
MCUprogrammer



Joined: 08 Sep 2020
Posts: 218

View user's profile Send private message

PostPosted: Mon Jan 25, 2021 7:02 am     Reply with quote

Well, what's the difference? I am carrying the voltage from channel 1 to channel 2. Is it normal for it to fall in half?
_________________
Best Regards...
MCUprogrammer
_______________________________
Work Hard
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon Jan 25, 2021 7:05 am     Reply with quote

If you look at the data sheet, the high speed PIC ADC's have much lower
input impedance required than the 'older' PIC's.
I think yours specifies a minimum source impedance of 100R!.
Compare to a typical older PIC that specifies something closer to 10KR.
The internal circuit draws a lot of current. Inputs needs to be buffered
for this.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Jan 25, 2021 7:29 am     Reply with quote

I got 'curious'.....
Wow.... 200r ! it's in the param#AD17 'spec'.

I was thinking 1K ..yeesh 200 ohms...
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon Jan 25, 2021 8:22 am     Reply with quote

Yes, It's the 708, that has 100R...
The high speed ADC's, all really have to have input buffer amps for 99.9%
of applications. The old PIC ADC that could be driven off a resistive tap,
is gone with these. Sad
It's specific to the fast PIC33 ADC's. The PIC24 for example still requires
only 2.5KR.

I updated an old design that used a PIC18. Had to add unity gain voltage
buffers on all the analog inputs... Sad
MCUprogrammer



Joined: 08 Sep 2020
Posts: 218

View user's profile Send private message

PostPosted: Mon Jan 25, 2021 9:13 am     Reply with quote

On which page the information you say is explained in the data page. Can you tell?
_________________
Best Regards...
MCUprogrammer
_______________________________
Work Hard
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group