AX1500 encoders serial bytes

11 years 11 months ago #29192672 by cpayne
AX1500 encoders serial bytes was created by cpayne
Hi. I am wanting to read the encoder position using a microchip. I was planning on using a level converter, but is it possible to get to the TTL Tx and Rx?

2nd is I am just using simple 16bit chip, then the chip sends the data to a host computer via a WiFi link. So my simple relay chip can not handle 32bit or signed. I would like to just read each of the 4 bytes for each encoder using simple serial commands. I was planning on picbasic pro, so some simple serout or serout2 command, then a serin or serin2 command. Reading the manual leads me to believe I can using the mailbox counter read/write method, but I am not too sure how to implemement this. ANy help or examples would be great.

Thanks!

Please Log in or Create an account to join the conversation.

11 years 11 months ago #29211089 by cosma
Replied by cosma on topic Re:AX1500 encoders serial bytes
The controller will accept 0-5V TTL levels instead of the +/-12 of the RS232 standard. Beware however that the logic may be inverted. I believe the microchip part can be configured so that the usart signals are inverted.

You should be able to assemble the full 32-bits by accessing the 4 mailbox registers. I am not familiar enough with the uchip devices.

Please Log in or Create an account to join the conversation.

11 years 11 months ago #29212431 by cpayne
Replied by cpayne on topic Re:AX1500 encoders serial bytes
THanks for the reply,

Where on the board do I pick up the TTL level serial?

Please Log in or Create an account to join the conversation.

11 years 11 months ago #29212528 by cosma
Replied by cosma on topic Re:AX1500 encoders serial bytes
You will feed your uChip TTL signal to the controller's RS232 signals on the 15pin connector.

The controller's TxData (pin2) will swing from -12 to +12 via a 5K resitor. You should be able to feed it directly to your MCU input but to play it safe add another 5K resitor between pin 2 and your input.

Please Log in or Create an account to join the conversation.

11 years 11 months ago #29321866 by cpayne
Replied by cpayne on topic Re:AX1500 encoders serial bytes
I'm sorry I don't understand what you are saying. My uChip has a 0-5VTTL output, how do I pull that up to the RS232 level? For the Rx, are you just saying to put a 5k resistor in serries?

Thanks

Please Log in or Create an account to join the conversation.

11 years 11 months ago #29327061 by cosma
Replied by cosma on topic Re:AX1500 encoders serial bytes
You dont need to convert the uChip output to +/-12V.

The 0-5V output of the uChip can be fed directly in the controller's Rx data

The controller's TxData can be fed directly to the uChip 0-5V input. Since the TxData will swing from +/-12V, a resistor must be used between the controller and the uChip. The diodes that are built in the uChip pads will clamp that voltage to 0-5V.

Please Log in or Create an account to join the conversation.

11 years 11 months ago #29344658 by cpayne
Replied by cpayne on topic Re:AX1500 encoders serial bytes
When getting the encoder counts by byte I write
?Q0 to read then encoder values and store them in the mailbox
*88, *89, *8A, *8B to get the bytes of the encoder. Then I repeat with a ?Q1 and repeat the *88, *89, *8A, *8B . ALl seems to be working well. I am I doing this right?

THe next issue I have is when the counters go negative, I get FF in all the registers and it starts counting down instead of counting from -1, -2, etc. I guess I can get around this by subtracting the number from FF. What is the best way to determine the sign of the data at any given time by using he mailboxes?

Thanks

Please Log in or Create an account to join the conversation.

11 years 11 months ago #29359523 by cosma
Replied by cosma on topic Re:AX1500 encoders serial bytes
?Q1 should output the counter value directly. There should be no need to read the mailboxed.

To read negative values, you should substract the counter value from 0. Beware that in order to save bandwidht, there is a special coding scheme for negative numbers. For example, -1 is given as FF instead of FFFFFFFF. Look at the manual for the detailed explanations

Please Log in or Create an account to join the conversation.

11 years 11 months ago #29359968 by cpayne
Replied by cpayne on topic Re:AX1500 encoders serial bytes

I have to read the mailboxes because the uchip i am using can only read a byte at a time. So am I reading the mailboxes correctly? and is there a way of telling if I am negative from the mailbox bytes?

Please Log in or Create an account to join the conversation.

11 years 11 months ago #29360149 by cosma
Replied by cosma on topic Re:AX1500 encoders serial bytes
You then need to assemble a 32-bit number by fetching the 4 bytes from the mailbox.

Then you substract that number from 0. Example 0 - FFFFFFFE = -2

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.133 seconds