what is wrong am i doing in this code?


Results 1 to 14 of 14

Threaded View

  1. #1
    Join Date
    Jan 2012
    Posts
    24

    Default what is wrong am i doing in this code?

    in this code i want to increase the duty ratio until the input volts at RA1 is equal to the Vref, after while loop is true to light the led at portb.5. the problem here is the output is not increase and the duty ratio are not changing to make the output to vary, i need help here to make my code to do as i want

    Code:
    TRISA=255
    TRISB=0 
    CMCON=%00000101
    
    compOut VAR CMCON.7
    VRCON=0
    pauseus 10
    duty var byte 
    duty=0
    while (compout=0)
      pwm 7,duty,1
     duty=duty+1
      wend 
      portb.5=1
      pause 100

    this is my circuit
    Attached Images Attached Images

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