A Defines Request


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1
    Join Date
    Mar 2004
    Location
    UK-Midlands
    Posts
    84


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    Hi,

    Only had time for a quick look. But from what I can see on your diagrams in post 1. The back EMF diodes are not correctly fitted and seem to be connected differently to the prototype board. The diodes should go across the coil contacts with the 'band' connected to the +ive coil side.

    Quote Originally Posted by Kirk Fraser View Post
    This seems reasonable since the PWM outputs are analog signals and driving the IRL530's with a solid digital on could act like a short, allowing coil current to build and eventually blow things up. This could explain the blown chips with the global commands.
    The Pulse Width Modulator outputs are digital. The on and off time is variable and is what you adjust within the program. The amount of high back EMF that PWM will generate on this circuit will wreck havoc with the PIC. Move the diodes and test the circuit by replacing the coils with small lamps .

    Also good pratice to fit 1k resistors to the gate connections from the PIC as directly connecting the PIC to the FETs can cause a 'lock on'.

    Bob.

  2. #2
    Join Date
    Feb 2011
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    Bob,

    Thanks, I've added 1K gate resistors and replaced the coils with LED's for testing which should save some parts from burnout. The diodes are electrically connected according to your description, just not near the coils.

    Back to learning how to set up the PWM command.

    Kirk

  3. #3
    Join Date
    Mar 2004
    Location
    UK-Midlands
    Posts
    84


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    Hi Kirk,

    If you can use bulbs you will see the PWM better. Let us know how you get on?

    Bob

  4. #4
    Join Date
    Feb 2011
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    I put in the program revision below but again nothing happened. Since all my stuff is already posted earlier, I thought just discussing this section would be most efficient. Any discussion on content or how I can learn to improve the content is welcome. Thanks.

    '*** Start of help request ***
    DEFINE OSC 48
    @ __CONFIG _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    @ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
    @ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_512_2H
    @ __CONFIG _CONFIG2L, _PWRT_ON_2L & _VREGEN_ON_2L
    @ __CONFIG _CONFIG3H, _PBADEN_OFF_3H & _MCLRE_OFF_3H
    @ __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    ADCON0 = 3 ' Setup PortA.0 for A/D function
    OSCCON = %01110000
    '*** End of help request ***

  5. #5
    Join Date
    Feb 2011
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    Has anyone gotten the and RCTIME and PWM commands to work? I looked at a C18 program and it looks like one may have to do so much low-level progamming that I wonder if there's more that PB doesn't do besides the config bits.

    Here's my latest failure:

    DEFINE OSC 48
    @ __CONFIG _CONFIG1L, _PLLDIV_12_1L & _CPUDIV_OSC4_PLL6_1L & _USBDIV_2_1L
    @ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEM_OFF_1H & _IESO_OFF_1H
    @ __CONFIG _CONFIG2L, _VREGEN_ON_2L & _PWRT_OFF_2L & _BOR_OFF_2L & _BORV_28_2L
    @ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_32768_2H
    @ __CONFIG _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_ON_3H & _CCP2MX_ON_3H
    @ __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L
    @ __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L
    @ __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
    @ __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L
    @ __CONFIG _CONFIG6H, _WRTB_OFF_6H & _WRTC_OFF_6H & _WRTD_OFF_6H
    @ __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L
    @ __CONFIG _CONFIG7H, _EBTRB_OFF_7H

    I checked the bit configuration above with the PIC18F4550 part of the PIC18 Configuration Settings Addendum, so the above is at least legal syntax, even though I don't know what most of it means. Then I checked the above with the bits which worked to get LED's to flash. I discovered a few differences.

    DEFINE OSC 8
    @ __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    @ __CONFIG _CONFIG1H, _FOSC_INTOSCIO_EC_1H
    @ __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
    @ __CONFIG _CONFIG3H, _PBADEN_OFF_3H & _MCLRE_OFF_3H
    @ __CONFIG _CONFIG4L, _LVP_OFF_4L & _ICPRT_OFF_4L &_XINST_OFF_4L
    OSCCON = %01110000

    Some bits are identical, some are set opposite or differently, and some are new while many are ignored in the working application. So I started looking up the differences in the data sheet and found deeper layers which I don't understand. Apparently each group of pins has its own set of potential configurations. I don't even know how to write things from the pin layer based on the table in the data sheet for example in chapter 10.0 I/O PORTS starting on page 113 of the PIC18F4550 data sheet, tables 10-1 and 10-2.

    Is there an example of how to set up the bits so a program like mine, posted above, with RCTIME and PWM commands, to make the program work? Thank you.
    Last edited by Kirk Fraser; - 31st March 2011 at 23:34.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts