News:

;) This forum is the property of Proton software developers

Main Menu

Display refresh and AD read

Started by Giuseppe, Jun 24, 2021, 03:11 PM

Previous topic - Next topic

Giuseppe

Can an AD read in the main loop create problems for an interrupt that occurs every mS for the display refresh?
I ask this question because it performs a refresh to 4 7-segment displays and when I enable the AD reading the display starts flashing
The statements I made for the Ad reading are:
Declare Adin_Res 10
Declare Adin_Stime 50

Pepe

#1
Change goto for gosub

trastikata

#2
The AD should not interfere noticeably with the time interrupt unless you run the AD reading in a constant loop where the AD DONE flag get raised about every 50 uS?

Sounds more like a temporary variable or code interference - if it is not something proprietary maybe you can post a code snippet so we can take a look?

top204

I know it sounds obvious, but make sure the setting of the pins to analogue for the ADC is not setting other pins to analogue as well.

It depends on what device you are using for this to happen. With the old, outdated, standard 14-bit core devices, not all individual pins could be set as analogue, only groups of certain pins.

The ADin command does not interfere with interrupts at all, so all the interrupt will do is slow down the small delay within its subroutine that waits for the ADC's capacitor to charge.

Also, make sure you do not have the interrupt set for the ADC to fire an interrupt as well.

Giuseppe

Thank you all for answering me.
it was my mistake when I was going to do the AD reading instead of using a GOsub I had put a Goto that's why it was wrong. Now there is another problem always concerning the AD reading. I am using an 18f25k22 with internal oscillator set at 1Mhz to reduce consumption. In the manual of the mcu I have read that with 1Mhz of oscillator for AD they recommend to use internal FRC from 600Khz is it there?
Also if I have to use the Serout command which speed parameter to put after the port set as tx?