News:

  • September 29, 2023, 03:57:49 PM

Login with username, password and session length

Author Topic: More H0-CTRIO2 Math w/ DLO5  (Read 3347 times)

sgsims

  • Hero Member
  • *****
  • Posts: 106
More H0-CTRIO2 Math w/ DLO5
« on: April 17, 2014, 12:11:07 PM »
Since the DL05 can't do Binary Math I am converting the Binary output from the CTRIO to BCD....so far so good.  What happens when the binary count from the CTRIO gets out of the BCD range?  Will CTRIO will continue to count up to the full range of a binary double word before rolling over to 0?  If so I guess I need to figure out a way to soft reset the CTRIO count before it gets above 99999999 or all my math will fall apart.

I guess I should be using the scaling feature of the CTRIO to scale to a BCD format.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3583
    • Host Engineering
Re: More H0-CTRIO2 Math w/ DLO5
« Reply #1 on: April 17, 2014, 01:39:46 PM »
05 can do some BINARY Math.  What exactly do you need?

sgsims

  • Hero Member
  • *****
  • Posts: 106
Re: More H0-CTRIO2 Math w/ DLO5
« Reply #2 on: April 17, 2014, 01:43:19 PM »
I need to ADD a constant value to the encoder count.  So I was trying to use ADDBD

sgsims

  • Hero Member
  • *****
  • Posts: 106
Re: More H0-CTRIO2 Math w/ DLO5
« Reply #3 on: April 17, 2014, 02:27:50 PM »
Your question got me thinking...I was thinking I needed to use the ADDBD instruction to add a constant to by DWORD Value being mapped from the CTRIO.  My constant value is 200 so can I do this?

LDD - V2000
ADDB - Kc8
OUTD - V2002

I tried this using a DL06..don't have a DL05 here in the office.  Seems to work.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3583
    • Host Engineering
Re: More H0-CTRIO2 Math w/ DLO5
« Reply #4 on: April 17, 2014, 02:29:50 PM »
Your question got me thinking...I was thinking I needed to use the ADDBD instruction to add a constant to by DWORD Value being mapped from the CTRIO.  My constant value is 200 so can I do this?

LDD - V2000
ADDB - Kc8
OUTD - V2002

I tried this using a DL06..don't have a DL05 here in the office.  Seems to work.
EXACTLY!

sgsims

  • Hero Member
  • *****
  • Posts: 106
Re: More H0-CTRIO2 Math w/ DLO5
« Reply #5 on: April 17, 2014, 02:35:43 PM »
awesome...gotta love those one word positive responses!
Thanks Franji1!