HPWM of the port of two HPWM


Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Apr 2007
    Location
    japan
    Posts
    2

    Red face HPWM of the port of two HPWM

    questions on two ports was used.
    There is production winkers.
    The operation of HPWM doesn't move normally.
    The operation only of one port is something strange though it seems
    to move.
    The second port doesn't operate.
    The operation of usual HI and LOW is normal.
    I do not understand the cause though it is thought that the part
    related to HPWM is bad because the blinking mode becomes a defective
    operation, too, when changing it from the PWM mode into the blinking mode.
    It buys and it experiments on PIC16F616 that HPWM is a lot of.
    Please teach if there is what becomes some references.

    code:
    'Control of Winkers

    PORTC=0
    TRISC=0
    ADCON0 = 0
    ANSEL = 0

    DEFINE HPWM2_TMR 2

    Duty var byte
    T VAR WORD
    INPA var byte

    IL var PORTA.1
    IR var PORTA.2
    SELSW var PORTA.4

    LEDL VAR PORTC.5
    LEDR VAR PORTC.4

    t=1000

    Start:
    TRISA = %11111111
    INPA = PORTA
    IF INPA=%00000010 then gosub LPWM
    IF INPA=%00000100 THEN GOSUB RPWM
    IF INPA=%00010010 then gosub LPulse
    IF INPA=%00010100 THEN GOSUB RPulse
    ' bit5 modeSW
    goto Start


    LPWM: 'Lch PWMOUT
    for duty =0 to 255 step 2
    hpwm 2,DUTY,1000
    next
    for duty =255 to 0 step -2
    hpwm 2,DUTY,1000
    next
    return

    RPWM: 'Rch PWMOUT
    For duty =0 to 255 step 2
    hpwm 1,DUTY,2000
    next
    for duty =255 to 0 step -2
    hpwm 1,DUTY,2000
    next
    return

    'Lch out HiLow
    LPulse:
    HIGH LEDL
    PAUSE T
    LOW LEDL
    PAUSE T
    return

    'Rch out HiLow
    RPulse:
    HIGH LEDR
    PAUSE T
    LOW LEDR
    PAUSE T
    return

    end
    Last edited by ja2rqk; - 24th April 2007 at 13:39.

Similar Threads

  1. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  2. HPWM down
    By lerameur in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 10th January 2007, 00:06
  3. PWM problem CCP2 port
    By NL2TTL in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 19th September 2006, 23:34
  4. sound command & music
    By trying in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th May 2006, 14:14
  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