Searching \ for '[PIC] Help Needed using Dspic30f4011!!!' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=spi
Search entire site for: 'Help Needed using Dspic30f4011!!!'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Help Needed using Dspic30f4011!!!'
2011\08\24@142743 by xavierpereira

picon face

Hello everyone ,
I m working on my senior project and I m in real need for help with
programming dspic30f4011. I need to know how do I write a code for capturing
volatge ands current from battery of 12 V.

I have already deisgn the circuitry to sense battery voltage and Current

My circuit has 2 output sugnals (current and voltage) which connect to the
ADC channels of DSPIC ..

I also need to set the duty cycle and the output should be at PWM port of
DSPIC which inturn is connected to the Mosfet gate driver..

If any one has feed backs or sample code to start with I would highly
appreciate the effort ..

Thank You An engineer in Need !!! -- View this message in context: old.nabble.com/Help-Needed-using-Dspic30f4011%21%21%21-tp32328270p32328270.html
Sent from the PIC - [PIC] mailing list archive at Nabble.com.

2011\08\24@201829 by M.L.

flavicon
face
On Wed, Aug 24, 2011 at 2:27 PM, xavierpereira <spam_OUTawesomeness.xaTakeThisOuTspamgmail.com> wrote:
>
> Hello everyone ,
> I m working on my senior project and I m in real need for help with
> programming dspic30f4011. I need to know how do I write a code for capturing
> volatge ands current from battery of 12 V.
>

http://www.microchip.com/wwwcategory/TaxonomySearch.aspx?show=Application%20Notes&ShowField=no

-- Martin K

2011\08\25@064533 by cdb

flavicon
face
::I m working on my senior project and I m in real need for help with
::programming dspic30f4011.

Look in your library for a book by Creed Huddlestone 'Intelligent Sensor Design' which is aimed at the DSPIC, it has a chapter on the ADC, there is also a mighty large book by Robert Reese (Course Technology CENGAGE Learning) which although aimed at the PIC24 series, goes into great details with template code for the advanced ADC's and PWM's.

You could also check out the 'C' ADC and PWM library code for the Microchip DSPIC compiler.
Colin


--
cdb, .....colinKILLspamspam@spam@btech-online.co.uk on 25/08/2011
Web presence: http://www.btech-online.co.uk   Hosted by:  http://www.justhost.com.au
 This email is to be considered private if addressed to a named  individual or HR department, and public if addressed to a blog,  forum or news article.

2011\08\25@091944 by M.L.

flavicon
face
On Thu, Aug 25, 2011 at 6:45 AM, cdb <colinspamKILLspambtech-online.co.uk> wrote:
> ::I m working on my senior project and I m in real need for help with
> ::programming dspic30f4011.
>
> Look in your library for a book by Creed Huddlestone 'Intelligent Sensor
> Design' which is aimed at the DSPIC, it has a chapter on the ADC, there is
> also a mighty large book by Robert Reese (Course Technology CENGAGE
> Learning) which although aimed at the PIC24 series, goes into great details
> with template code for the advanced ADC's and PWM's.
>
> You could also check out the 'C' ADC and PWM library code for the Microchip
> DSPIC compiler.
>
> Colin


If you do this, make sure the peripherals are the same variety for
your dsPIC30F4011 as they're talking about in the book. There are
several varieties of ADC and PWM now.

Xavier, basically you will need to read the data sheet sections that
describe the peripherals you want to use, and set the bits for all of
the setup registers. Simulate your code step-by-step in MPLAB and you
can somewhat see if it is working or not before you try to run real
hardware. Don't be afraid to spend a few days reading documentation.
It will help you very much.

-- Martin K

2011\08\31@062857 by alan.b.pearce

face picon face
> If you do this, make sure the peripherals are the same variety for
> your dsPIC30F4011 as they're talking about in the book. There are
> several varieties of ADC and PWM now.

Agreed, Check the data sheet and read the appropriate sections of the family reference manual - you can download those from the microchip page for the chip you have.

> Xavier, basically you will need to read the data sheet sections that
> describe the peripherals you want to use, and set the bits for all of
> the setup registers. Simulate your code step-by-step in MPLAB and you
> can somewhat see if it is working or not before you try to run real
> hardware. Don't be afraid to spend a few days reading documentation.
> It will help you very much.

Many of the datasheets now do not have a lot of information other than bare bones data. Much of it has been hived off to the family Reference manual, which is where the detailed descriptions of the peripherals is given.




-- Scanned by iCritical.

2011\08\31@092541 by M.L.

flavicon
face
On Wed, Aug 31, 2011 at 6:28 AM,  <.....alan.b.pearceKILLspamspam.....stfc.ac.uk> wrote:
>> Xavier, basically you will need to read the data sheet sections that
>> describe the peripherals you want to use, and set the bits for all of
>> the setup registers. Simulate your code step-by-step in MPLAB and you
>> can somewhat see if it is working or not before you try to run real
>> hardware. Don't be afraid to spend a few days reading documentation.
>> It will help you very much.
>
> Many of the datasheets now do not have a lot of information other than bare bones data. Much of it has been hived off to the family Reference manual, which is where the detailed descriptions of the peripherals is given.
>
>

Essentially what I meant - the reference manual pieces are called "Sections.."

-- Martin K

2011\08\31@094848 by alan.b.pearce

face picon face
> Essentially what I meant - the reference manual pieces are called "Sections."

Yeah, but the datasheet also has very brief sections on each peripheral, so easy to get confused.




-- Scanned by iCritical.


'[PIC] Help Needed using Dspic30f4011!!!'
2011\09\02@140545 by xavierpereira
picon face



xavierpereira wrote:
{Quote hidden}

thanks guys for all the help I got the facts of dspic staright now
but my only problem is how do i make my dspic do this
so if i sense the 12v Battery voltage from the analog input it will covert
the volatge to Digital As the Duty Cycle will be the Function of the Input Volatge and voltage
reference(ie 12 V ).
I have to set this Duty Cycle Value to the PWM pin.. I need a formula or
some hints to write this algorithim
HElp please!!


-- View this message in context: old.nabble.com/Help-Needed-using-Dspic30f4011%21%21%21-tp32328270p32388678.html
Sent from the PIC - [PIC] mailing list archive at Nabble.com.

2011\09\03@062729 by cdb

flavicon
face
On Fri, 2 Sep 2011 11:05:44 -0700 (PDT), xavierpereira wrote:
:: As the Duty Cycle will be the Function of the Input Volatge and
:: voltage
:: reference(ie 12 V ).
:: I have to set this Duty Cycle Value to the PWM pin.. I need a
:: formula or some hints to write this algorithim

OK, let's think about this.

What voltage is going to be at the input pin of the ADC?

I'm assuming the max voltage is 3v3 or is a DSPIC a 5v part?
Once you've got that and you know what the maximum count is and minimum assuming you are referencing the ADC as 0 -> Max Vdd - all you then have to do is work out what voltage points you are going to make valid, that is are you only responding to per volt or per half volt etc, once you've decided that all you need to do is map those counts that equal the voltage to PWM values.

You could use a look up table, but you could also have a either an IF ... Else... code block or if many values perhaps a Case block which would be something like:

Case: nought_counts to count_equals_1v;       duty_cycle = some_value;       sub_change_duty();        break;

repeat for other voltage counts.

You haven't mentioned what the Mosfet will be switching, so how you decide how to allocate the duty cycle to the voltage input will have a great bearing on what ADC count you assign to what duty cycle value.

Hoping this won't confuse you, but here is some code for an 8 bit device that increments the duty cycle of a PWM as a soft start to drive a fan motor derived from a humidity reading.

void trip_check(trips *pTrip)
{
       if (rh_adj < pTrip->humidity )
         {                                        //if current humidity < trip humidity switch on with soft start
               CCP1CON=0x2C;                                //PWM module1 on, output pin RC2
                                       
               if (++duty1 > 30)
                {
                   duty1=31;
                }
               CCPR1L=duty1;
         }
       else
         {
               if(!(duty1 == 0))
                  duty1--;
               CCPR1L=duty1;
               #asm
                 movf duty1,W
                 btfsc STATUS,Z        ;Is duty zero?
                 movwf CCP1CON                ;Yes so turn CCP1 off        
               #asmend

Ignore the fact that part of it is in assembler that is purely because the compiler produces more assembler code than I like. Note that (if I recall correctly) 31 is about the maximum figure that CCPR1L can take for the 16F87x series, you'll need to check your datasheet for your dsPic to see what the maximum number is.

There is a code example for the dsPIC30F4012 which is for driving a brushless motor, it takes the ADC value (as a speed control) and applies that as a duty cycle to change the speed of the motor.

ww1.microchip.com/downloads/en/DeviceDoc/CE003_Sinusoidal_BLDC_01090
8.zip

Strip away the bits you don't want and the general idea if what you need to do is there.

Colin
--
cdb, EraseMEcolinspam_OUTspamTakeThisOuTbtech-online.co.uk on 3/09/2011
Web presence: http://www.btech-online.co.uk   Hosted by:  http://www.justhost.com.au
 This email is to be considered private if addressed to a named  individual or HR department, and public if addressed to a blog,  forum or news article.
 

2011\09\13@132851 by xavier

picon face
Thanks a lot for that valuable info,I m using tha techniques u showed me here ..i
Could u tell me tha difference between capacitively driven Mosfet and transformer coupled driven Mosfet coz my circuit uses tha transformercoupled driver. And due to unavailability I wanted to use tha Capacitively driven mosfet
Wondering what would be tha effect ?
    lambs become Lions

{Original Message removed}

2011\09\13@134929 by Bob Blick

face
flavicon
face
Hi Xavier,

You must observe the subject line and topic tagging conventions on the
Piclist.

Your subject line should include the topic tag and a subject appropriate
to the email.

Don't hijack an old thread with new content!

Your new email is not about PICs, it is about driving MOSFETs. The
appropriate tag is [EE].

A subject line like this might be good:

[EE] Driving MOSFETs

Please try again.

Thanks,

Bob

On Tuesday, September 13, 2011 5:26 PM, "xavier"
<awesomeness.xaspamspam_OUTgmail.com> wrote:
{Quote hidden}

> {Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2011 , 2012 only
- Today
- New search...