A Defines Request


Closed Thread
Results 1 to 23 of 23
  1. #1
    Join Date
    Feb 2011
    Posts
    19

    Default A Defines Request

    The attached program, prototype photo, and schematic appear to work with a Stamp. How can I get it to work on my PIC18F4550 for more speed? Thank you.
    Attached Images Attached Images   
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Feb 2011
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    Actually, the data sheet (book) is not real handy in either .pdf or paper form. It is not object oriented, educational, or structurally organized. Because of my past work hiring people overseas, I bet it was written in the Orient then translated to English by an English major (word for word) instead of a programmer / educator who would organize it and provide clear explinations.

    Maybe you could make some money selling a book that is actually handy. Please give it a try. I wrote a book last summer in about 2 weeks of writing 10 hours a day, followed by 2 months of less intense work perfecting it. It didn't sell well but one advantage is that much concentration got a lot of original ideas on paper and new ideas keep coming.

    http://www.picbasic.co.uk/forum/show...392#post100392
    > Post your specific problem (along with your code and stuff) and we will be glad to help.

    Still waiting for that help. Not that it wasn't fun spending half a day drawing, photographing, copying, and posting according to your request.

    Until you decide to provide some real help as you wrote you'd gladly do, I'll have to proceed with my current project on a Stamp which is programmed in Basic only. BTW, who do I address suggestions for improving PIC Basic Pro to?

    Any suggestions for a forum to recruit a low-cost PIC consultant? Many of the low cost people are harder to find.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,519


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    Hi Kirk,
    All you've really said is that your circuit and/or code doesn't work. That's not a lot for anyone to work with. What exactly doesn't work, do you have power? Does the PIC run at all?

    Hardware wise you don't seem to have any decoupling caps across the powersupply pins on the PIC. You have 5V and ground connected to pins 11 and 12 but not to 31 and 32 - there's two things to check.

    Software wise mackrackit did provide you with one possible (and likely) cause for it not working as you might expect. Several pins are multiplexed between peripheral inside the PIC, like ADC and comparators. You have stuff connected to PortA and the link given in the previous post explains a lot of details about that - if you haven't read it I suggest you do so.

    If it still doesn't work, try verifying that the PIC runs. Blink a LED to begin with, work your way up from there.

    With more capable devices, such as the 4550 compared to the BasicStamp, there's also more things that needs to be setup properly in order to work properly, that's just the way it is.

    Regarding the datasheet I personally think that Microchip produces one of, if not the the best datasheets I've seen. Yes, it's several hundred pages but that's what it takes to cover a device like this.

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    Ok, so you are new to gleaning info from a data sheet. They can be overwhelming at times. But things like connecting power should be pretty straight forward. That is why I mentioned the data sheet.

    Code:
    ADCON1 = 15               ' Set all I/Os to Digital      
    CMCON = 7                 ' Disable Comparators
    Is what you will need to add near the beginning of your code.

    BTW, who do I address suggestions for improving PIC Basic Pro to?
    It is obvious you are new to PBP so how can you say it needs improvement?
    Dave
    Always wear safety glasses while programming.

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    Tris Registers?

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    Quote Originally Posted by mark_s View Post
    Tris Registers?
    The OP needs to learn about those also, but if I am not missing something his code is using commands that set TRIS in the background.
    Dave
    Always wear safety glasses while programming.

  8. #8


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    Quote Originally Posted by mackrackit View Post
    The OP needs to learn about those also, but if I am not missing something his code is using commands that set TRIS in the background.
    Dave,

    Did not realize that. thanks.

    But, I always set them even if it's not needed.

  9. #9
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    Quote Originally Posted by mark_s View Post
    But, I always set them even if it's not needed.
    That is good practice along with good code comments. It does not hurt a thing.
    Dave
    Always wear safety glasses while programming.

  10. #10
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    You can follow the same topic here How do I learn configuration?
    Why pay for overpriced toys when you can have
    professional grade tools for FREE!!!

  11. #11
    Join Date
    Feb 2011
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    Dear Dave,

    Attached is the latest program. I did add the suggested capacitor between the +-5 supply lines. Somehow I smoked a regulator and PIC trying it. I got new chips and retried our program to flicker the LEDs and that worked fine. I tried the attached program (with your suggested OSC 48 configs ADCON1 and CMCON plus the OSCCON from the LED program) . It sounded like it was driving the valve coil but the 5VDC regulator started to smoke then it settled down and looked ok with one LED lit except the program, the same as the one which works on the stamp, didn't change anything when the POT was turned. Eventually I reloaded the program to make sure I hadn't fried the PIC chip and tried it with a new regulator. This time all three LEDs were on bright and the regulator shot a bit of plastic (about half the front) and hit me in the stomach. Any suggestions?

    With assistance from the other forum I located the Bits section and saw the config table. I wonder why the stuff they specify such as config1L PLLDIV has extra syntax like _CONFIG1L, _PLLDIV_1_1L and similar for all specified bits. Where is that documented?

    Also, your ADCON1 'Set all I/O's to Digital and CMCON 'Disable Comparators would seem to turn off the analog function needed on pin 2 aka. PORTA.0 which is supposed to read a Pot and Capacitor for the RCTIME command. Could that have anything to do with blowing up the regulator? I'll try it without after posting this.

    Thanks,
    Kirk
    Attached Files Attached Files

  12. #12
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    I can not look at your current code where I am at. If it were posted inline with code tags I could.

    ADCON1 = 15
    Turns off the hardware ADC
    CMCON = 7
    Turns off the hardware comparators.

    RCTIME is a software command having nothing to do with the above.

    Running the LEDs without a resistor could be overloading the regulator, at least until they pop. Is the schematic posted really what you are working with? Even with a Stamp resistors are needed.
    Dave
    Always wear safety glasses while programming.

  13. #13
    Join Date
    Feb 2011
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    Dave,

    Retesting confirms, your latest suggestion burned out my regulator and a PIC18F4550 in addition to smacking me in the stomach. (Now I see why your "Wear Safety Glasses" comment is serious.)
    ADCON1 = 15 ' Set all I/Os to Digital
    CMCON = 7 ' Disable Comparators
    Commenting out those two statements got me back to the original post on this thread. Now it simply doesn't work even though the current regulator works shown via voltmenter and PIC works proven by reloading the program.

    LED resisters are NOT needed on the Stamp. They were not needed when running the PIC with the LED test either, except to protect the LED's on start up - they worked fine when added after powered up. What LED resistor would you recommend?

    The schematic is exactly the same except for the crystal and its caps which aren't needed on the Stamp and the fact I forgot to show a cap across the regulator ground and 5V out, which can be seen in the photo. In fact the photo would be exactly the same when using the Stamp except wires connect the Stamp board with the IRL530's and the POT circuit and the absence of the PIC chip.

    So back to the original question for this thread. What do I need to change to make it work? Thanks.

    Kirk

    PS: I don't know what you mean by code tags but here's my current code.
    Code:
    'Hydraulic S-Curve Swing Test reducing limit shock
    '   Chips: PIC 18F4550 2x IRL530
    '   Inputs: 10K pot for actuator position
    '            ~USB for position control request
    '   Outputs: PWM for Proportional Servo-Valve
    '            ~USB for position report 
    '---------------
    INCLUDE "bs2defs.bas"
    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
    'ADCON1 = 15               ' Set all I/Os to Digital
    'CMCON = 7                 ' Disable Comparators
    OSCCON = %01110000
    
    'INPUT
    ArmPosIn      VAR PORTA.0     'Pot for swing arm position
    
    'OUTPUTS for PWM
    PWA              VAR PORTC.0
    PWB             VAR PORTC.1
    
    'DISPLAY LED's
    LGl           VAR PORTA.2 
    LRl          VAR PORTA.3 
    LYl           VAR PORTA.4 
    LGr          VAR PORTB.4 
    LRr           VAR PORTB.3 
    LYr           VAR PORTB.2 
     
    'CONSTANTS
    UpState     CON 0
    DnState     CON 1
    
    'VARIABLES
    ArmPos          VAR WORD
    CurrentState      VAR Bit
    Charge            VAR Word
    ChgLim          VAR Word 
    DnLimit     VAR Word
    DnTrans     VAR Word     
    UpTrans     VAR Word    
    UpLimit     VAR Word 
         
    'Initialize
    Charge = 0
    DnLimit = 100
    DnTrans = 200
    UpTrans = 800
    UpLimit = 900
    
    'Main Loop
    Begin:
    While 0 = 0
    LOW LGl
    LOW LRl
    LOW LYl
    LOW LGr
    LOW LRr
    LOW LYr
    
      HIGH ArmPosIn                ' charge the cap
      PAUSE 1                      '   for 1 ms
      RCTIME ArmPosIn, 1, ArmPos   ' measure RC discharge time
    
    ChgLim = 1<<8 - 1
    
    IF ArmPos >= UpLimit THEN
        CurrentState = DnState
        ChgLim = 0
        ENDIF
    IF ArmPos <= DnLimit THEN
        CurrentState = UpState
        ChgLim = 0
        ENDIF
    
     IF CurrentState = UpState AND ArmPos < DnTrans THEN
        GOSUB AccelUp
        GOTO Begin
     ENDIF
     IF CurrentState = UpState AND ArmPos < UpTrans THEN
        GOSUB FastUp
        GOTO Begin
     ENDIF
     IF CurrentState = UpState AND ArmPos < UpLimit THEN
        GOSUB DecelUp
        GOTO Begin
     ENDIF
     IF CurrentState = DnState AND ArmPos > UpTrans THEN
        GOSUB AccelDn
        GOTO Begin
     ENDIF
     IF CurrentState = DnState AND ArmPos > DnTrans THEN
        GOSUB FastDn
        GOTO Begin
     ENDIF
     IF CurrentState = DnState AND ArmPos > DnLimit THEN
        GOSUB DecelDn
     ENDIF
    Wend
    
    AccelUp:        '100 - 200 -> 0 - ChgLim
    Charge = (ArmPos - 100) * (ChgLim / 100)
    HIGH LGl
    GOSUB Coil_Output
    RETURN
    
    AccelDn:        '900 - 800 -> 0 - ChgLim
    Charge = ABS (900 - ArmPos) * (ChgLim / 100)
    HIGH LGr
    GOSUB Coil_Output
    RETURN
    
    FastUp:          'max speed
    Charge = ChgLim
    HIGH LRl
    GOSUB Coil_Output
    RETURN
    
    FastDn:          'max speed
    Charge = ChgLim
    HIGH LRr
    GOSUB Coil_Output
    RETURN
    
    DecelUp:        '800 - 900 -> ChgLim - 0
    Charge = (ArmPos - 800) * (ChgLim / 100)
    HIGH LYl
    GOSUB Coil_Output
    RETURN
    
    DecelDn:        '200 - 100 -> ChgLim - 0
    Charge = ABS (100 - ArmPos) * (ChgLim / 100)
    HIGH LYr
    GOSUB Coil_Output
    RETURN
    
    Coil_Output:
    ' PWM output code - 8 bit 
    Charge = ABS Charge MAX ChgLim 'Stop negatives when tweaking limits
    IF CurrentState = UpState THEN
    'Up: Coil A = Charge, B = 0
       PWM PWA,Charge,250
       LOW PWB
    ELSE
    'Dn: Coil A = 0, B = Charge
       LOW PWA
       PWM PWB,Charge,250
    ENDIF
    RETURN
    END
    Last edited by Archangel; - 20th March 2011 at 07:19. Reason: ADD Code Tags

  14. #14
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    Kirk, I agree that Dave's suggestions are spot on. but also no arguing with actual blown up parts. If this were my project, I would start by disconnecting everything and reconnecting it 1 at a time. I would start with the LED's (and add resistors) then I would add the pot section, lastly I would add 1 coil circuit at a time.

    I would suspect the answer can be found with the hardware, but sorry I do not know exactly what is wrong. Your pot circuit looks odd to me. I thought the path was Vcc->cap->pot->gnd. with the signal taken from between the cap and potthrough another resistor. Your diagram seems to show the pot parallel with the cap.

    There is clearly some direct short somewhere through the guts of the PIC. maybe this has to do with the type of internal circuit for one of the pins. ie: open collector or totom pole.

    As for blowing a 7805, I have never acheived that. they have alwys shut down before then. This is why I think a direct short has to be the problem. the current is spiking so fast, it can't turn itself off before destruction.

    Keep this in mind also: even though the hardware worked on the stamp, as you know this will be running much faster, so maybe some back emf from the coil or possibly something else. just saying remember all things are not equal


    code tags are this: add [code (other bracket), then your code, then bracket /code] and it will put your code in a nice scrollable box
    Last edited by cncmachineguy; - 19th March 2011 at 00:07.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  15. #15
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    I normally use a 470 ohm for the typical LED when the voltage is ~5 , not as bright as could be but safe. Bruce spells it out here.
    http://www.picbasic.co.uk/forum/show...6966#post76966

    Like Bert said, do one thing at a time. Trouble shooting can be a pain.
    Dave
    Always wear safety glasses while programming.

  16. #16
    Join Date
    Feb 2011
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    I'd like to explore my theory first, considering my accomplished tests sufficient proof (so far) that the two global commands don't help in my circuit. What other commands are there to try? What commands would convert or leave the 3 essential pins analog and make the rest digital?

    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 "normal" inaction with the POT input may also be affected by a more specific analog input, compare, or conversion command. The exact same POT circuit was used successfully with the Stamp, with the exact same RCTIME command. RC means Resistor-Capacitor so it is necessary for them to be in parallel to create a measureable oscillator time change when the POT value changes. I don't know why it is connected to ground instead of 5+ but I got that circuit from Stamp docs. Perhaps a different setting for that pin is needed to accept analog input from ground instead of positive values.

    I don't know how the guts of the Analog - Compare commands work, if there's any need to know. I do think finding pin specific commands would be a step toward a solution. What section of the book are those in? Thanks.
    Last edited by Kirk Fraser; - 19th March 2011 at 02:18.

  17. #17
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    Look up ADCON1 register in the datasheet. to find it faster, make sure bookmarks are on and scroll do the the A/D section. this section will tell you lots of stuff about how the pic does the A/D. the registers are always listed at the end of the section. BTW, within the first few paragraphs it explains how to turn the Analog input on and off to use the pin as Digital or analog. Any way, look up ADCON1 and read which bits need to be on or off, 0 or 1, set or clear.

    PWM is not an analog output.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  18. #18
    Join Date
    Feb 2011
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: A Defines Request

    Bert,

    I'm pretty sure the reason it doesn't work is some kind of setup is needed for the A/D like there was when the LED test wasn't working. My explination of how the burnout works may be imperfect but it's gotta be close. Whatever the reason, if either output pin defaults to "1" when not setup, that would trigger the IRL530 to max out its coil.

    I need to know something about how registers work - do they execute in sequence like a program? If I set ADCON1 =15 that turns off the A/D for all pins, then I set ADCON0 = 3 will it turn on A/D for Port.A0? Or will it ignore it if written in reverse order? Or can I assume the A/D defaults to off when not set up then perhaps only the ADCON0 = 3 would be necessary?

    I don't quite understand what a comparator is. I understand the digital "or" but how does that handle A/D? I'd think CMCON = 7 should be ok unless required for A/D. Perhaps its safer (to conserve my remaining PIC chips) to assume the register is completely unnecessary in my application.

    PWM is not strictly a digital signal since the width of each pulse can vary but it doesn't need conversion from digital to analog by the A/D converter, with the output bit set, does it? On page 151 item 15.4.4 is a list to set up PWM. Does PBP do any of that when the PWM command is used? I'm guessing not because of the burnt chips. So how do I tell which pins can receive a PWM output command? Do I use ordinary or enhanced PWM?

    It would be nice if PBP did everything it could including setting up each chip function when called.

    Kirk
    Last edited by Kirk Fraser; - 19th March 2011 at 06:32.

  19. #19
    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.

  20. #20
    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

  21. #21
    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

  22. #22
    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 ***

  23. #23
    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 22:34.

Members who have read this thread : 1

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