XG-5000 date

lowie

Member
Join Date
Apr 2020
Location
ghent
Posts
10
Hello!

Im very much a beginner. I'm working in XG-5000 and I want to read in the current date. After reading in the current date (in D01000) I want for example to move the current minutes (57) into M0200. But I dont know how to adress only the minutes?

https://imgur.com/WGwxOBD
https://imgur.com/RtmjDyb


Thanks in advance!:nodi:
 
Last edited:
Thank you but it doesnt seem to work either :(
Also when I adress the D01000 in BMOV it says that it is '1056' while above it is 'hxxxxxxxxxxxxxxxxx'?
aQE7v41
 
Thank you but it doesnt seem to work either :(
Also when I adress the D01000 in BMOV it says that it is '1056' while above it is 'hxxxxxxxxxxxxxxxxx'?
aQE7v41




There is no "H" before the 1056 in the image, so the 1056 is base 10, which is the same as H0420.


So that command is moving the low word (low 16 bits) of D01000 (H2005495616030420), where what is actually desired is the fifth byte i.e. H56.


The reason BMOV did that is that there was no Z argument supplied to the BMOV command, and my guess is that it assumes Z is H0010

  • H0xxx - start reading bits at bit 0 on the Source
  • Hx0xx - start writing bits at bit 0 on the Destination
  • Hxx10 - read and write H10 bits i.e one word = two bytes



I think it needs to be something like
Code:
  BMOV D01001 M0200 0008


OR


  MOV8 D01001.0 M0200
TL;DR


Data have been moved to D01000 as HCCwdSSMMHHddmmyy.


where

  • H indcates hexadecimal
  • All following values are in BCD
  • CC is hundreds of years (20 for 2000A.D. through 2099A.D.)
  • wd is weekday (00=Sunday; 05=Friday)
  • SS is second of minute
  • MM is minute of hour
  • HH is hour of day
  • dd is day of month
  • mm is month of year (01=January)
  • yy is year modulo 100 (19 for 2019A.D.)
Minute of hour is desired, that starts at bit 16 of the double word D01000; we cannot address bits beyond 15 (D01000.F), so we jump to the next double word address, so "D01000.10" (where the .10 implies H10 i.e. decimal 16) would be illegal syntax (I assume), but conceptually it is the same as D01001.0.


cf. "XGB/XGC Instructions and Programming User's Manual," section 2.2.5.


Again, if I understand that section 2.2.5 correctly, then that date field copied to D01000 looks like this



Code:
        +--Low nibble of D01001

        |

        v

H200549[COLOR=Blue][COLOR=black]5[/COLOR][I][B]6[/B][/I][/COLOR]1603[COLOR=Red]042[I][B]0[/B][/I][/COLOR]
[COLOR=Red][COLOR=Black]                ^[/COLOR][/COLOR]
[COLOR=Red][COLOR=Black]                |[/COLOR][/COLOR]
[COLOR=Red][COLOR=Black]                +--Low nibble of D01000
[/COLOR][/COLOR]
[COLOR=Red][I][B][COLOR=Black][/COLOR]
[/B][/I][/COLOR]
 
Last edited:
It is possible it could also be done the old-fashioned way, with a Bit-Shift-Right and a bit-wise AND, to put the BCD minutes value in the low byte of D01000, and then do the MOVe from D01000 to M0200



Code:
  DBSFR D01000 H10
  DWAND D01000 H0FF D01000
  MOV D01000 M0200
or, since the MOV can be constrained to move only the lower eight bits, making the DWAND redundant, this might work:


Code:
  DBSFR D01000 H10
  MOV D01000 M0200 H0008
or, since the high bit of the minute's BCD byte will never be set, which is also true of the next (hours) BCD byte below that


Code:
  BMOV  D01000 M0200  HF008
  BSFR  M0200  H01
but that assumes the bits to the left of that high bit (D01000.F) in the low word of D01000 will be sourced from the high word.
 
Last edited:
Thanks alot for your answers but neither one seems to work :(

The main goal is actually to get every "CC","wd","ss","mm","hh","dd","mm","yy" in a seperate memory.
 
Thanks alot for your answers but neither one seems to work :(

The main goal is actually to get every "CC","wd","ss","mm","hh","dd","mm","yy" in a seperate memory.


Do any of those alogrithms change the value in D01000? Can you provide images of the result?
 
Whoops, I rushed my answers and was mistaken by a factor of two on the bit counts!

The result in the image below is as should be expected without my error: it starts at bit 0 of D01001, which is the same as bit 16 of D01000 so it transferred the 07 = [dd] = today's day-of-month.


So they all worked: gclshortt's BMOV; MOV8; DWAND; DBSFR; etc.; we just need to fix the addressing a little bit.


I suggest the BMOV or the MOV8 D0100n.b. The MOV8 rungs would look something like this:

  • MOV8 D01000.0 M0200 ### Should move yy (trailing 20 of 2020)
  • MOV8 D01000.8 M0201 ### Should move mm (04)
  • MOV8 D01001.0 M0202 ### Should move dd (07, as it did in the image below)
  • MOV8 D01001.8 M0203 ### Should move HH (17)
  • MOV8 D01002.0 M0204 ### Should move MM (10)
  • MOV8 D01002.8 M0205 ### Should move SS (30)
  • MOV8 D01003.0 M0206 ### Should move wd (02)
  • MOV8 D01003.8 M0207 ### Should move CC (leading 20 or 2020)
Obviously the choice of the M020m locations will be made to suit the application.

Hr92Plz.png
 
It looks like most of those rungs are false: the XIC/NO on the left finds the P0000x bits set to zero, and so the rest of each rung, with the MOV8 instruction, does not execute.



On the only rung with one that is not false (P00005), the hour (21 i.e. H15 = 15 BCD) does appear to get copied to M00203.
 
Huh. You are well outside my wheelhouse. I only have the manual so I dunno what the heck is going on there. Are you sure you are monitoring the live PLC in the window on the right?
 

Similar Topics

Hello Gentlemen, I am having this weird issue. I can see the controller on Rslinx via ethernet. when I open the RSlogx 5k, open RSWho, I still...
Replies
3
Views
1,927
Hello, I am having issues updating a studio 5000 file to V33. Its currently on V32. When I go into Properties>Change Controller>Software revision...
Replies
1
Views
1,019
I want to update the firmware 15 to 20 on a ControlLogix 5561 Processor, Cat series 1756 L61 B. Is this possible? There are other components...
Replies
22
Views
7,434
Guys, beating my head on a wall here. I have two simple date-times and I want to find the oldest. Are there any better ways to do this beside a...
Replies
10
Views
3,409
I want to update from V30.02.00 to V30.02.02 as 5000 keeps crashing while I try to do an upload from a PLC with a large program. I figured what...
Replies
3
Views
2,225
Back
Top Bottom