Hi Filipe,

Thanks for the feedback and good to hear that it works but you are using it 
outside of its specification since the maximum clock is 40 MHz. I am not sure 
what the effects will be but correct operation might not be guaranteed.

Did you know there are also PICs that can run on a 64 MHz clock? For example 
the PIC18F25Q10 but if I am not sure if you can program this one with a PICKit2 
or PICKit3, at least not with the standard PICKit3 software.

Kind regards,

Rob

________________________________
Van: [email protected] <[email protected]> namens flyway38 
<[email protected]>
Verzonden: zondag 21 augustus 2022 16:22
Aan: jallib <[email protected]>
Onderwerp: Re: [jallib] PIC18F2580 ADC CHANNELS

Hi again,

Second code option (4x PLL) tested and working great with a 12MHz XTAL (48MHz 
clock).
Thank you once again.

Cheers,
FS

On Thursday, August 18, 2022 at 9:44:28 AM UTC+1 flyway38 wrote:
Hi Rob,

Very helpfull info here.
32Mhz code worked ok and even solved some other issue about RS232 comms that 
was happening.
Later on will test 40MHz (10MHz xtal)...
Thank you very much.

Cheers
Filipe Santos

On Wednesday, August 17, 2022 at 6:17:52 PM UTC+1 [email protected] wrote:
Hi Filipe,

About the ansel error. It seems to be in your program, not in a library so I 
think you should remove those lines.

About the 40 MHz.  Do you need 40 MHz using a crystal or is 32 MHz using the 
internal oscillator sufficient? Below the code I think that should work for 32 
MHz but you need to test it. I always use a blink sample program as starting 
point.

-- This program uses the internal oscillator at 32 MHz.
pragma target clock    32_000_000       -- oscillator frequency
--
pragma target OSC      INTOSC_NOCLKOUT           -- internal oscillator
pragma target WDT      CONTROL                   -- watchdog
pragma target XINST    DISABLED                  -- do not use extended 
instructionset
pragma target DEBUG    DISABLED                  -- no debugging
pragma target BROWNOUT DISABLED                  -- no brownout reset
pragma target FCMEN    DISABLED                  -- no clock monitoring
pragma target IESO     DISABLED                  -- no int/ext osc switching
pragma target LVP      ENABLED                   -- low voltage programming
pragma target MCLR     EXTERNAL                  -- external reset
--
-- The configuration bit settings above are only a selection, sufficient
-- for this program. Other programs may need more or different settings.
--
WDTCON_SWDTEN = OFF                 -- disable WDT
OSCCON_SCS = 0                      -- select primary oscillator
OSCCON_IRCF = 0b111                 -- 8 MHz
OSCTUNE_PLLEN = TRUE                -- 4xPLL

For 40 MHz it may be something like this. You need a 10 MHz crystal for this 
configuration:

-- This program assumes that a 10 MHz resonator or crystal
-- is connected to pins OSC1 and OSC2.
pragma target clock 40_000_000      -- oscillator frequency
--
pragma target OSC      HS_PLL                    -- crystal with 4xPLL
pragma target WDT      CONTROL                   -- watchdog
pragma target XINST    DISABLED                  -- do not use extended 
instructionset
pragma target DEBUG    DISABLED                  -- no debugging
pragma target BROWNOUT DISABLED                  -- no brownout reset
pragma target FCMEN    DISABLED                  -- no clock monitoring
pragma target IESO     DISABLED                  -- no int/ext osc switching
pragma target LVP      ENABLED                   -- low voltage programming
pragma target MCLR     EXTERNAL                  -- external reset
--
-- The configuration bit settings above are only a selection, sufficient
-- for this program. Other programs may need more or different settings.
--
WDTCON_SWDTEN = OFF                 -- disable WDT
OSCCON_SCS = 0                      -- select primary oscillator
OSCTUNE_PLLEN = TRUE                -- 4xPLL
--

Kind regards,

Rob

________________________________
Van: [email protected] <[email protected]> namens flyway38 
<[email protected]>
Verzonden: woensdag 17 augustus 2022 17:29
Aan: jallib <[email protected]>
Onderwerp: Re: [jallib] PIC18F2580 ADC CHANNELS

Hello Rob,

Tried today your code for the "new" ADC and have installed already the new JAL 
1.7.0
Heres th error log:

[Error] (DMTM_v3.00_1.jal) [Line 168]  "ansel_ans3" not defined
[Error] (DMTM_v3.00_1.jal) [Line 168]  unexpected token: ansel_ans3

Any help will be appreciated.
Thank you.

Cheers,
Filipe Santos.
On Tuesday, August 16, 2022 at 8:32:24 PM UTC+1 flyway38 wrote:
Hi Rob,

Thanks for your help.
Am using PIC18F2580.

Cheers,
Filipe Santos

On Tuesday, August 16, 2022 at 7:30:10 PM UTC+1 [email protected] wrote:
Hi Filipe,
Your question about the 40 MHz depends on the pic you are using

Which one is that?
Kind regards.

Rob

Met vriendelijke groet,
Rob Jansen
________________________________
From: [email protected] <[email protected]> on behalf of flyway38 
<[email protected]>
Sent: Tuesday, August 16, 2022 8:16:59 PM
To: jallib <[email protected]>
Subject: Re: [jallib] PIC18F2580 ADC CHANNELS

Hi Rob

Thank you very much for the heads up.
Managed to make it work, doing some changes to "old" ADC_Channels... :D
But will move my JAL install to the new one.
Thanks once again.

Now am trying to make this PIC to run at 40MHz...
Any help here?
Thanks


Cheers,
Filipe Santos.

On Tuesday, August 16, 2022 at 6:10:43 PM UTC+1 [email protected] wrote:
Hello Filipe,

I had to look this up since the library adc_channels.jal does not exist anymore 
since Jallib release 1.5.0. It was there in 1.4.0 and currently we are at 1.7.0.

The problem was that the library was not maintainable anymore so it was removed 
and the configuration of the channels was moved to the program of the user. 
Also the use of JANSEL was removed from all device files because of the same 
reason.

So I suggest you download the latest Jallib release and look at one of the adc 
sample files. They are all updated to incorporate this change.

For example, a typical adc set-up in your main program will then look something 
like this but this is PIC dependent.

-- Step 1: ADC analog input pin setup
const byte ADC_CHANNEL = 3                      -- potmeter connected to pin_AN3
ANSEL_ANS3 = TRUE                               -- port 3 is analog input 
(default)
pin_AN3_direction = input
-- Step 2: Set VDD and VSS as Vref
ADCON0_VCFG = FALSE
-- Step 3: Use Frc as ADC clock
ANSEL_ADCS = 0b011
const ADC_RSOURCE = 4_700                       -- Input resistance: 4.7K 
potmeter
-- Now we can include the library
include adc
-- And initialize the whole with our parameters
adc_init()

Kind regards,

Rob

________________________________
Van: [email protected] <[email protected]> namens flyway38 
<[email protected]>
Verzonden: dinsdag 16 augustus 2022 17:58
Aan: jallib <[email protected]>
Onderwerp: [jallib] PIC18F2580 ADC CHANNELS

Hello to all,

Am coding for this PIC (18F2580) now.
Need to use ADC and compiling fails with this log;

LOG:
jal jalv25r6 (compiled Oct 29 2021)
generating p-code
992 tokens, 700421 chars; 14125 lines; 19 files
generating PIC code pass 1
generating PIC code pass 2
1293 data accesses checked, 0 errors
87 skips checked, 0 errors
writing result
C:\JALLIB~1\lib/adc_channels.jal:3315: "
Unable to configure ADC channels.
    Configuration is supposed to be done using ANS bits
but it seems there's no ANS bits for this PIC.
    Maybe your PIC isn't supported, please report !"
1 errors, 0 warnings

Any help will be appreciated.
Thank you.

Kind regards,
Filipe Santos.

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/ab00461c-c965-43b7-8ef4-c8d726515d85n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/ab00461c-c965-43b7-8ef4-c8d726515d85n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/3c8637ac-86dc-4ac5-ae44-b6b19cd98228n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/3c8637ac-86dc-4ac5-ae44-b6b19cd98228n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/7e26946d-2b76-45da-bfd1-9fab42194087n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/7e26946d-2b76-45da-bfd1-9fab42194087n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/dbe6eeae-90da-458c-b44d-3bd26798d61cn%40googlegroups.com<https://groups.google.com/d/msgid/jallib/dbe6eeae-90da-458c-b44d-3bd26798d61cn%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/GVXP195MB16374260009C51269220838DE66E9%40GVXP195MB1637.EURP195.PROD.OUTLOOK.COM.

Reply via email to