EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

PIC templates

Started by Dennis December 11, 2010
Dummies question here...

I'm starting out on a new PIC device 18LF14K22, using MPLAB / C18. Where can 
I find templates with config bits / int vector definitions etc all ready to 
go?

I poked around on Microchips site with no success.



Thanks


On Dec 11, 1:43=A0pm, "Dennis" <no...@nowhere.com> wrote:
> Dummies question here... > > I'm starting out on a new PIC device 18LF14K22, using MPLAB / C18. Where =
can
> I find templates with config bits / int vector definitions etc all ready =
to
> go? > > I poked around on Microchips site with no success. > > Thanks
Use those for the 18F14K22? Leon
"Leon" <leon355@btinternet.com> wrote in message 
news:25026175-0f4f-4f0b-bed4-a56a68df06fd@h17g2000pre.googlegroups.com...
On Dec 11, 1:43 pm, "Dennis" <no...@nowhere.com> wrote:
> Dummies question here... > > I'm starting out on a new PIC device 18LF14K22, using MPLAB / C18. Where > can > I find templates with config bits / int vector definitions etc all ready > to > go? > > I poked around on Microchips site with no success. > > Thanks
Use those for the 18F14K22? Leon Ummm yeah, no rocket surgeon here...I'm pushing on learning C (C18). I've been using a 18F1330 and have changed to the 18LF14K22. The C18 compiler throws up a bunch of errors due to differences between the two devices. A template would save a lot of to and fro-ing with the data sheet to get things going sorting out niggly little things like OSC on the '1330 translates to FOSC on the 'LF14k22. Trivial I know but I figured templates might exist.... cheers
On 12/11/2010 10:31 PM, Dennis wrote:
> "Leon"<leon355@btinternet.com> wrote in message > news:25026175-0f4f-4f0b-bed4-a56a68df06fd@h17g2000pre.googlegroups.com... > On Dec 11, 1:43 pm, "Dennis"<no...@nowhere.com> wrote: >> Dummies question here... >> >> I'm starting out on a new PIC device 18LF14K22, using MPLAB / C18. Where >> can >> I find templates with config bits / int vector definitions etc all ready >> to >> go? >> >> I poked around on Microchips site with no success. >> >> Thanks > > Use those for the 18F14K22? > > Leon > > > Ummm yeah, no rocket surgeon here...I'm pushing on learning C (C18). I've > been using a 18F1330 and have changed to the 18LF14K22. The C18 compiler > throws up a bunch of errors due to differences between the two devices. A > template would save a lot of to and fro-ing with the data sheet to get > things going sorting out niggly little things like OSC on the '1330 > translates to FOSC on the 'LF14k22. Trivial I know but I figured templates > might exist.... > > cheers > >
???? by template you mean 18LF14K22.h ??? In your mcc18 install directory, ../h/p18lf14K22.h is there. Take a look I'll wait ...... h
"hamilton" <hamilton@nothere.com> wrote in message 
news:ie2q3i$otp$1@news.eternal-september.org...
> On 12/11/2010 10:31 PM, Dennis wrote: >> "Leon"<leon355@btinternet.com> wrote in message >> news:25026175-0f4f-4f0b-bed4-a56a68df06fd@h17g2000pre.googlegroups.com... >> On Dec 11, 1:43 pm, "Dennis"<no...@nowhere.com> wrote: >>> Dummies question here... >>> >>> I'm starting out on a new PIC device 18LF14K22, using MPLAB / C18. Where >>> can >>> I find templates with config bits / int vector definitions etc all ready >>> to >>> go? >>> >>> I poked around on Microchips site with no success. >>> >>> Thanks >> >> Use those for the 18F14K22? >> >> Leon >> >> >> Ummm yeah, no rocket surgeon here...I'm pushing on learning C (C18). I've >> been using a 18F1330 and have changed to the 18LF14K22. The C18 compiler >> throws up a bunch of errors due to differences between the two devices. A >> template would save a lot of to and fro-ing with the data sheet to get >> things going sorting out niggly little things like OSC on the '1330 >> translates to FOSC on the 'LF14k22. Trivial I know but I figured >> templates >> might exist.... >> >> cheers >> >> > ???? > > by template you mean 18LF14K22.h ??? > > In your mcc18 install directory, ../h/p18lf14K22.h is there. > > Take a look I'll wait ...... > > h
Nope. More like what I've attached below. Judging by the responses I don't think they exist (or are regarded as too simple). Thanks for the reply. ;DIRECTIVE TO DEFINE PROCESSOR #INCLUDE <P18F14K22.INC> ;PROCESSOR SPECIFIC VARIABLE DEFINITIONS ;CONFIGURATION BITS ;MICROCHIP HAS CHANGED THE FORMAT FOR DEFINING THE CONFIGURATION BITS, PLEASE ;SEE THE .INC FILE FOR FUTHER DETAILS ON NOTATION. BELOW ARE A FEW EXAMPLES. ; OSCILLATOR SELECTION: CONFIG FOSC = IRC ; INTERNE CONFIG PCLKEN = ON ; Primary clock enabled CONFIG FCMEN = ON ; Fail-Safe Clock Monitor enabled ; IESO = OFF Oscillator Switchover mode disabled ; IESO = ON Oscillator Switchover mode enabled CONFIG PWRTEN = OFF ; PWRT disabled CONFIG BOREN = OFF ; Brown-out Reset disabled in hardware and software ; Brown Out Voltage: ; BORV = 30 VBOR set to 3.0 V nominal ; BORV = 27 VBOR set to 2.7 V nominal ; BORV = 22 VBOR set to 2.2 V nominal ; BORV = 19 VBOR set to 1.9 V nominal CONFIG WDTEN = OFF ; WDT is controlled by SWDTEN bit of the WDTCON register ; Watchdog Timer Postscale Select bits: ; WDTPS = 1 1:1 ; WDTPS = 2 1:2 ; WDTPS = 4 1:4 ; WDTPS = 8 1:8 ; WDTPS = 16 1:16 ; WDTPS = 32 1:32 ; WDTPS = 64 1:64 ; WDTPS = 128 1:128 ; WDTPS = 256 1:256 ; WDTPS = 512 1:512 ; WDTPS = 1024 1:1024 ; WDTPS = 2048 1:2048 ; WDTPS = 4096 1:4096 ; WDTPS = 8192 1:8192 ; WDTPS = 16384 1:16384 ; WDTPS = 32768 1:32768 CONFIG MCLRE = ON ; MCLR pin enabled, RA3 input pin disabled CONFIG HFOFST = OFF ; The system clock is held off until the HFINTOSC is stable. CONFIG STVREN = OFF ; Stack full/underflow will not cause Reset CONFIG LVP = OFF ; Single-Supply ICSP disabled CONFIG BBSIZ = OFF ; 1kW boot block size CONFIG XINST = OFF ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode) CONFIG CP0 = OFF ; Block 0 not code-protected CONFIG CP1 = OFF ; Block 1 not code-protected CONFIG CPB = OFF ; Boot block not code-protected CONFIG CPD = OFF ; Data EEPROM not code-protected CONFIG WRT0 = OFF ; Block 0 not write-protected CONFIG WRT1 = OFF ; Block 1 not write-protected CONFIG WRTB = OFF ; Boot block not write-protected CONFIG WRTC = OFF ; Configuration registers not write-protected CONFIG WRTD = OFF ; Data EEPROM not write-protected CONFIG EBTR0 = OFF ; Block 0 not protected from table reads executed in other blocks CONFIG EBTR1 = OFF ; Block 1 not protected from table reads executed in other blocks CONFIG EBTRB = OFF ; Boot block not protected from table reads executed in other blocks ;****************************************************************************** ;VARIABLE DEFINITIONS CBLOCK 0X080 WREG_TEMP ;VARIABLE USED FOR CONTEXT SAVING STATUS_TEMP ;VARIABLE USED FOR CONTEXT SAVING BSR_TEMP ;VARIABLE USED FOR CONTEXT SAVING ENDC CBLOCK 0X000 EXAMPLE ; EXAMPLE OF A VARIABLE IN ACCESS RAM EXEMPLE2 ; UN AUTRE OCTET ENDC ;EEPROM DATA ORG 0XF00000 DE "TEST DATA",0,1,2,3,4,5 ; DEFINITION DES CONSTANTES RAMADR EQU 0X80 ; VECTEUR DE RESET ORG 0X0000 GOTO START ; GO TO START OF MAIN CODE ;HIGH PRIORITY INTERRUPT VECTOR ORG 0X0008 BRA HIGHINT ; GO TO HIGH PRIORITY INTERRUPT ROUTINE ;LOW PRIORITY INTERRUPT VECTOR AND ROUTINE ORG 0X0018 MOVFF STATUS,STATUS_TEMP ;SAVE STATUS REGISTER MOVFF WREG,WREG_TEMP ;SAVE WORKING REGISTER MOVFF BSR,BSR_TEMP ;SAVE BSR REGISTER ; *** INTERRUPTION DE BAS NIVEAU A ECRIRE MOVFF BSR_TEMP,BSR ;RESTORE BSR REGISTER MOVFF WREG_TEMP,WREG ;RESTORE WORKING REGISTER MOVFF STATUS_TEMP,STATUS ;RESTORE STATUS REGISTER RETFIE ;HIGH PRIORITY INTERRUPT ROUTINE HIGHINT: ; *** INTERRUPTION PRIORITAIRE A ECRIRE RETFIE FAST ;START OF MAIN PROGRAM
Em 13/12/2010 03:49, Dennis escreveu:

>>> On Dec 11, 1:43 pm, "Dennis"<no...@nowhere.com> wrote: >>>> Dummies question here... >>>> >>>> I'm starting out on a new PIC device 18LF14K22, using MPLAB / C18. Where >>>> can >>>> I find templates with config bits / int vector definitions etc all ready >>>> to >>>> go? >>>> >>>> I poked around on Microchips site with no success. >>>> >>>> Thanks >>>
[snipped]
> > Nope. More like what I've attached below. Judging by the responses I don't > think they exist (or are regarded as too simple). Thanks for the reply. >
[snipped] Dennis, If I understood correctly what you want, and since you mention you want go the C18 route, I think you should check the PIC18F Peripheral Library Help Document (it is in the MCC18\doc folder in your C18 installation). This library has a set of functions, and for each peripheral a specific one to set parameters and/or initialize the peripheral, so you won't need to think in terms of individual bits. The document explain the use of macros used for the options, so you have some homework to do. If you peruse the three examples in D:\MCC18\example\users_guide\, you'll find they use the peripheral libraries. Another option you may try is the utility called VDI which has a GUI for setting the peripheral options and then it generates a module (C or ASM) which you include in your project. This may be useful if for some reason you don't want or can not use the libraries. HTH -- Cesar Rabak -- Cesar Rabak GNU/Linux User 52247. Get counted: http://counter.li.org/
"Cesar Rabak" <csrabak@bol.com.br> wrote in message 
news:ie57e5$143$1@news.eternal-september.org...
> Em 13/12/2010 03:49, Dennis escreveu: > >>>> On Dec 11, 1:43 pm, "Dennis"<no...@nowhere.com> wrote: >>>>> Dummies question here... >>>>> >>>>> I'm starting out on a new PIC device 18LF14K22, using MPLAB / C18. >>>>> Where >>>>> can >>>>> I find templates with config bits / int vector definitions etc all >>>>> ready >>>>> to >>>>> go? >>>>> >>>>> I poked around on Microchips site with no success. >>>>> >>>>> Thanks >>>> > [snipped] >> >> Nope. More like what I've attached below. Judging by the responses I >> don't >> think they exist (or are regarded as too simple). Thanks for the reply. >> > [snipped] > > Dennis, > > If I understood correctly what you want, and since you mention you want go > the C18 route, I think you should check the PIC18F Peripheral Library Help > Document (it is in the MCC18\doc folder in your C18 installation). > > This library has a set of functions, and for each peripheral a specific > one to set parameters and/or initialize the peripheral, so you won't need > to think in terms of individual bits. The document explain the use of > macros used for the options, so you have some homework to do. > > If you peruse the three examples in D:\MCC18\example\users_guide\, you'll > find they use the peripheral libraries. > > Another option you may try is the utility called VDI which has a GUI for > setting the peripheral options and then it generates a module (C or ASM) > which you include in your project. This may be useful if for some reason > you don't want or can not use the libraries. > > HTH > Cesar Rabak > GNU/Linux User 52247. > Get counted: http://counter.li.org/
Thanks for the reply Cesar. I've seen both the documents / examples you refer to. The VDI is more along the lines of what I am looking for. I can't find much info about it on microchips website. The option for it in my installation of MPLAB is greyed out/disabled. I'll hunt around some more and see if I can find an install file or similar. Thank you.
"Dennis" <noone@nowhere.com> wrote in message 
news:n5ednezgyv2t65rQnZ2dnUVZ_i2dnZ2d@westnet.com.au...
> > "Cesar Rabak" <csrabak@bol.com.br> wrote in message > news:ie57e5$143$1@news.eternal-september.org... >> Em 13/12/2010 03:49, Dennis escreveu: >> >>>>> On Dec 11, 1:43 pm, "Dennis"<no...@nowhere.com> wrote: >>>>>> Dummies question here... >>>>>> >>>>>> I'm starting out on a new PIC device 18LF14K22, using MPLAB / C18. >>>>>> Where >>>>>> can >>>>>> I find templates with config bits / int vector definitions etc all >>>>>> ready >>>>>> to >>>>>> go? >>>>>> >>>>>> I poked around on Microchips site with no success. >>>>>> >>>>>> Thanks >>>>> >> [snipped] >>> >>> Nope. More like what I've attached below. Judging by the responses I >>> don't >>> think they exist (or are regarded as too simple). Thanks for the reply. >>> >> [snipped] >> >> Dennis, >> >> If I understood correctly what you want, and since you mention you want >> go the C18 route, I think you should check the PIC18F Peripheral Library >> Help Document (it is in the MCC18\doc folder in your C18 installation). >> >> This library has a set of functions, and for each peripheral a specific >> one to set parameters and/or initialize the peripheral, so you won't need >> to think in terms of individual bits. The document explain the use of >> macros used for the options, so you have some homework to do. >> >> If you peruse the three examples in D:\MCC18\example\users_guide\, you'll >> find they use the peripheral libraries. >> >> Another option you may try is the utility called VDI which has a GUI for >> setting the peripheral options and then it generates a module (C or ASM) >> which you include in your project. This may be useful if for some reason >> you don't want or can not use the libraries. >> >> HTH >> Cesar Rabak >> GNU/Linux User 52247. >> Get counted: http://counter.li.org/ > > > > > Thanks for the reply Cesar. I've seen both the documents / examples you > refer to. > > The VDI is more along the lines of what I am looking for. I can't find > much > info about it on microchips website. The option for it in my installation > of > MPLAB is greyed out/disabled. I'll hunt around some more and see if I can > find an install file or similar. Thank you. > > > > > >
Looks like VDI is gone or on the way out: http://www.microchip.com/forums/m525116.aspx http://www.microchip.com/forums/tm.aspx?high=&m=453578&mpage=1#496509
Em 14/12/2010 11:51, Dennis escreveu:
> "Dennis"<noone@nowhere.com> wrote in message > news:n5ednezgyv2t65rQnZ2dnUVZ_i2dnZ2d@westnet.com.au... >> >> "Cesar Rabak"<csrabak@bol.com.br> wrote in message
[snipped]
>>> >>> Dennis, >>> >>> If I understood correctly what you want, and since you mention you want >>> go the C18 route, I think you should check the PIC18F Peripheral Library >>> Help Document (it is in the MCC18\doc folder in your C18 installation). >>> >>> This library has a set of functions, and for each peripheral a specific >>> one to set parameters and/or initialize the peripheral, so you won't need >>> to think in terms of individual bits. The document explain the use of >>> macros used for the options, so you have some homework to do. >>> >>> If you peruse the three examples in D:\MCC18\example\users_guide\, you'll >>> find they use the peripheral libraries. >>> >>> Another option you may try is the utility called VDI which has a GUI for >>> setting the peripheral options and then it generates a module (C or ASM) >>> which you include in your project. This may be useful if for some reason >>> you don't want or can not use the libraries. >>>
>> Thanks for the reply Cesar. I've seen both the documents / examples you >> refer to. >> >> The VDI is more along the lines of what I am looking for. I can't find >> much >> info about it on microchips website. The option for it in my installation >> of >> MPLAB is greyed out/disabled. I'll hunt around some more and see if I can >> find an install file or similar. Thank you. >> >> > > Looks like VDI is gone or on the way out: > http://www.microchip.com/forums/m525116.aspx > http://www.microchip.com/forums/tm.aspx?high=&m=453578&mpage=1#496509 >
Yes, users of it had a lot of complaints, so probably the motives explained in the second link are the reason for. Given you want to use C18, I suggest you go to the library route. Regards, -- Cesar Rabak GNU/Linux User 52247. Get counted: http://counter.li.org/
"Cesar Rabak" <csrabak@bol.com.br> wrote in message 
news:ie8onl$7dm$1@news.eternal-september.org...
> Em 14/12/2010 11:51, Dennis escreveu: >> "Dennis"<noone@nowhere.com> wrote in message >> news:n5ednezgyv2t65rQnZ2dnUVZ_i2dnZ2d@westnet.com.au... >>> >>> "Cesar Rabak"<csrabak@bol.com.br> wrote in message > [snipped] >>>> >>>> Dennis, >>>> >>>> If I understood correctly what you want, and since you mention you want >>>> go the C18 route, I think you should check the PIC18F Peripheral >>>> Library >>>> Help Document (it is in the MCC18\doc folder in your C18 installation). >>>> >>>> This library has a set of functions, and for each peripheral a specific >>>> one to set parameters and/or initialize the peripheral, so you won't >>>> need >>>> to think in terms of individual bits. The document explain the use of >>>> macros used for the options, so you have some homework to do. >>>> >>>> If you peruse the three examples in D:\MCC18\example\users_guide\, >>>> you'll >>>> find they use the peripheral libraries. >>>> >>>> Another option you may try is the utility called VDI which has a GUI >>>> for >>>> setting the peripheral options and then it generates a module (C or >>>> ASM) >>>> which you include in your project. This may be useful if for some >>>> reason >>>> you don't want or can not use the libraries. >>>> > >>> Thanks for the reply Cesar. I've seen both the documents / examples you >>> refer to. >>> >>> The VDI is more along the lines of what I am looking for. I can't find >>> much >>> info about it on microchips website. The option for it in my >>> installation >>> of >>> MPLAB is greyed out/disabled. I'll hunt around some more and see if I >>> can >>> find an install file or similar. Thank you. >>> >>> >> >> Looks like VDI is gone or on the way out: >> http://www.microchip.com/forums/m525116.aspx >> http://www.microchip.com/forums/tm.aspx?high=&m=453578&mpage=1#496509 >> > > Yes, users of it had a lot of complaints, so probably the motives > explained in the second link are the reason for. > > Given you want to use C18, I suggest you go to the library route. > > Regards, > > -- > Cesar Rabak > GNU/Linux User 52247. > Get counted: http://counter.li.org/
Thanks Cesar.

The 2024 Embedded Online Conference