serial command analog input

General discussion of the MCP motion controller product line
Post Reply
fausto.tromba
Posts: 25
Joined: Wed Jul 31, 2019 7:24 am

serial command analog input

Post by fausto.tromba » Fri Apr 24, 2020 12:36 am

I would like to use the ADC in the MCP236. That signal will be not used to control the motor driver, but simply like a normal ADC. So instead to implement in my circuit an ADC, I thought to use the internal ADC of the motor driver.
I set in the configuration setting:
[ing]

[/img]
Mode Setting: Position
Min 0
Max 32612
both control motors are unchecked.

When the pin 13 is connected to 5 V I can read by Studio, about 23000 instead of 32612.( Why?)
How can I read by Uart the values? I'm using Python library.

Thanks in advance

Fausto
Attachments
Unbenannt.PNG
Unbenannt.PNG (7 KiB) Viewed 1566 times

User avatar
Basicmicro Support
Posts: 1365
Joined: Thu Feb 26, 2015 9:45 pm

Re: serial command analog input

Post by Basicmicro Support » Fri Apr 24, 2020 9:59 am

ADC pins are 0 to 5.9v on the MCP. 5.9V. I am assuming you left the Min Center And Max Input setting set to 0 2048 and 4095? In this case a 0v signal will be -2047 and a 5v signal will be 1422 approximately.(eg ((5/5.9) * 4095) - 2048)

You also should not change the Command Settings. Those effect the COMMAND variable and are used when the Control Motor 1/2 check boxes are set.

Also, dont confuse the Command Settings "Position" mode with the Position variable. The position variable will show the raw input after it is mapped to the Min/Center/Max Range settings in Input Settings.

fausto.tromba
Posts: 25
Joined: Wed Jul 31, 2019 7:24 am

Re: serial command analog input

Post by fausto.tromba » Sat Apr 25, 2020 1:00 pm

Hi thank you for your feedback.
I m using MSP236 with Raspberry and your Python library.
How can i read the adc value by UART?
Tkx

User avatar
Basicmicro Support
Posts: 1365
Joined: Thu Feb 26, 2015 9:45 pm

Re: serial command analog input

Post by Basicmicro Support » Mon Apr 27, 2020 8:52 am

The usualy way would be to write a MCL script that will talk with your RPi application. What all do you need the MCP to do?

The only way to read the analog value with Packet Serial is to use the ReadSignals command which reads all values for all signals in a single command. This is rather slow(because it reads all signals data at once) and is not included the Python library so you would need to implement it.

The MCL script method is the recommended way.

fausto.tromba
Posts: 25
Joined: Wed Jul 31, 2019 7:24 am

Re: serial command analog input

Post by fausto.tromba » Mon Apr 27, 2020 11:30 am

Sorry but in the user manual I didn't find any description about ReadSingnals in the Packet Serial. what is the command number?
Can I have more details about it so I can implement it in the library? if you write directly the code witch i should write in the library we could avoid some ping pong messages

User avatar
Basicmicro Support
Posts: 1365
Joined: Thu Feb 26, 2015 9:45 pm

Re: serial command analog input

Post by Basicmicro Support » Wed Apr 29, 2020 7:50 am

Its under the packet serial section, Get Signal Values. Basically you send the address and command, it returns a byte to indicate the number of signals and then you read 4 word values per signal(pos,percent,instant speed and avr speed). First set of values is for DIN1, second for DIN2 etc...

Post Reply