HPWM down


Results 1 to 6 of 6

Thread: HPWM down

Threaded View

  1. #1
    Join Date
    Sep 2006
    Posts
    747

    Default HPWM down

    I am attempting to control my motor using the HPWM. The code works, but the header has a problem .

    I used a header from a post I found here,it works, but I would liek to know what is wrong with mine

    This do not work:
    INCLUDE "modedefs.bas"
    DEFINE OSC 20 'use external 20mhz crystal
    PAUSE 300 ' start-up delay
    DEFINE CCP1_REG PORTB 'Hpwm 1 pin port, RIGHT
    DEFINE CCP1_BIT 3 'Hpwm 1 pin bit

    TRISA = %11111111 ' Set PORTA to all input
    TRISB = %00000000
    loop:
    HPWM 1,127,1000

    Goto loop 'Do it forever
    end


    This code works:
    @ DEVICE MCLR_ON, INTRC_OSC, WDT_ON, LVP_OFF, BOD_OFF, PWRT_ON, PROTECT_OFF, CCPMX_ON
    OSCCON=$60 ' use internal 4MHZ osc
    PAUSE 300 ' start-up delay
    DEFINE CCP1_REG PORTB 'Hpwm 1 pin port, RIGHT
    DEFINE CCP1_BIT 3 'Hpwm 1 pin bit

    TRISA = %11111111 ' Set PORTA to all input
    TRISB = %00000000
    loop:
    HPWM 1,127,1000

    Goto loop 'Do it forever
    end

    As soon as i turn off the internal oscillation and put in a 20Mhz crystal, it does not work
    Last edited by lerameur; - 9th January 2007 at 21:07.

Similar Threads

  1. need help on hpwm
    By helmut in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th August 2007, 15:49
  2. HPWM of the port of two HPWM
    By ja2rqk in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th April 2007, 15:05
  3. sound command & music
    By trying in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th May 2006, 14:14
  4. HPWM and A to D interaction question 18F252
    By tcbcats in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 10th May 2006, 03:50
  5. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 02:43

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