duty cycle y frecuencia medir


Closed Thread
Results 1 to 2 of 2
  1. #1

    Default duty cycle y frecuencia medir

    hola necesito ayuda para mejorar el codigo no muestra bien en pantalla tiene un parpadeo y las muestras son muy lentas, como se puede mejorar para que sea mas estable


    DEFINE LCD_DREG PORTC
    DEFINE LCD_DBIT 4
    DEFINE LCD_RSREG PORTC
    DEFINE LCD_RSBIT 1
    DEFINE LCD_EREG PORTC
    DEFINE LCD_EBIT 0


    define lcd_lines 2
    define intosc 4
    low portc.2
    DEFINE ADC_BITS 8
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 50


    ANSEL = %11111111
    ANSELH = %00000000
    lectura var word
    lectura2 var word
    resultado VAR word
    resultado2 var word
    f var word
    bajo VAR WORD
    alto VAR WORD
    total VAR WORD
    duty VAR WORD





    lcdout $fe,1," iniciando "
    PAUSE 500
    LCDOUT $FE, 1



    inicio:


    ADCIN 1, LECTURA
    RESULTADO = (LECTURA */ 500)


    adcin 3,lectura2
    resultado2 = (lectura2 */500)


    PULSIN PORTB.0 , 0 , bajo
    PULSIN PORTB.0 , 1 , alto
    total=bajo + alto
    duty = ( bajo * 100 ) / total
    if duty < 5 then duty = 0
    if duty > 90 then duty = 100


    count portB.0,200,f
    f=f *5



    paUSE 100
    LCDOut $fe , 1
    lcdout $fe ,$80 ,"DUTY:" , DEC2 duty ,"%"
    LCDOUT $fe , $C0 ,"CPS:" , DEC3 f ,"hz"
    LCDOUT $fe, $8a, "V=", DEC (RESULTADO/10),".",dec1 resultado
    lcdout $fe,$c9, " A=", dec (resultado2/100),".",dec1 resultado2



    GOTO inicio
    end

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: duty cycle y frecuencia medir

    como usaría el timer 1 en basic?

Similar Threads

  1. medir duty y frecuencia
    By callecuatro in forum mel PIC BASIC
    Replies: 6
    Last Post: - 26th July 2016, 14:26
  2. Duty Cycle
    By Gord11 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 29th September 2011, 09:53
  3. How can I measure Duty cycle ?
    By MaxiBoost in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 28th December 2006, 16:02
  4. PWM _ Duty Cycle in Tenths
    By rwskinner in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 17th May 2004, 13:09
  5. Duty Cycle Dilemmas
    By crankshaft in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 27th February 2003, 13:40

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