i would like to know the c++ code to generate increasing pwm

i would like to know the c++ code to generate 1 increasing pwm on one pin of 89c2051 when signal comes at 3.4 of 89c2051 and decreasing pwm on the same pin of 89c2051 when signal comes at 3.5 [in of 89c2051.

Parents
  • You're in luck, they're both static functions in the IBSHY C++ compiler for the 8051.

    Here is the code you would use:

    void main(void)
    {
      PWM::Init();
    
      for (;;)
      {
        if (PORTS::IsPortPinTrue(3,4))
        {
          PWM:Increase();
        }
    
        if (PORTS::IsPortPinTrue(3,5))
        {
          PWM:Decrease();
        }
      }
    }
    

    But as you're no doubt aware, the IBSHY C++ compiler has not yet been released, so you'll have to use the beta version. Just Google for it and you may find it.

Reply
  • You're in luck, they're both static functions in the IBSHY C++ compiler for the 8051.

    Here is the code you would use:

    void main(void)
    {
      PWM::Init();
    
      for (;;)
      {
        if (PORTS::IsPortPinTrue(3,4))
        {
          PWM:Increase();
        }
    
        if (PORTS::IsPortPinTrue(3,5))
        {
          PWM:Decrease();
        }
      }
    }
    

    But as you're no doubt aware, the IBSHY C++ compiler has not yet been released, so you'll have to use the beta version. Just Google for it and you may find it.

Children
More questions in this forum