Jump to content

Recommended Posts

Exploring Boostc as an alternative code developing package

 

Done all the preliminaries, plugins and samples, but the ADC does not appear to want to cooperate .

Is this function operational with the free code

 

Thanks in advance, anyone!

Share this post


Link to post
Share on other sites

There is no reason why it shouldn't work.

 

There are a few small issues though. I'll have to 'talk around them' as I am referring to the Library source which is only available to NOVO and BoostC PRO licence holders, so I can't disclose it

 

There used to be as function adc_init() which had exactly the same effect as the code block in the manual, (immediately after 'A sample ADC initialization can look like:'). It is commented out in the library source as the user needs to be able to adjust Tad for their clock speed.

  • Use the initialisation given starting at the second line, and dont change the line 'set_bit(adcon1, ADFM);' or you will break adc_measure().
  • Dont use the first line 'volatile bit adc_on @ ADCON0 . ADON;' because it is properly defined in adc.h.

adc_measure() selects a channel in the range 0 to 7 by putting it in bits 5 to 3 of ADCON0. It then allows 20us acquisition time, starts the conversion and polls for it to end, then returns the result. Obviously this wont work for PICs with more than 8 ADC channels!

 

It is simple enough to directly convert the assembler code in your PIC's data sheet to write a compatible function (or even use it 'as is' in inline assembly - just strip out all bank selection code as BoostC Asm handles that for you) and it *WILL* WORK, usually first time! ;-)

 

N.B. the simulator only supports the ADC for a sub-set of the devices simulated

A/D converter - only PIC16F877A and compatible types, ie PIC16C925, PIC16C926, PIC16F818, PIC16F819, PIC16F870, PIC16F871, PIC16F872, PIC16F873, PIC16F873A, PIC16F874, PIC16F874A, PIC16F876, PIC16F876A, PIC16F877, PIC16F877A. Other devices with A/D Convertor are not supported.
Input *must* be on a PORTA ADC pin. If you choose a different PIC it doesn't work in the simulator!

 

Also the signal generator and variable power supply plugins to feed it a voltage level are only available if you have bought the extra plugin pack.

 

You wont have any problems if you debug your ADC related code on real hardware with an in circuit debugger. Microchip MPLAB + a PICkit 2/3 or ICD 2/3 will do the job quite nicely. You will need to make an equivalent MPLAB project and rebuild it from within that to enable source level debugging.

Share this post


Link to post
Share on other sites
There is no reason why it shouldn't work.

 

There are a few small issues though. I'll have to 'talk around them' as I am referring to the Library source which is only available to NOVO and BoostC PRO licence holders, so I can't disclose it

 

There used to be as function adc_init() which had exactly the same effect as the code block in the manual, (immediately after 'A sample ADC initialization can look like:'). It is commented out in the library source as the user needs to be able to adjust Tad for their clock speed.

  • Use the initialisation given starting at the second line, and dont change the line 'set_bit(adcon1, ADFM);' or you will break adc_measure().
  • Dont use the first line 'volatile bit adc_on @ ADCON0 . ADON;' because it is properly defined in adc.h.

adc_measure() selects a channel in the range 0 to 7 by putting it in bits 5 to 3 of ADCON0. It then allows 20us acquisition time, starts the conversion and polls for it to end, then returns the result. Obviously this wont work for PICs with more than 8 ADC channels!

 

It is simple enough to directly convert the assembler code in your PIC's data sheet to write a compatible function (or even use it 'as is' in inline assembly - just strip out all bank selection code as BoostC Asm handles that for you) and it *WILL* WORK, usually first time! ;-)

 

N.B. the simulator only supports the ADC for a sub-set of the devices simulated

A/D converter - only PIC16F877A and compatible types, ie PIC16C925, PIC16C926, PIC16F818, PIC16F819, PIC16F870, PIC16F871, PIC16F872, PIC16F873, PIC16F873A, PIC16F874, PIC16F874A, PIC16F876, PIC16F876A, PIC16F877, PIC16F877A. Other devices with A/D Convertor are not supported.
Input *must* be on a PORTA ADC pin. If you choose a different PIC it doesn't work in the simulator!

 

Also the signal generator and variable power supply plugins to feed it a voltage level are only available if you have bought the extra plugin pack.

 

You wont have any problems if you debug your ADC related code on real hardware with an in circuit debugger. Microchip MPLAB + a PICkit 2/3 or ICD 2/3 will do the job quite nicely. You will need to make an equivalent MPLAB project and rebuild it from within that to enable source level debugging.

 

Thanks for the useful info IanM; sorry for the late reply - been on vacation.

 

I have been coding in hi-tec C within the MPLAB environment and then running the code in an ISIS lite developed circuit which works fine. BoostC is something of an alternative and looks like a cost saving excercise.

I have purchased the additional plug-ins; one question- I am using a 16F877 PIC to evaluate BoostC and when configuring the ADCON1 reg control bits for adc mode, is it required to include the Vdd and Vss references within the PSU plug-in?

Share this post


Link to post
Share on other sites
I have purchased the additional plug-ins; one question- I am using a 16F877 PIC to evaluate BoostC and when configuring the ADCON1 reg control bits for adc mode, is it required to include the Vdd and Vss references within the PSU plug-in?
No.

 

Regards

Dave

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...