> From: Gene Heskett [mailto:ghesk...@shentel.net]
> On Monday 13 September 2021 18:11:44 John Dammeyer wrote:
> 
> > Hi Gene,
> > I was able to use your pyvcp information along with the web documents
> > to get my own slider working. In the CAN message screen grab you can
> > see id=218, dlc=4, and the first two bytes representing 0x0032 in
> > Little Endian format.  That value in decimal is 50. Scale screen grab
> > shows the slider set at 50.  Drag the slider back and forth and the
> > CAN message changes. And on the scope the screen shot shows 5V.  Drag
> > the slider back and forth and the voltage trace changes amplitude.
> > That voltage is based on the received CANopen message sent from the
> > slider on the Pi4 LCNC. Thanks again for your help.
> > John Dammeyer
> >
> NP John, glad I could help.

I realized after I posted all that and looked at the PIC source code that I 
remembered incorrectly (ie. Forgot)  that the PWM values are 8 bits not 16 with 
a resolution of 1%.  Only two bytes are needed in the message.  The code below 
shows how it's properly converted and set into the hardware PWM generation 
registers.

  case 0x200 :  // Receive PDO 1
        // PWM Outputs for LH CONN pin 2,11
        if (id == NodeID ) {
                OC3RS = ScalePWM((int)CANOpenMsg.d.data[0]);
                OC4RS = ScalePWM((int)CANOpenMsg.d.data[1]);
                ObjectDictionaryValues[XIM_PWM1_NDX] = ReportPWM(0);
                ObjectDictionaryValues[XIM_PWM2_NDX] = ReportPWM(1);
        }
        break;


> 
> Cheers, Gene Heskett
> --
> "There are four boxes to be used in defense of liberty:
>  soap, ballot, jury, and ammo. Please use in that order."
> -Ed Howdershelt (Author)
> If we desire respect for the law, we must first make the law respectable.
>  - Louis D. Brandeis
> Genes Web page <http://geneslinuxbox.net:6309/gene>
> 
> 
> _______________________________________________
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users



_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to