Macro Error


Closed Thread
Results 1 to 8 of 8

Thread: Macro Error

  1. #1
    Join Date
    Dec 2004
    Location
    nebraska
    Posts
    79

    Default Macro Error

    Hi
    I tried to use HPWM command and this error came up.

    error:macro HPWM?tcc not found im macro file.

    Do I have a corrupt file or what I'm using a 18F458. I've never had problems with any other commands before here is my code.

    Define OSC 20 'OSC (20Mhz)
    Include "modedefs.bas" 'Includes Definitions.
    INTCON = %00000000 'Turns off all Interrupts.
    ADCON0.0 = 1 'Turns off A/D Module
    ADCON1 = 6 'Turns PortA and PortE to Digital Pins
    'Defines wait time for PulsIn.
    TrisB.1 = 0
    Define Loader_USED 1

    HPWM PortD.7,127,5600
    Main:
    PortB.1 = 1
    Pause 1000
    PortB.1 = 0
    Pause 1000
    Goto Main

    Am I missing a define or an include. I thought maybe I got a virus or something that screwed of a file so I reloaded PBP 2.44 and had the same problem.

    please help
    thanks

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Shawn,

    Oh, if only you could do that, it would make things so much easier.

    But you can't assign the PIN for the HPWM command. The CCP module is hard wired to pin 17 (RC2) on the 458. So you need to supply the channel number, which in this case is 1.

    HPWM 1,127,5600

    And, since you're turning off all the A/D inputs, don't forget about the comparators on PORTD

    CMCON = 7

    <br>
    DT

  3. #3
    Join Date
    Dec 2004
    Location
    nebraska
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel
    The reason I used PortD.7 was because the data sheet said the pic18F458 has five PWM pins and Portd.7 is one of them.

    So anyway what does the one stand for in HPWM 1,127,5600. I assumed it stood for a pin but I put an 8 in place of the one and the file still assembled in microcode studios.

    What im doing with this is I need to PWM channels running at the same time.
    I'm running 2 PWM motors from a kit I got. HPWM command I hope will work since the frequenct will stay the same but not the duty cyle. What else can I do.
    Thanks

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    The 18F458 only has 2 CCP modules. One is a normal CCP, and the other is an Enhanced CCP or ECCP.

    The ECCP does have several outputs, and can be used for controling other types of motors, but it won't give you that many PWM outputs, and you can't choose which pin to use.

    You can still use it like a normal CCP, but the output will be on RD4.

    HPWM 2,127,5600

    So, 1 selects the CCP and 2 selects the ECCP.
    <br>
    DT

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Oh yeah, forgot to mention that you need to add these lines to the bottom of the 18F458.INC file in your PBP folder.
    Code:
    CCPR2H  = ECCPR1H
    CCPR2L  = ECCPR1L
    CCP2CON = ECCP1CON
    DT

  6. #6
    Join Date
    Dec 2004
    Location
    nebraska
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Darrel
    ThankYou for your help it has been awhile since I've been able to work on my projects.
    Shawn

  7. #7
    Join Date
    Dec 2004
    Location
    nebraska
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Hey Darrel
    I Still can not get the ECCP Port to work. I added the three lines to the INC file.
    This is what I have for Code.

    Define OSC 20 'OSC (20Mhz)
    Include "modedefs.bas" 'Includes Definitions.
    Define Loader_USED 1
    INTCON = %00000000 'Turns off all Interrupts.
    ADCON0.0 = 1 'Turns off A/D Module
    ADCON1 = 6 'Turns PortA and PortE to Digital Pins
    'Defines wait time for PulsIn.
    TrisB.1 = 0
    CMCON = 7
    HPWM 1,127,40000
    HPWM 2,200,40000
    Main:
    PortB.1 = 1
    Pause 1000
    PortB.1 = 0
    Pause 1000
    Goto Main

    I can get this part of the code to work HPWM 1,127,40000.
    But I can not get this part to work HPWM 2,200,40000.
    I have all of the RD4 for ECCP and RC2 for CCP.
    Please tell me what I'M missing can both ECCP and CCP run at the same time?
    This is driving me nuts.
    Thanks

  8. #8
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Shawn,

    Oops, 1 more thing.

    Code:
    DEFINE CCP2_REG PORTD 'Hpwm 2 pin port 
    DEFINE CCP2_BIT 4     'Hpwm 2 pin bit
    That let's the compiler know which pin to set as an output for HPWM. It defaults to PORTC.1
    <br>
    DT

Similar Threads

  1. PBPro error "Macro USBINIT? not found in macro file"
    By Bonxy in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th October 2011, 09:06
  2. Replies: 6
    Last Post: - 4th November 2009, 13:36
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Optimizing DIV
    By skimask in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 22nd September 2008, 04:58
  5. 16F88 Compile error
    By Toley00 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 2nd November 2005, 00:22

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