You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old June 10th, 2021, 09:22 AM   #1
PLChristian
Member
United States

PLChristian is offline
 
Join Date: May 2021
Location: Wisconsin
Posts: 27
ASCii Line Feed Data

Hello all, as you probably are all aware I have been trying to interface an A&D GX4002A balance to a 1769-L24ER-QBFC1B controller by the use of a 1769-ASCII card. I am wondering if there is a way I can cycle each string in one at a time so there is no potential for corrupted data when the registers are updating. As of now I have the start and stop delimiters set which gives me the ascii string, but when the value from the balance changes the registers start changing in that same string so I am worried that when the ascii card is scanning at a fast pace the register might be caught between an update and give me bad data. Is there possibly a way where I can have the complete strings cycle through one at a time instead of just updating the registers in one particular string?
  Reply With Quote
Old June 10th, 2021, 09:38 AM   #2
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,826
I don't understand. Is the 1769-ASCII card continually updating the string in the -L24ER, and you are parsing the string across several scans? If yes, then you could buffer the string to another string, e.g. on the rising edge of the done/complete bit, to another location, and then disable that buffering until the buffered copy is parsed.
__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
  Reply With Quote
Old June 10th, 2021, 09:54 AM   #3
Steve Bailey
Lifetime Supporting Member + Moderator
United States

Steve Bailey is offline
 
Steve Bailey's Avatar
 
Join Date: Apr 2002
Location: The boondocks of Western Massachusetts USA
Posts: 7,525
I don't have hands-on experience with the 1769-ASCII card, but all the BASIC modules I have used included the ability to query the serial port buffer to find out how many characters it contained. Assuming that the balance is spitting out character strings as fast as it can, could you check for the number of characters in the serial port buffer. When the character count exceeds the size of a single measurement, fetch only the characters up to the delimiter (CR/LF ??). Then extract the weight data from the string.

You will need to flush the serial port buffer each time you have to restart the program in the 1769-ASCII module. And if the balance can spit out new measurements faster than the ASCII module can process requests for the character count in the buffer you'll need a different strategy.
  Reply With Quote
Old June 10th, 2021, 10:36 AM   #4
PLChristian
Member
United States

PLChristian is offline
 
Join Date: May 2021
Location: Wisconsin
Posts: 27
So I have both the start and stop delimiters set and with these set only these 17 registers can update. My worry is that when I'm scanning at 20 ms one of these registers may be caught in the middle of an update and give me a false value.
Attached Images
File Type: png Capture2.PNG (35.3 KB, 36 views)
  Reply With Quote
Old June 10th, 2021, 12:33 PM   #5
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,826
The ARL command transfers data by reading from the device buffer and writing to the SINT array (registers; string). The logic can control when that transfer occurs, so it can also prevent it from happening e.g. when the .DN or .EM bit is 1 and the string is not yet parsed.

What does the logic look like now? Is the .FD bit from an ABL instruction controlling the ARL? What logic sets the state of the EnableIn rung of the ABL instruction? Is some or all of this happening in the main routine or in interrupt routines?

Both ABL and ARL instructions are transitional i.e. they are enabled by the rising edge of the input rung, so the logic has to toggle the rung back to false and then to true to read the data again.

The parsing can be triggered by the ARL .EM bit and should, I expect, complete in that same single scan, but even if it does not, as long as that parsing prevents the ARL from running again, the array will not be overwritten.
__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.
  Reply With Quote
Old June 10th, 2021, 03:43 PM   #6
Ken Roach
Lifetime Supporting Member + Moderator
United States

Ken Roach is offline
 
Ken Roach's Avatar
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 15,926
Take a step back, folks: This is a 1769-ASCII module, not a controller serial port using ASCII instructions. The complexities of the Channel 0 buffer and the ARL/ARD instructions are not relevant.

The 1769-ASCII module accepts a string of data until it encounters a fixed buffer length or delimiter characters. It then populates an Input tag all at once with the status counters, the length of the data, and the data itself.

OP's logic very probably copies the InputTag:RxDataLength (an INT) and the InputTag:RxData[x] (a SINT array) to the .LEN and .DATA elements of a String tag before executing the String to REAL conversion.

To remove any concerns about asynchronous data handling, use the Copy Synchronous (CPS) instruction to copy the Input data elements to the String elements just once when the InputData:Ch0RxID value increments.
  Reply With Quote
Old June 10th, 2021, 04:18 PM   #7
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,826
Quote:
Originally Posted by Ken Roach View Post
Take a step back, folks: This is a 1769-ASCII module, not a controller serial port using ASCII instructions...

whoops! thanks.


Looks like the example on page 43 here should work then, Ken?
__________________
i) Take care of the bits, and the bytes will take care of themselves.
ii) There is no software problem that cannot be solved with another layer of indirection.

Last edited by drbitboy; June 10th, 2021 at 04:28 PM.
  Reply With Quote
Old June 10th, 2021, 06:28 PM   #8
PLChristian
Member
United States

PLChristian is offline
 
Join Date: May 2021
Location: Wisconsin
Posts: 27
Thanks for the help guys, I followed the example provided and used the trend feature under assets to view the scans live and everything looks good.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
rs 500 long word data type use Controls Tech LIVE PLC Questions And Answers 3 December 12th, 2018 01:18 PM
Sending ASCII data in Hex format? skkn LIVE PLC Questions And Answers 5 October 1st, 2013 02:20 PM
RS232 ASCII Works in HyperTerminal but Garbage Data with CompactLogix vv1s34ss LIVE PLC Questions And Answers 16 July 11th, 2012 01:58 PM
MPI comunication Manuel Raposo LIVE PLC Questions And Answers 22 July 16th, 2007 07:24 AM
ASCII DATA - transfering mjamil LIVE PLC Questions And Answers 9 January 13th, 2005 11:53 PM


All times are GMT -4. The time now is 12:37 AM.


.