AB Micrologix 1500 String ASCII convert to Bits

Layston

Member
Join Date
Jun 2010
Location
Boston
Posts
2
Hello,

I am a veteran Mitsubishi programmer, but am new to AB. I have a Micrologix 1500. I am receiving a string via RS232 on Channel 1. In that string there is a character that is a response character to a command. Each bit in that character means something. i.e. bit 0=error, bit 1=busy, bit 2=bad command etc.

My question is, how to I take a single character and get bit values out of it? I tried ACI instruction but since it is not a number, this fails. Then I tried MOV ST10:0.DATA[1] N7:0 and then accessed the bits via N7:0/1 but this didn't seem to work either. Am I missing something?

Thanks for any help.
 
Each character in your string is a byte, so there are two characters per 16 bit word. The ACI will convert an ascii character to an integer, and is only useful if the character is numeric...not what you want...

If you COPy the ST data to integer(s), it will not perform any conversion, and the bit pattern should remain intact. Note that the length parameter of the COP instruction is in reference to the number of elements of the destination. If your destination is an N file or B file, each element is 16 bits, so you'll be copying 2 characters into each element, since each character is only 8 bits in the source.
 
Last edited:
Bernie - you got me most of the way there. I had made a bad assumption that the array would start at 1 because when I had tried to get other characters out of a string, the array is 1 to 82. So my "MOV ST10:0.DATA[1] N7:0" became "MOV ST10:0.DATA[0] N7:0".

Then I had to do an SWP because the two bytes were reversed, my bit I was looking for was in the upper byte of the integer. I suppose I could have just displaced my lookup from bit 5 to bit 13 but that would be confusing later on when reading documentation from the vendor of the other device.

Thanks for the FAST response.
 

Similar Topics

Hello friends I am reading 32 bytes from a display through ML1500 COM1, configured as ascii and storing in ST file What I am reading is...
Replies
8
Views
3,764
I have been working on this for a while now and I can't seem to get it. I was finally able to view the 1500 on the PanelView under the serial...
Replies
1
Views
30
Hello, I have a 1764 1500 LSP Series A that keeps failing with DTL_E_FAIL I/O error. Searching around it seems there's a weird issue specifically...
Replies
2
Views
98
Good Day i Have Micrologix 1500 LSP, and I want to get data from plc and send it through Modbus RTU slave; I have only ch0 on that plc I Order...
Replies
6
Views
912
Hello folks, Hope everyone is doing fine. I got an OMRON NS10-TVOOB-V2 hmi screen last day and planning to use it with Micrologix 1500. 1. Is...
Replies
4
Views
1,200
Back
Top Bottom