HPWM fails...


Results 1 to 4 of 4

Thread: HPWM fails...

Threaded View

  1. #1

    Default HPWM fails...

    Well not fails, but seem to behave odd...

    if i create a simple for-next with a byte variable and out it the channel 1 or 2, with led's connected, the leds raise in brightness 3 (yes three) times for the loop!

    I am using USB with DT interrupts, and ADC on ra0/ra1, idea was the adc value of ra0/1 woul;d pwm the outputs on channel 0/1



    Is there any defines I should be looking at etc or anything else i can post to help?

    18f2550, at 4mhz, pll div 1 OSC 48 etc.



    Code:
    DEFINE HSER_RCSTA	90h
    DEFINE HSER_TXSTA	20h    ; 24 is giving error
    DEFINE HSER_BAUD	9600
    ' DEFINE HSER_SPBRG	25  ' let picbasic set it from the baud def above
    DEFINE HSER_EVEN	1
    
    DEFINE CHAR_PACING 1000   ' slow things a little
    
    DEFINE HSER_CLOERR  1 ' automatic clear overrun error
    
    
    
    DEFINE ADC_CLOCK 1
    DEFINE ADC_BITS 8
    DEFINE ADC_SAMPLEUS 10
    
    ADCON1 = %10000011 ; not sure lol
    CMCON = 7 ;  Disable Comparators
    
    INTCON2.7 = 0 ; should enable portb pullups.
    
    
    for tempx=0 to 255
    
    
    HPWM 0,tempx,1000
    hpwm 1,255-tempx,1000
    
    portb=tempx
    
    pause 125
    next

    maximu brightness is at 87 and 174, not 255....

    any ideas what could be causing this looping?


    edit: user error, time to RTFM...

    freq too low for clock speed...
    Last edited by f_lez; - 24th March 2010 at 16: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